fun main() {
    val testInput = readInput("Day08_test").toMatrix()
    check(part1(testInput) == 21)
    check(part2(testInput) == 8)

    val input = readInput("Day08").toMatrix()
    println(part1(input))
    println(part2(input))
}

private fun part1(input: Matrix): Int {
    val width = input[0].size
    val height = input.size
    var result = height * 2 + width * 2 - 4
    val used = Array(height) { BooleanArray(width) { false } }
    val row = IntArray(width) { input[0][it] }
    val column = IntArray(height) { input[it][0] }

    fun updateResult(i: Int, j: Int) {
        if (!used[i][j]) {
            ++result
            used[i][j] = true
        }
    }

    fun checkItem(i: Int, j: Int) {
        if (input[i][j] > column[i]) {
            updateResult(i, j)
            column[i] = input[i][j]
        }

        if (input[i][j] > row[j]) {
            updateResult(i, j)
            row[j] = input[i][j]
        }
    }

    //top-to-bottom, left-to-right pass
    for (i in 1..(height - 2)) {
        for (j in 1..(width - 2)) {
            checkItem(i, j)
        }
    }

    for (i in 1..(height - 2)) {
        column[i] = input[i][width - 1]
    }
    for (j in 1..(width - 2)) {
        row[j] = input[height - 1][j]
    }

    //bottom-to-top, right-to-left pass
    for (i in (height - 2) downTo 1) {
        for (j in (width - 2) downTo 1) {
            checkItem(i, j)
        }
    }

    return result
}

private fun part2(input: Matrix): Int {
    var result = 0
    val width = input[0].size
    val height = input.size

    for (i in 1..(height - 2)) {
        for (j in 1..(width - 2)) {
            val digit = input[i][j]

            var top = i - 1
            while (top > 0 && digit > input[top][j]) {
                --top
            }

            var left = j - 1
            while (left > 0 && digit > input[i][left]) {
                --left
            }

            var right = j + 1
            while (right < width - 1 && digit > input[i][right]) {
                ++right
            }

            var bottom = i + 1
            while (bottom < height - 1 && digit > input[bottom][j]) {
                ++bottom
            }

            val mul = (i - top) * (j - left) * (right - j) * (bottom - i)

            if (mul > result) {
                result = mul
            }
        }
    }

    return result
}

private fun List<String>.toMatrix(): Matrix {
    return Array(this.size) { i ->
        IntArray(this[i].length) { j ->
            this[i][j].digitToInt()
        }
    }
}

Compiled from "Day08.kt"
public final class Day08Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String Day08_test
       2: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
       5: invokestatic  #18                 // Method toMatrix:(Ljava/util/List;)[[I
       8: astore_0
       9: aload_0
      10: invokestatic  #22                 // Method part1:([[I)I
      13: bipush        21
      15: if_icmpne     22
      18: iconst_1
      19: goto          23
      22: iconst_0
      23: ifne          36
      26: new           #24                 // class java/lang/IllegalStateException
      29: dup
      30: ldc           #26                 // String Check failed.
      32: invokespecial #30                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      35: athrow
      36: aload_0
      37: invokestatic  #33                 // Method part2:([[I)I
      40: bipush        8
      42: if_icmpne     49
      45: iconst_1
      46: goto          50
      49: iconst_0
      50: ifne          63
      53: new           #24                 // class java/lang/IllegalStateException
      56: dup
      57: ldc           #26                 // String Check failed.
      59: invokespecial #30                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      62: athrow
      63: ldc           #35                 // String Day08
      65: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
      68: invokestatic  #18                 // Method toMatrix:(Ljava/util/List;)[[I
      71: astore_1
      72: aload_1
      73: invokestatic  #22                 // Method part1:([[I)I
      76: istore_2
      77: getstatic     #41                 // Field java/lang/System.out:Ljava/io/PrintStream;
      80: iload_2
      81: invokevirtual #47                 // Method java/io/PrintStream.println:(I)V
      84: aload_1
      85: invokestatic  #33                 // Method part2:([[I)I
      88: istore_2
      89: getstatic     #41                 // Field java/lang/System.out:Ljava/io/PrintStream;
      92: iload_2
      93: invokevirtual #47                 // Method java/io/PrintStream.println:(I)V
      96: return

  private static final int part1(int[][]);
    Code:
       0: aload_0
       1: iconst_0
       2: aaload
       3: arraylength
       4: istore_1
       5: aload_0
       6: checkcast     #53                 // class "[Ljava/lang/Object;"
       9: arraylength
      10: istore_2
      11: new           #55                 // class kotlin/jvm/internal/Ref$IntRef
      14: dup
      15: invokespecial #57                 // Method kotlin/jvm/internal/Ref$IntRef."<init>":()V
      18: astore_3
      19: aload_3
      20: iload_2
      21: iconst_2
      22: imul
      23: iload_1
      24: iconst_2
      25: imul
      26: iadd
      27: iconst_4
      28: isub
      29: putfield      #61                 // Field kotlin/jvm/internal/Ref$IntRef.element:I
      32: iconst_0
      33: istore        5
      35: iload_2
      36: anewarray     #63                 // class "[Z"
      39: astore        6
      41: iload         5
      43: iload_2
      44: if_icmpge     102
      47: iload         5
      49: istore        7
      51: aload         6
      53: iload         7
      55: iconst_0
      56: istore        8
      58: iload_1
      59: newarray       boolean
      61: astore        9
      63: istore        12
      65: astore        11
      67: iload         8
      69: iload_1
      70: if_icmpge     89
      73: iload         8
      75: istore        10
      77: aload         9
      79: iload         10
      81: iconst_0
      82: bastore
      83: iinc          8, 1
      86: goto          67
      89: aload         11
      91: iload         12
      93: aload         9
      95: aastore
      96: iinc          5, 1
      99: goto          41
     102: aload         6
     104: astore        4
     106: iconst_0
     107: istore        6
     109: iload_1
     110: newarray       int
     112: astore        7
     114: iload         6
     116: iload_1
     117: if_icmpge     141
     120: iload         6
     122: istore        8
     124: aload         7
     126: iload         8
     128: aload_0
     129: iconst_0
     130: aaload
     131: iload         8
     133: iaload
     134: iastore
     135: iinc          6, 1
     138: goto          114
     141: aload         7
     143: astore        5
     145: iconst_0
     146: istore        7
     148: iload_2
     149: newarray       int
     151: astore        8
     153: iload         7
     155: iload_2
     156: if_icmpge     180
     159: iload         7
     161: istore        9
     163: aload         8
     165: iload         9
     167: aload_0
     168: iload         9
     170: aaload
     171: iconst_0
     172: iaload
     173: iastore
     174: iinc          7, 1
     177: goto          153
     180: aload         8
     182: astore        6
     184: iconst_1
     185: istore        7
     187: iload_2
     188: iconst_2
     189: isub
     190: istore        8
     192: iload         7
     194: iload         8
     196: if_icmpgt     255
     199: iconst_1
     200: istore        9
     202: iload_1
     203: iconst_2
     204: isub
     205: istore        10
     207: iload         9
     209: iload         10
     211: if_icmpgt     242
     214: aload_0
     215: aload         6
     217: aload         5
     219: aload         4
     221: aload_3
     222: iload         7
     224: iload         9
     226: invokestatic  #67                 // Method part1$checkItem:([[I[I[I[[ZLkotlin/jvm/internal/Ref$IntRef;II)V
     229: iload         9
     231: iload         10
     233: if_icmpeq     242
     236: iinc          9, 1
     239: goto          214
     242: iload         7
     244: iload         8
     246: if_icmpeq     255
     249: iinc          7, 1
     252: goto          199
     255: iconst_1
     256: istore        7
     258: iload_2
     259: iconst_2
     260: isub
     261: istore        8
     263: iload         7
     265: iload         8
     267: if_icmpgt     296
     270: aload         6
     272: iload         7
     274: aload_0
     275: iload         7
     277: aaload
     278: iload_1
     279: iconst_1
     280: isub
     281: iaload
     282: iastore
     283: iload         7
     285: iload         8
     287: if_icmpeq     296
     290: iinc          7, 1
     293: goto          270
     296: iconst_1
     297: istore        7
     299: iload_1
     300: iconst_2
     301: isub
     302: istore        8
     304: iload         7
     306: iload         8
     308: if_icmpgt     337
     311: aload         5
     313: iload         7
     315: aload_0
     316: iload_2
     317: iconst_1
     318: isub
     319: aaload
     320: iload         7
     322: iaload
     323: iastore
     324: iload         7
     326: iload         8
     328: if_icmpeq     337
     331: iinc          7, 1
     334: goto          311
     337: iload_2
     338: iconst_2
     339: isub
     340: istore        7
     342: iconst_0
     343: iload         7
     345: if_icmpge     386
     348: iload_1
     349: iconst_2
     350: isub
     351: istore        8
     353: iconst_0
     354: iload         8
     356: if_icmpge     380
     359: aload_0
     360: aload         6
     362: aload         5
     364: aload         4
     366: aload_3
     367: iload         7
     369: iload         8
     371: invokestatic  #67                 // Method part1$checkItem:([[I[I[I[[ZLkotlin/jvm/internal/Ref$IntRef;II)V
     374: iinc          8, -1
     377: goto          353
     380: iinc          7, -1
     383: goto          342
     386: aload_3
     387: getfield      #61                 // Field kotlin/jvm/internal/Ref$IntRef.element:I
     390: ireturn

  private static final int part2(int[][]);
    Code:
       0: iconst_0
       1: istore_1
       2: aload_0
       3: iconst_0
       4: aaload
       5: arraylength
       6: istore_2
       7: aload_0
       8: checkcast     #53                 // class "[Ljava/lang/Object;"
      11: arraylength
      12: istore_3
      13: iconst_1
      14: istore        4
      16: iload_3
      17: iconst_2
      18: isub
      19: istore        5
      21: iload         4
      23: iload         5
      25: if_icmpgt     234
      28: iconst_1
      29: istore        6
      31: iload_2
      32: iconst_2
      33: isub
      34: istore        7
      36: iload         6
      38: iload         7
      40: if_icmpgt     221
      43: aload_0
      44: iload         4
      46: aaload
      47: iload         6
      49: iaload
      50: istore        8
      52: iload         4
      54: iconst_1
      55: isub
      56: istore        9
      58: iload         9
      60: ifle          81
      63: iload         8
      65: aload_0
      66: iload         9
      68: aaload
      69: iload         6
      71: iaload
      72: if_icmple     81
      75: iinc          9, -1
      78: goto          58
      81: iload         6
      83: iconst_1
      84: isub
      85: istore        10
      87: iload         10
      89: ifle          110
      92: iload         8
      94: aload_0
      95: iload         4
      97: aaload
      98: iload         10
     100: iaload
     101: if_icmple     110
     104: iinc          10, -1
     107: goto          87
     110: iload         6
     112: iconst_1
     113: iadd
     114: istore        11
     116: iload         11
     118: iload_2
     119: iconst_1
     120: isub
     121: if_icmpge     142
     124: iload         8
     126: aload_0
     127: iload         4
     129: aaload
     130: iload         11
     132: iaload
     133: if_icmple     142
     136: iinc          11, 1
     139: goto          116
     142: iload         4
     144: iconst_1
     145: iadd
     146: istore        12
     148: iload         12
     150: iload_3
     151: iconst_1
     152: isub
     153: if_icmpge     174
     156: iload         8
     158: aload_0
     159: iload         12
     161: aaload
     162: iload         6
     164: iaload
     165: if_icmple     174
     168: iinc          12, 1
     171: goto          148
     174: iload         4
     176: iload         9
     178: isub
     179: iload         6
     181: iload         10
     183: isub
     184: imul
     185: iload         11
     187: iload         6
     189: isub
     190: imul
     191: iload         12
     193: iload         4
     195: isub
     196: imul
     197: istore        13
     199: iload         13
     201: iload_1
     202: if_icmple     208
     205: iload         13
     207: istore_1
     208: iload         6
     210: iload         7
     212: if_icmpeq     221
     215: iinc          6, 1
     218: goto          43
     221: iload         4
     223: iload         5
     225: if_icmpeq     234
     228: iinc          4, 1
     231: goto          28
     234: iload_1
     235: ireturn

  private static final int[][] toMatrix(java.util.List<java.lang.String>);
    Code:
       0: iconst_0
       1: istore_1
       2: aload_0
       3: invokeinterface #93,  1           // InterfaceMethod java/util/List.size:()I
       8: istore_2
       9: iload_2
      10: anewarray     #80                 // class "[I"
      13: astore_3
      14: iload_1
      15: iload_2
      16: if_icmpge     108
      19: iload_1
      20: istore        4
      22: aload_3
      23: iload         4
      25: iconst_0
      26: istore        5
      28: aload_0
      29: iload         4
      31: invokeinterface #97,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      36: checkcast     #99                 // class java/lang/String
      39: invokevirtual #102                // Method java/lang/String.length:()I
      42: istore        6
      44: iload         6
      46: newarray       int
      48: astore        7
      50: istore        10
      52: astore        9
      54: iload         5
      56: iload         6
      58: if_icmpge     95
      61: iload         5
      63: istore        8
      65: aload         7
      67: iload         8
      69: aload_0
      70: iload         4
      72: invokeinterface #97,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      77: checkcast     #99                 // class java/lang/String
      80: iload         8
      82: invokevirtual #106                // Method java/lang/String.charAt:(I)C
      85: invokestatic  #112                // Method kotlin/text/CharsKt.digitToInt:(C)I
      88: iastore
      89: iinc          5, 1
      92: goto          54
      95: aload         9
      97: iload         10
      99: aload         7
     101: aastore
     102: iinc          1, 1
     105: goto          14
     108: aload_3
     109: areturn

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

  private static final void part1$updateResult(boolean[][], kotlin.jvm.internal.Ref$IntRef, int, int);
    Code:
       0: aload_0
       1: iload_2
       2: aaload
       3: iload_3
       4: baload
       5: ifne          29
       8: aload_1
       9: aload_1
      10: getfield      #61                 // Field kotlin/jvm/internal/Ref$IntRef.element:I
      13: iconst_1
      14: iadd
      15: putfield      #61                 // Field kotlin/jvm/internal/Ref$IntRef.element:I
      18: aload_1
      19: getfield      #61                 // Field kotlin/jvm/internal/Ref$IntRef.element:I
      22: pop
      23: aload_0
      24: iload_2
      25: aaload
      26: iload_3
      27: iconst_1
      28: bastore
      29: return

  private static final void part1$checkItem(int[][], int[], int[], boolean[][], kotlin.jvm.internal.Ref$IntRef, int, int);
    Code:
       0: aload_0
       1: iload         5
       3: aaload
       4: iload         6
       6: iaload
       7: aload_1
       8: iload         5
      10: iaload
      11: if_icmple     35
      14: aload_3
      15: aload         4
      17: iload         5
      19: iload         6
      21: invokestatic  #123                // Method part1$updateResult:([[ZLkotlin/jvm/internal/Ref$IntRef;II)V
      24: aload_1
      25: iload         5
      27: aload_0
      28: iload         5
      30: aaload
      31: iload         6
      33: iaload
      34: iastore
      35: aload_0
      36: iload         5
      38: aaload
      39: iload         6
      41: iaload
      42: aload_2
      43: iload         6
      45: iaload
      46: if_icmple     70
      49: aload_3
      50: aload         4
      52: iload         5
      54: iload         6
      56: invokestatic  #123                // Method part1$updateResult:([[ZLkotlin/jvm/internal/Ref$IntRef;II)V
      59: aload_2
      60: iload         6
      62: aload_0
      63: iload         5
      65: aaload
      66: iload         6
      68: iaload
      69: iastore
      70: return
}


fun main() {
    // test if implementation meets criteria from the description, like:
    val testInput = readInput("Day01_test")
    check(part1(testInput) == 24000)
    check(part2(testInput) == 45000)

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

private fun part1(input: List<String>): Int {
    return input.toCalories().maxOrNull() ?: 0
}

private fun part2(input: List<String>): Int {
    return input
        .toCalories()
        .sorted()
        .takeLast(3)
        .sum()
}

private fun List<String>.toCalories(): List<Int> {
    val result = mutableListOf<Int>()
    var current = 0

    this.forEach { row ->
        if (row.isEmpty()) {
            result.add(current)
            current = 0
        } else {
            current += row.toInt()
        }
    }
    result.add(current)

    return result
}

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

  private static final int part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #54                 // Method toCalories:(Ljava/util/List;)Ljava/util/List;
       4: checkcast     #56                 // class java/lang/Iterable
       7: invokestatic  #62                 // Method kotlin/collections/CollectionsKt.maxOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
      10: checkcast     #64                 // class java/lang/Integer
      13: dup
      14: ifnull        23
      17: invokevirtual #68                 // Method java/lang/Integer.intValue:()I
      20: goto          25
      23: pop
      24: iconst_0
      25: ireturn

  private static final int part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #54                 // Method toCalories:(Ljava/util/List;)Ljava/util/List;
       4: checkcast     #56                 // class java/lang/Iterable
       7: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.sorted:(Ljava/lang/Iterable;)Ljava/util/List;
      10: iconst_3
      11: invokestatic  #76                 // Method kotlin/collections/CollectionsKt.takeLast:(Ljava/util/List;I)Ljava/util/List;
      14: checkcast     #56                 // class java/lang/Iterable
      17: invokestatic  #80                 // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
      20: ireturn

  private static final java.util.List<java.lang.Integer> toCalories(java.util.List<java.lang.String>);
    Code:
       0: new           #83                 // class java/util/ArrayList
       3: dup
       4: invokespecial #85                 // Method java/util/ArrayList."<init>":()V
       7: checkcast     #49                 // class java/util/List
      10: astore_1
      11: iconst_0
      12: istore_2
      13: aload_0
      14: checkcast     #56                 // class java/lang/Iterable
      17: astore_3
      18: iconst_0
      19: istore        4
      21: aload_3
      22: invokeinterface #89,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      27: astore        5
      29: aload         5
      31: invokeinterface #95,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      36: ifeq          108
      39: aload         5
      41: invokeinterface #99,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      46: astore        6
      48: aload         6
      50: checkcast     #101                // class java/lang/String
      53: astore        7
      55: iconst_0
      56: istore        8
      58: aload         7
      60: checkcast     #103                // class java/lang/CharSequence
      63: invokeinterface #106,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      68: ifne          75
      71: iconst_1
      72: goto          76
      75: iconst_0
      76: ifeq          95
      79: aload_1
      80: iload_2
      81: invokestatic  #110                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      84: invokeinterface #114,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
      89: pop
      90: iconst_0
      91: istore_2
      92: goto          103
      95: iload_2
      96: aload         7
      98: invokestatic  #118                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     101: iadd
     102: istore_2
     103: nop
     104: nop
     105: goto          29
     108: nop
     109: aload_1
     110: iload_2
     111: invokestatic  #110                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     114: invokeinterface #114,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     119: pop
     120: aload_1
     121: areturn

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


import java.util.*

fun main() {
    val testInput = readInput("Day11_test")
    check(part1(testInput) == 10605L)
    check(part2(testInput) == 2713310158L)

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

private fun part1(input: List<String>): Long {
    val monkeys = input.toMonkeys()
    val worryLevelAdjuster = WorryLevelAdjuster { worryLevel ->
        worryLevel / 3
    }

    return solve(monkeys, roundsCount = 20, worryLevelAdjuster)
}

private fun part2(input: List<String>): Long {
    val monkeys = input.toMonkeys()

    //Use divider in order to avoid overflow of the worryLevel's variable
    val divider = monkeys.fold(1L) { acc, monkey -> acc * monkey.test.testValue }
    val worryLevelAdjuster = WorryLevelAdjuster { worryLevel ->
        worryLevel % divider
    }

    return solve(monkeys, roundsCount = 10_000, worryLevelAdjuster)
}

private fun solve(
    monkeys: List<Monkey>,
    roundsCount: Int,
    worryLevelAdjuster: WorryLevelAdjuster
): Long {
    val counts = LongArray(monkeys.size) { 0 }

    val redirectListener = RedirectListener { monkeyNumber, worryLevel ->
        monkeys[monkeyNumber].items.addLast(worryLevel)
    }

    repeat(roundsCount) {
        monkeys.forEachIndexed { index, monkey ->
            //monkey will inspect "monkey.items.size" in this round
            counts[index] += monkey.items.size.toLong()

            monkey.round(worryLevelAdjuster, redirectListener)
        }
    }

    counts.sortDescending()
    return counts[0] * counts[1]
}

private fun List<String>.toMonkeys(): List<Monkey> = this.chunked(7).map(List<String>::toMonkey)

private fun List<String>.toMonkey(): Monkey {
    val initialItems = this[1]
        .substringAfter("Starting items: ")
        .split(", ")
        .map { it.toLong() }
    val operation = Operation.fromString(this[2])

    val testValue = this[3].substringAfter("Test: divisible by ").toLong()
    val trueDestination = this[4].substringAfter("If true: throw to monkey ").toInt()
    val falseDestination = this[5].substringAfter("If false: throw to monkey ").toInt()
    val test = Test(
        testValue = testValue,
        trueDestination = trueDestination,
        falseDestination = falseDestination
    )

    return Monkey(initialItems, operation, test)
}

private fun interface RedirectListener {
    fun redirect(monkeyNumber: Int, worryLevel: Long)
}

private fun interface WorryLevelAdjuster {
    fun adjust(worryLevel: Long): Long
}

private class Monkey(
    initialItems: List<Long>,
    val operation: Operation,
    val test: Test
) {
    val items = LinkedList(initialItems)

    fun round(worryLevelAdjuster: WorryLevelAdjuster, redirectListener: RedirectListener) {
        while (items.isNotEmpty()) {
            var worryLevel = items.pollFirst()
            worryLevel = operation.perform(worryLevel)
            worryLevel = worryLevelAdjuster.adjust(worryLevel)

            val monkeyNumber = test.test(worryLevel)
            redirectListener.redirect(monkeyNumber, worryLevel)
        }
    }
}

sealed interface Operation {
    fun perform(worryLevel: Long): Long

    companion object {
        fun fromString(operation: String): Operation {
            return when {
                operation.contains("Operation: new = old * old") -> SqrOperation
                operation.contains("Operation: new = old +") -> AdditionOperation(
                    incValue = operation.substringAfter("Operation: new = old + ").toLong()
                )
                operation.contains("Operation: new = old *") -> MultiplicationOperation(
                    factor = operation.substringAfter("Operation: new = old * ").toLong()
                )
                else -> error("Unknown operation $operation")
            }
        }
    }

    class AdditionOperation(private val incValue: Long) : Operation {
        override fun perform(worryLevel: Long): Long = worryLevel + incValue
    }

    class MultiplicationOperation(private val factor: Long) : Operation {
        override fun perform(worryLevel: Long): Long = worryLevel * factor
    }

    object SqrOperation : Operation {
        override fun perform(worryLevel: Long): Long = worryLevel * worryLevel
    }
}

private class Test(
    val testValue: Long,
    val trueDestination: Int,
    val falseDestination: Int,
) {
    fun test(worryLevel: Long): Int = if (worryLevel % testValue == 0L) trueDestination else falseDestination
}

Compiled from "Day11.kt"
public final class Day11Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String Day11_test
       2: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: aload_0
       7: invokestatic  #18                 // Method part1:(Ljava/util/List;)J
      10: ldc2_w        #19                 // long 10605l
      13: lcmp
      14: ifne          21
      17: iconst_1
      18: goto          22
      21: iconst_0
      22: ifne          35
      25: new           #22                 // class java/lang/IllegalStateException
      28: dup
      29: ldc           #24                 // String Check failed.
      31: invokespecial #28                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      34: athrow
      35: aload_0
      36: invokestatic  #31                 // Method part2:(Ljava/util/List;)J
      39: ldc2_w        #32                 // long 2713310158l
      42: lcmp
      43: ifne          50
      46: iconst_1
      47: goto          51
      50: iconst_0
      51: ifne          64
      54: new           #22                 // class java/lang/IllegalStateException
      57: dup
      58: ldc           #24                 // String Check failed.
      60: invokespecial #28                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      63: athrow
      64: ldc           #35                 // String Day11
      66: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
      69: astore_1
      70: aload_1
      71: invokestatic  #18                 // Method part1:(Ljava/util/List;)J
      74: lstore_2
      75: getstatic     #41                 // Field java/lang/System.out:Ljava/io/PrintStream;
      78: lload_2
      79: invokevirtual #47                 // Method java/io/PrintStream.println:(J)V
      82: aload_1
      83: invokestatic  #31                 // Method part2:(Ljava/util/List;)J
      86: lstore_2
      87: getstatic     #41                 // Field java/lang/System.out:Ljava/io/PrintStream;
      90: lload_2
      91: invokevirtual #47                 // Method java/io/PrintStream.println:(J)V
      94: return

  private static final long part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #57                 // Method toMonkeys:(Ljava/util/List;)Ljava/util/List;
       4: astore_1
       5: invokedynamic #74,  0             // InvokeDynamic #0:adjust:()LWorryLevelAdjuster;
      10: astore_2
      11: aload_1
      12: bipush        20
      14: aload_2
      15: invokestatic  #78                 // Method solve:(Ljava/util/List;ILWorryLevelAdjuster;)J
      18: lreturn

  private static final long part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #57                 // Method toMonkeys:(Ljava/util/List;)Ljava/util/List;
       4: astore_1
       5: aload_1
       6: checkcast     #83                 // class java/lang/Iterable
       9: astore        4
      11: lconst_1
      12: lstore        5
      14: iconst_0
      15: istore        7
      17: lload         5
      19: lstore        8
      21: aload         4
      23: invokeinterface #87,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      28: astore        10
      30: aload         10
      32: invokeinterface #93,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      37: ifeq          79
      40: aload         10
      42: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      47: astore        11
      49: lload         8
      51: aload         11
      53: checkcast     #99                 // class Monkey
      56: astore        12
      58: lstore        13
      60: iconst_0
      61: istore        15
      63: lload         13
      65: aload         12
      67: invokevirtual #103                // Method Monkey.getTest:()LTest;
      70: invokevirtual #109                // Method Test.getTestValue:()J
      73: lmul
      74: lstore        8
      76: goto          30
      79: lload         8
      81: lstore_2
      82: lload_2
      83: invokedynamic #117,  0            // InvokeDynamic #1:adjust:(J)LWorryLevelAdjuster;
      88: astore        4
      90: aload_1
      91: sipush        10000
      94: aload         4
      96: invokestatic  #78                 // Method solve:(Ljava/util/List;ILWorryLevelAdjuster;)J
      99: lreturn

  private static final long solve(java.util.List<Monkey>, int, WorryLevelAdjuster);
    Code:
       0: iconst_0
       1: istore        4
       3: aload_0
       4: invokeinterface #136,  1          // InterfaceMethod java/util/List.size:()I
       9: istore        5
      11: iload         5
      13: newarray       long
      15: astore        6
      17: iload         4
      19: iload         5
      21: if_icmpge     40
      24: iload         4
      26: istore        7
      28: aload         6
      30: iload         7
      32: lconst_0
      33: lastore
      34: iinc          4, 1
      37: goto          17
      40: aload         6
      42: astore_3
      43: aload_0
      44: invokedynamic #147,  0            // InvokeDynamic #2:redirect:(Ljava/util/List;)LRedirectListener;
      49: astore        4
      51: iconst_0
      52: istore        5
      54: iload         5
      56: iload_1
      57: if_icmpge     175
      60: iload         5
      62: istore        6
      64: iconst_0
      65: istore        7
      67: aload_0
      68: checkcast     #83                 // class java/lang/Iterable
      71: astore        8
      73: iconst_0
      74: istore        9
      76: iconst_0
      77: istore        10
      79: aload         8
      81: invokeinterface #87,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      86: astore        11
      88: aload         11
      90: invokeinterface #93,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      95: ifeq          167
      98: aload         11
     100: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     105: astore        12
     107: iload         10
     109: iinc          10, 1
     112: istore        13
     114: iload         13
     116: ifge          122
     119: invokestatic  #152                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     122: iload         13
     124: aload         12
     126: checkcast     #99                 // class Monkey
     129: astore        14
     131: istore        15
     133: iconst_0
     134: istore        16
     136: aload_3
     137: iload         15
     139: aload_3
     140: iload         15
     142: laload
     143: aload         14
     145: invokevirtual #156                // Method Monkey.getItems:()Ljava/util/LinkedList;
     148: invokevirtual #159                // Method java/util/LinkedList.size:()I
     151: i2l
     152: ladd
     153: lastore
     154: aload         14
     156: aload_2
     157: aload         4
     159: invokevirtual #163                // Method Monkey.round:(LWorryLevelAdjuster;LRedirectListener;)V
     162: nop
     163: nop
     164: goto          88
     167: nop
     168: nop
     169: iinc          5, 1
     172: goto          54
     175: aload_3
     176: invokestatic  #169                // Method kotlin/collections/ArraysKt.sortDescending:([J)V
     179: aload_3
     180: iconst_0
     181: laload
     182: aload_3
     183: iconst_1
     184: laload
     185: lmul
     186: lreturn

  private static final java.util.List<Monkey> toMonkeys(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #83                 // class java/lang/Iterable
       4: bipush        7
       6: invokestatic  #192                // Method kotlin/collections/CollectionsKt.chunked:(Ljava/lang/Iterable;I)Ljava/util/List;
       9: checkcast     #83                 // class java/lang/Iterable
      12: astore_1
      13: iconst_0
      14: istore_2
      15: aload_1
      16: astore_3
      17: new           #194                // class java/util/ArrayList
      20: dup
      21: aload_1
      22: bipush        10
      24: invokestatic  #198                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      27: invokespecial #201                // Method java/util/ArrayList."<init>":(I)V
      30: checkcast     #203                // class java/util/Collection
      33: astore        4
      35: iconst_0
      36: istore        5
      38: aload_3
      39: invokeinterface #87,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      44: astore        6
      46: aload         6
      48: invokeinterface #93,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      53: ifeq          96
      56: aload         6
      58: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      63: astore        7
      65: aload         4
      67: aload         7
      69: checkcast     #52                 // class java/util/List
      72: astore        8
      74: astore        10
      76: iconst_0
      77: istore        9
      79: aload         8
      81: invokestatic  #207                // Method toMonkey:(Ljava/util/List;)LMonkey;
      84: aload         10
      86: swap
      87: invokeinterface #211,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      92: pop
      93: goto          46
      96: aload         4
      98: checkcast     #52                 // class java/util/List
     101: nop
     102: areturn

  private static final Monkey toMonkey(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: iconst_1
       2: invokeinterface #226,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
       7: checkcast     #228                // class java/lang/String
      10: ldc           #230                // String Starting items:
      12: aconst_null
      13: iconst_2
      14: aconst_null
      15: invokestatic  #236                // Method kotlin/text/StringsKt.substringAfter$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
      18: checkcast     #238                // class java/lang/CharSequence
      21: iconst_1
      22: anewarray     #228                // class java/lang/String
      25: astore_2
      26: aload_2
      27: iconst_0
      28: ldc           #240                // String ,
      30: aastore
      31: aload_2
      32: iconst_0
      33: iconst_0
      34: bipush        6
      36: aconst_null
      37: invokestatic  #244                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      40: checkcast     #83                 // class java/lang/Iterable
      43: astore_2
      44: nop
      45: iconst_0
      46: istore_3
      47: aload_2
      48: astore        4
      50: new           #194                // class java/util/ArrayList
      53: dup
      54: aload_2
      55: bipush        10
      57: invokestatic  #198                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      60: invokespecial #201                // Method java/util/ArrayList."<init>":(I)V
      63: checkcast     #203                // class java/util/Collection
      66: astore        5
      68: iconst_0
      69: istore        6
      71: aload         4
      73: invokeinterface #87,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      78: astore        7
      80: aload         7
      82: invokeinterface #93,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      87: ifeq          134
      90: aload         7
      92: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      97: astore        8
      99: aload         5
     101: aload         8
     103: checkcast     #228                // class java/lang/String
     106: astore        9
     108: astore        11
     110: iconst_0
     111: istore        10
     113: aload         9
     115: invokestatic  #250                // Method java/lang/Long.parseLong:(Ljava/lang/String;)J
     118: nop
     119: invokestatic  #254                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     122: aload         11
     124: swap
     125: invokeinterface #211,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     130: pop
     131: goto          80
     134: aload         5
     136: checkcast     #52                 // class java/util/List
     139: nop
     140: astore_1
     141: getstatic     #260                // Field Operation.Companion:LOperation$Companion;
     144: aload_0
     145: iconst_2
     146: invokeinterface #226,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     151: checkcast     #228                // class java/lang/String
     154: invokevirtual #266                // Method Operation$Companion.fromString:(Ljava/lang/String;)LOperation;
     157: astore_2
     158: aload_0
     159: iconst_3
     160: invokeinterface #226,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     165: checkcast     #228                // class java/lang/String
     168: ldc_w         #268                // String Test: divisible by
     171: aconst_null
     172: iconst_2
     173: aconst_null
     174: invokestatic  #236                // Method kotlin/text/StringsKt.substringAfter$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
     177: invokestatic  #250                // Method java/lang/Long.parseLong:(Ljava/lang/String;)J
     180: lstore_3
     181: aload_0
     182: iconst_4
     183: invokeinterface #226,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     188: checkcast     #228                // class java/lang/String
     191: ldc_w         #270                // String If true: throw to monkey
     194: aconst_null
     195: iconst_2
     196: aconst_null
     197: invokestatic  #236                // Method kotlin/text/StringsKt.substringAfter$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
     200: invokestatic  #276                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     203: istore        5
     205: aload_0
     206: iconst_5
     207: invokeinterface #226,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     212: checkcast     #228                // class java/lang/String
     215: ldc_w         #278                // String If false: throw to monkey
     218: aconst_null
     219: iconst_2
     220: aconst_null
     221: invokestatic  #236                // Method kotlin/text/StringsKt.substringAfter$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
     224: invokestatic  #276                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     227: istore        6
     229: new           #105                // class Test
     232: dup
     233: lload_3
     234: iload         5
     236: iload         6
     238: invokespecial #281                // Method Test."<init>":(JII)V
     241: astore        7
     243: new           #99                 // class Monkey
     246: dup
     247: aload_1
     248: aload_2
     249: aload         7
     251: invokespecial #284                // Method Monkey."<init>":(Ljava/util/List;LOperation;LTest;)V
     254: areturn

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

  private static final long part1$lambda$0(long);
    Code:
       0: lload_0
       1: iconst_3
       2: i2l
       3: ldiv
       4: lreturn

  private static final long part2$lambda$2(long, long);
    Code:
       0: lload_2
       1: lload_0
       2: lrem
       3: lreturn

  private static final void solve$lambda$3(java.util.List, int, long);
    Code:
       0: aload_0
       1: iload_1
       2: invokeinterface #226,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
       7: checkcast     #99                 // class Monkey
      10: invokevirtual #156                // Method Monkey.getItems:()Ljava/util/LinkedList;
      13: lload_2
      14: invokestatic  #254                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      17: invokevirtual #306                // Method java/util/LinkedList.addLast:(Ljava/lang/Object;)V
      20: return
}


import java.util.*

fun main() {
    val solution = Solution()
    val terms: Array<String> = arrayOf("A 6", "B 12", "C 3")
    val privacies: Array<String> = arrayOf("2021.05.02 A", "2021.07.01 B", "2022.02.19 C", "2022.02.20 C")

    solution.solution(today = "2022.05.19", terms, privacies)
}

class Solution {
    fun solution(today: String, terms: Array<String>, privacies: Array<String>): IntArray {
        var answer: IntArray = intArrayOf()

        //오늘 날짜 변환
        var tDates: Int = 0
        val todayArray: List<String> = today.split(".", ".")
        tDates += todayArray[0].toInt() * 12 * 28
        tDates += todayArray[1].toInt() * 28
        tDates += todayArray[2].toInt()
        for (i in privacies.indices) {
            var pDates: Int = 0

            val privaciesArray: List<String> = privacies[i].split(".", ".", " ")
            pDates += privaciesArray[0].toInt() * 12 * 28
            pDates += privaciesArray[1].toInt() * 28
            pDates += privaciesArray[2].toInt()

            for (j in terms.indices) {
                if (terms[j].split("\\s+".toRegex()).first() == privaciesArray[3]) {
                    pDates += terms[j].split("\\s+".toRegex()).last().toInt() * 28
                    if (tDates >= pDates) {
                        answer += i + 1
                    }
                }
            }
        }
        print(Arrays.toString(answer))
        return answer
    }

}

Compiled from "personalInfoCollectionValidityPeriod.kt"
public final class PersonalInfoCollectionValidityPeriodKt {
  public static final void main();
    Code:
       0: new           #8                  // class Solution
       3: dup
       4: invokespecial #11                 // Method Solution."<init>":()V
       7: astore_0
       8: iconst_3
       9: anewarray     #13                 // class java/lang/String
      12: astore_2
      13: aload_2
      14: iconst_0
      15: ldc           #15                 // String A 6
      17: aastore
      18: aload_2
      19: iconst_1
      20: ldc           #17                 // String B 12
      22: aastore
      23: aload_2
      24: iconst_2
      25: ldc           #19                 // String C 3
      27: aastore
      28: aload_2
      29: astore_1
      30: iconst_4
      31: anewarray     #13                 // class java/lang/String
      34: astore_3
      35: aload_3
      36: iconst_0
      37: ldc           #21                 // String 2021.05.02 A
      39: aastore
      40: aload_3
      41: iconst_1
      42: ldc           #23                 // String 2021.07.01 B
      44: aastore
      45: aload_3
      46: iconst_2
      47: ldc           #25                 // String 2022.02.19 C
      49: aastore
      50: aload_3
      51: iconst_3
      52: ldc           #27                 // String 2022.02.20 C
      54: aastore
      55: aload_3
      56: astore_2
      57: aload_0
      58: ldc           #29                 // String 2022.05.19
      60: aload_1
      61: aload_2
      62: invokevirtual #33                 // Method Solution.solution:(Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;)[I
      65: pop
      66: return

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


fun main() {

    fun Char.getPriority(): Int {
        return when {
            isUpperCase() -> code - 'A'.code + 27
            else -> code - 'a'.code + 1
        }
    }

    fun part1(input: List<String>): Int {
        return input.sumOf {
            val compartment1 = it.take(it.length / 2)
            val compartment2 = it.takeLast(it.length / 2)
            (compartment1.toSet() intersect compartment2.toSet()).single().getPriority()
        }
    }

    fun part2(input: List<String>): Int {
        return (input.indices step 3)
            .map { listOf(input[it].toSet(), input[it + 1].toSet(), input[it + 2].toSet()) }
            .sumOf { ((it[0] intersect it[1]) intersect it[2]).single().getPriority() }
    }

}

Compiled from "Day03.kt"
public final class Day03Kt {
  public static final void main();
    Code:
       0: return

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

  private static final int main$getPriority(char);
    Code:
       0: nop
       1: iload_0
       2: invokestatic  #19                 // Method java/lang/Character.isUpperCase:(C)Z
       5: ifeq          18
       8: iload_0
       9: bipush        65
      11: isub
      12: bipush        27
      14: iadd
      15: goto          24
      18: iload_0
      19: bipush        97
      21: isub
      22: iconst_1
      23: iadd
      24: ireturn

  private static final int main$part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #26                 // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: invokeinterface #30,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      13: astore_3
      14: aload_3
      15: invokeinterface #36,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      20: ifeq          123
      23: aload_3
      24: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      29: astore        4
      31: iload_2
      32: aload         4
      34: checkcast     #42                 // class java/lang/String
      37: astore        5
      39: istore        9
      41: iconst_0
      42: istore        6
      44: aload         5
      46: aload         5
      48: invokevirtual #46                 // Method java/lang/String.length:()I
      51: iconst_2
      52: idiv
      53: invokestatic  #52                 // Method kotlin/text/StringsKt.take:(Ljava/lang/String;I)Ljava/lang/String;
      56: astore        7
      58: aload         5
      60: aload         5
      62: invokevirtual #46                 // Method java/lang/String.length:()I
      65: iconst_2
      66: idiv
      67: invokestatic  #55                 // Method kotlin/text/StringsKt.takeLast:(Ljava/lang/String;I)Ljava/lang/String;
      70: astore        8
      72: aload         7
      74: checkcast     #57                 // class java/lang/CharSequence
      77: invokestatic  #61                 // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;
      80: checkcast     #26                 // class java/lang/Iterable
      83: aload         8
      85: checkcast     #57                 // class java/lang/CharSequence
      88: invokestatic  #61                 // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;
      91: checkcast     #26                 // class java/lang/Iterable
      94: invokestatic  #67                 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
      97: checkcast     #26                 // class java/lang/Iterable
     100: invokestatic  #71                 // Method kotlin/collections/CollectionsKt.single:(Ljava/lang/Iterable;)Ljava/lang/Object;
     103: checkcast     #15                 // class java/lang/Character
     106: invokevirtual #75                 // Method java/lang/Character.charValue:()C
     109: invokestatic  #77                 // Method main$getPriority:(C)I
     112: istore        10
     114: iload         9
     116: iload         10
     118: iadd
     119: istore_2
     120: goto          14
     123: iload_2
     124: ireturn

  private static final int main$part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #88                 // class java/util/Collection
       4: invokestatic  #92                 // Method kotlin/collections/CollectionsKt.getIndices:(Ljava/util/Collection;)Lkotlin/ranges/IntRange;
       7: checkcast     #94                 // class kotlin/ranges/IntProgression
      10: iconst_3
      11: invokestatic  #100                // Method kotlin/ranges/RangesKt.step:(Lkotlin/ranges/IntProgression;I)Lkotlin/ranges/IntProgression;
      14: checkcast     #26                 // class java/lang/Iterable
      17: astore_1
      18: nop
      19: iconst_0
      20: istore_2
      21: aload_1
      22: astore_3
      23: new           #102                // class java/util/ArrayList
      26: dup
      27: aload_1
      28: bipush        10
      30: invokestatic  #106                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      33: invokespecial #110                // Method java/util/ArrayList."<init>":(I)V
      36: checkcast     #88                 // class java/util/Collection
      39: astore        4
      41: iconst_0
      42: istore        5
      44: aload_3
      45: invokeinterface #30,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      50: astore        6
      52: aload         6
      54: invokeinterface #36,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      59: ifeq          164
      62: aload         6
      64: checkcast     #112                // class kotlin/collections/IntIterator
      67: invokevirtual #115                // Method kotlin/collections/IntIterator.nextInt:()I
      70: istore        7
      72: aload         4
      74: iload         7
      76: istore        8
      78: astore        11
      80: iconst_0
      81: istore        9
      83: iconst_3
      84: anewarray     #117                // class java/util/Set
      87: astore        10
      89: aload         10
      91: iconst_0
      92: aload_0
      93: iload         8
      95: invokeinterface #123,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     100: checkcast     #57                 // class java/lang/CharSequence
     103: invokestatic  #61                 // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;
     106: aastore
     107: aload         10
     109: iconst_1
     110: aload_0
     111: iload         8
     113: iconst_1
     114: iadd
     115: invokeinterface #123,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     120: checkcast     #57                 // class java/lang/CharSequence
     123: invokestatic  #61                 // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;
     126: aastore
     127: aload         10
     129: iconst_2
     130: aload_0
     131: iload         8
     133: iconst_2
     134: iadd
     135: invokeinterface #123,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     140: checkcast     #57                 // class java/lang/CharSequence
     143: invokestatic  #61                 // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;
     146: aastore
     147: aload         10
     149: invokestatic  #127                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     152: aload         11
     154: swap
     155: invokeinterface #131,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     160: pop
     161: goto          52
     164: aload         4
     166: checkcast     #119                // class java/util/List
     169: nop
     170: checkcast     #26                 // class java/lang/Iterable
     173: astore_1
     174: iconst_0
     175: istore_2
     176: aload_1
     177: invokeinterface #30,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     182: astore_3
     183: aload_3
     184: invokeinterface #36,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     189: ifeq          281
     192: aload_3
     193: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     198: astore        4
     200: iload_2
     201: aload         4
     203: checkcast     #119                // class java/util/List
     206: astore        5
     208: istore        11
     210: iconst_0
     211: istore        6
     213: aload         5
     215: iconst_0
     216: invokeinterface #123,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     221: checkcast     #26                 // class java/lang/Iterable
     224: aload         5
     226: iconst_1
     227: invokeinterface #123,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     232: checkcast     #26                 // class java/lang/Iterable
     235: invokestatic  #67                 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
     238: checkcast     #26                 // class java/lang/Iterable
     241: aload         5
     243: iconst_2
     244: invokeinterface #123,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     249: checkcast     #26                 // class java/lang/Iterable
     252: invokestatic  #67                 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
     255: checkcast     #26                 // class java/lang/Iterable
     258: invokestatic  #71                 // Method kotlin/collections/CollectionsKt.single:(Ljava/lang/Iterable;)Ljava/lang/Object;
     261: checkcast     #15                 // class java/lang/Character
     264: invokevirtual #75                 // Method java/lang/Character.charValue:()C
     267: invokestatic  #77                 // Method main$getPriority:(C)I
     270: istore        12
     272: iload         11
     274: iload         12
     276: iadd
     277: istore_2
     278: goto          183
     281: iload_2
     282: ireturn
}


var heapSize = 0

fun left(i: Int): Int {
    return 2 * i
}

fun right(i: Int): Int {
    return 2 * i + 1
}

fun swap(A: Array<Int>, i: Int, j: Int) {
    var temp = A[i]
    A[i] = A[j]
    A[j] = temp
}

fun max_heapify(A: Array<Int>, i: Int) {
    var l = left(i);
    var r = right(i);
    var largest: Int;

    if ((l <= heapSize - 1) && (A[l] > A[i])) {
        largest = l;
    } else
        largest = i

    if ((r <= heapSize - 1) && (A[r] > A[l])) {
        largest = r
    }

    if (largest != i) {
        swap(A, i, largest);
        max_heapify(A, largest);
    }
}

fun buildMaxheap(A: Array<Int>) {
    heapSize = A.size
    for (i in heapSize / 2 downTo 0) {
        max_heapify(A, i)
    }
}

fun heap_sort(A: Array<Int>) {
    buildMaxheap(A)
    for (i in A.size - 1 downTo 1) {
        swap(A, i, 0)
        heapSize = heapSize - 1
        max_heapify(A, 0)

    }
}

fun main(arg: Array<String>) {
    print("Enter no. of elements :")
    var n = readLine()!!.toInt()

    println("Enter elements : ")
    var A = Array(n, { 0 })
    for (i in 0 until n)
        A[i] = readLine()!!.toInt()

    heap_sort(A)

    println("Sorted array is : ")
    for (i in 0 until n)
        print("${A[i]}  ")
}

Compiled from "heap_sort_in_kotlin.kt"
public final class Heap_sort_in_kotlinKt {
  private static int heapSize;

  public static final int getHeapSize();
    Code:
       0: getstatic     #10                 // Field heapSize:I
       3: ireturn

  public static final void setHeapSize(int);
    Code:
       0: iload_0
       1: putstatic     #10                 // Field heapSize:I
       4: return

  public static final int left(int);
    Code:
       0: iconst_2
       1: iload_0
       2: imul
       3: ireturn

  public static final int right(int);
    Code:
       0: iconst_2
       1: iload_0
       2: imul
       3: iconst_1
       4: iadd
       5: ireturn

  public static final void swap(java.lang.Integer[], int, int);
    Code:
       0: aload_0
       1: ldc           #22                 // String A
       3: invokestatic  #28                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: iload_1
       8: aaload
       9: invokevirtual #33                 // Method java/lang/Integer.intValue:()I
      12: istore_3
      13: aload_0
      14: iload_1
      15: aload_0
      16: iload_2
      17: aaload
      18: aastore
      19: aload_0
      20: iload_2
      21: iload_3
      22: invokestatic  #37                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      25: aastore
      26: return

  public static final void max_heapify(java.lang.Integer[], int);
    Code:
       0: aload_0
       1: ldc           #22                 // String A
       3: invokestatic  #28                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iload_1
       7: invokestatic  #44                 // Method left:(I)I
      10: istore_2
      11: iload_1
      12: invokestatic  #46                 // Method right:(I)I
      15: istore_3
      16: iconst_0
      17: istore        4
      19: iload_2
      20: getstatic     #10                 // Field heapSize:I
      23: iconst_1
      24: isub
      25: if_icmpgt     49
      28: aload_0
      29: iload_2
      30: aaload
      31: invokevirtual #33                 // Method java/lang/Integer.intValue:()I
      34: aload_0
      35: iload_1
      36: aaload
      37: invokevirtual #33                 // Method java/lang/Integer.intValue:()I
      40: if_icmple     49
      43: iload_2
      44: istore        4
      46: goto          52
      49: iload_1
      50: istore        4
      52: iload_3
      53: getstatic     #10                 // Field heapSize:I
      56: iconst_1
      57: isub
      58: if_icmpgt     79
      61: aload_0
      62: iload_3
      63: aaload
      64: invokevirtual #33                 // Method java/lang/Integer.intValue:()I
      67: aload_0
      68: iload_2
      69: aaload
      70: invokevirtual #33                 // Method java/lang/Integer.intValue:()I
      73: if_icmple     79
      76: iload_3
      77: istore        4
      79: iload         4
      81: iload_1
      82: if_icmpeq     98
      85: aload_0
      86: iload_1
      87: iload         4
      89: invokestatic  #48                 // Method swap:([Ljava/lang/Integer;II)V
      92: aload_0
      93: iload         4
      95: invokestatic  #50                 // Method max_heapify:([Ljava/lang/Integer;I)V
      98: return

  public static final void buildMaxheap(java.lang.Integer[]);
    Code:
       0: aload_0
       1: ldc           #22                 // String A
       3: invokestatic  #28                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: arraylength
       8: putstatic     #10                 // Field heapSize:I
      11: getstatic     #10                 // Field heapSize:I
      14: iconst_2
      15: idiv
      16: istore_1
      17: iconst_m1
      18: iload_1
      19: if_icmpge     33
      22: aload_0
      23: iload_1
      24: invokestatic  #50                 // Method max_heapify:([Ljava/lang/Integer;I)V
      27: iinc          1, -1
      30: goto          17
      33: return

  public static final void heap_sort(java.lang.Integer[]);
    Code:
       0: aload_0
       1: ldc           #22                 // String A
       3: invokestatic  #28                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokestatic  #58                 // Method buildMaxheap:([Ljava/lang/Integer;)V
      10: aload_0
      11: arraylength
      12: iconst_1
      13: isub
      14: istore_1
      15: iconst_0
      16: iload_1
      17: if_icmpge     45
      20: aload_0
      21: iload_1
      22: iconst_0
      23: invokestatic  #48                 // Method swap:([Ljava/lang/Integer;II)V
      26: getstatic     #10                 // Field heapSize:I
      29: iconst_1
      30: isub
      31: putstatic     #10                 // Field heapSize:I
      34: aload_0
      35: iconst_0
      36: invokestatic  #50                 // Method max_heapify:([Ljava/lang/Integer;I)V
      39: iinc          1, -1
      42: goto          15
      45: return

  public static final void main(java.lang.String[]);
    Code:
       0: aload_0
       1: ldc           #62                 // String arg
       3: invokestatic  #28                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: ldc           #64                 // String Enter no. of elements :
       8: getstatic     #70                 // Field java/lang/System.out:Ljava/io/PrintStream;
      11: swap
      12: invokevirtual #76                 // Method java/io/PrintStream.print:(Ljava/lang/Object;)V
      15: invokestatic  #82                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
      18: dup
      19: invokestatic  #85                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      22: invokestatic  #89                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      25: istore_1
      26: ldc           #91                 // String Enter elements :
      28: getstatic     #70                 // Field java/lang/System.out:Ljava/io/PrintStream;
      31: swap
      32: invokevirtual #94                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      35: iconst_0
      36: istore_3
      37: iload_1
      38: istore        4
      40: iload         4
      42: anewarray     #30                 // class java/lang/Integer
      45: astore        5
      47: iload_3
      48: iload         4
      50: if_icmpge     71
      53: iload_3
      54: istore        6
      56: aload         5
      58: iload         6
      60: iconst_0
      61: invokestatic  #37                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      64: aastore
      65: iinc          3, 1
      68: goto          47
      71: aload         5
      73: astore_2
      74: iconst_0
      75: istore_3
      76: iload_1
      77: istore        4
      79: iload_3
      80: iload         4
      82: if_icmpge     107
      85: aload_2
      86: iload_3
      87: invokestatic  #82                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
      90: dup
      91: invokestatic  #85                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      94: invokestatic  #89                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      97: invokestatic  #37                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     100: aastore
     101: iinc          3, 1
     104: goto          79
     107: aload_2
     108: invokestatic  #96                 // Method heap_sort:([Ljava/lang/Integer;)V
     111: ldc           #98                 // String Sorted array is :
     113: getstatic     #70                 // Field java/lang/System.out:Ljava/io/PrintStream;
     116: swap
     117: invokevirtual #94                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     120: iconst_0
     121: istore_3
     122: iload_1
     123: istore        4
     125: iload_3
     126: iload         4
     128: if_icmpge     168
     131: new           #100                // class java/lang/StringBuilder
     134: dup
     135: invokespecial #104                // Method java/lang/StringBuilder."<init>":()V
     138: aload_2
     139: iload_3
     140: aaload
     141: invokevirtual #33                 // Method java/lang/Integer.intValue:()I
     144: invokevirtual #108                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     147: ldc           #110                // String
     149: invokevirtual #113                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     152: invokevirtual #116                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     155: getstatic     #70                 // Field java/lang/System.out:Ljava/io/PrintStream;
     158: swap
     159: invokevirtual #76                 // Method java/io/PrintStream.print:(Ljava/lang/Object;)V
     162: iinc          3, 1
     165: goto          125
     168: return

  static {};
    Code:
       0: return
}


fun merge(A: Array<Int>, p: Int, q: Int, r: Int) {
    var left = A.copyOfRange(p, q + 1)
    var right = A.copyOfRange(q + 1, r + 1)
    var i = 0
    var j = 0

    for (k in p..r) {
        if ((i <= left.size - 1) && ((j >= right.size) || (left[i] <= right[j]))) {
            A[k] = left[i];
            i++;
        } else {
            A[k] = right[j];
            j++;
        }
    }
}

fun merge_sort(A: Array<Int>, p: Int, r: Int) {
    if (p < r) {
        var q = (p + r) / 2
        merge_sort(A, p, q)
        merge_sort(A, q + 1, r)
        merge(A, p, q, r)
    }
}

fun main(arg: Array<String>) {
    print("Enter no. of elements :")
    var n = readLine()!!.toInt()

    println("Enter elements : ")
    var A = Array(n, { 0 })
    for (i in 0 until n)
        A[i] = readLine()!!.toInt()

    merge_sort(A, 0, A.size - 1)

    println("Sorted array is : ")
    for (i in 0 until n)
        print("${A[i]}  ")
}

Compiled from "merge_sort_in_kotlin.kt"
public final class Merge_sort_in_kotlinKt {
  public static final void merge(java.lang.Integer[], int, int, int);
    Code:
       0: aload_0
       1: ldc           #9                  // String A
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: iload_1
       8: iload_2
       9: iconst_1
      10: iadd
      11: invokestatic  #21                 // Method kotlin/collections/ArraysKt.copyOfRange:([Ljava/lang/Object;II)[Ljava/lang/Object;
      14: checkcast     #23                 // class "[Ljava/lang/Integer;"
      17: astore        4
      19: aload_0
      20: iload_2
      21: iconst_1
      22: iadd
      23: iload_3
      24: iconst_1
      25: iadd
      26: invokestatic  #21                 // Method kotlin/collections/ArraysKt.copyOfRange:([Ljava/lang/Object;II)[Ljava/lang/Object;
      29: checkcast     #23                 // class "[Ljava/lang/Integer;"
      32: astore        5
      34: iconst_0
      35: istore        6
      37: iconst_0
      38: istore        7
      40: iload_1
      41: istore        8
      43: iload         8
      45: iload_3
      46: if_icmpgt     125
      49: iload         6
      51: aload         4
      53: arraylength
      54: iconst_1
      55: isub
      56: if_icmpgt     101
      59: iload         7
      61: aload         5
      63: arraylength
      64: if_icmpge     86
      67: aload         4
      69: iload         6
      71: aaload
      72: invokevirtual #29                 // Method java/lang/Integer.intValue:()I
      75: aload         5
      77: iload         7
      79: aaload
      80: invokevirtual #29                 // Method java/lang/Integer.intValue:()I
      83: if_icmpgt     101
      86: aload_0
      87: iload         8
      89: aload         4
      91: iload         6
      93: aaload
      94: aastore
      95: iinc          6, 1
      98: goto          113
     101: aload_0
     102: iload         8
     104: aload         5
     106: iload         7
     108: aaload
     109: aastore
     110: iinc          7, 1
     113: iload         8
     115: iload_3
     116: if_icmpeq     125
     119: iinc          8, 1
     122: goto          49
     125: return

  public static final void merge_sort(java.lang.Integer[], int, int);
    Code:
       0: aload_0
       1: ldc           #9                  // String A
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iload_1
       7: iload_2
       8: if_icmpge     38
      11: iload_1
      12: iload_2
      13: iadd
      14: iconst_2
      15: idiv
      16: istore_3
      17: aload_0
      18: iload_1
      19: iload_3
      20: invokestatic  #42                 // Method merge_sort:([Ljava/lang/Integer;II)V
      23: aload_0
      24: iload_3
      25: iconst_1
      26: iadd
      27: iload_2
      28: invokestatic  #42                 // Method merge_sort:([Ljava/lang/Integer;II)V
      31: aload_0
      32: iload_1
      33: iload_3
      34: iload_2
      35: invokestatic  #44                 // Method merge:([Ljava/lang/Integer;III)V
      38: return

  public static final void main(java.lang.String[]);
    Code:
       0: aload_0
       1: ldc           #48                 // String arg
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: ldc           #50                 // String Enter no. of elements :
       8: getstatic     #56                 // Field java/lang/System.out:Ljava/io/PrintStream;
      11: swap
      12: invokevirtual #62                 // Method java/io/PrintStream.print:(Ljava/lang/Object;)V
      15: invokestatic  #68                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
      18: dup
      19: invokestatic  #71                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      22: invokestatic  #75                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      25: istore_1
      26: ldc           #77                 // String Enter elements :
      28: getstatic     #56                 // Field java/lang/System.out:Ljava/io/PrintStream;
      31: swap
      32: invokevirtual #80                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      35: iconst_0
      36: istore_3
      37: iload_1
      38: istore        4
      40: iload         4
      42: anewarray     #25                 // class java/lang/Integer
      45: astore        5
      47: iload_3
      48: iload         4
      50: if_icmpge     71
      53: iload_3
      54: istore        6
      56: aload         5
      58: iload         6
      60: iconst_0
      61: invokestatic  #84                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      64: aastore
      65: iinc          3, 1
      68: goto          47
      71: aload         5
      73: astore_2
      74: iconst_0
      75: istore_3
      76: iload_1
      77: istore        4
      79: iload_3
      80: iload         4
      82: if_icmpge     107
      85: aload_2
      86: iload_3
      87: invokestatic  #68                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
      90: dup
      91: invokestatic  #71                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      94: invokestatic  #75                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      97: invokestatic  #84                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     100: aastore
     101: iinc          3, 1
     104: goto          79
     107: aload_2
     108: iconst_0
     109: aload_2
     110: arraylength
     111: iconst_1
     112: isub
     113: invokestatic  #42                 // Method merge_sort:([Ljava/lang/Integer;II)V
     116: ldc           #86                 // String Sorted array is :
     118: getstatic     #56                 // Field java/lang/System.out:Ljava/io/PrintStream;
     121: swap
     122: invokevirtual #80                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     125: iconst_0
     126: istore_3
     127: iload_1
     128: istore        4
     130: iload_3
     131: iload         4
     133: if_icmpge     173
     136: new           #88                 // class java/lang/StringBuilder
     139: dup
     140: invokespecial #92                 // Method java/lang/StringBuilder."<init>":()V
     143: aload_2
     144: iload_3
     145: aaload
     146: invokevirtual #29                 // Method java/lang/Integer.intValue:()I
     149: invokevirtual #96                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     152: ldc           #98                 // String
     154: invokevirtual #101                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     157: invokevirtual #104                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     160: getstatic     #56                 // Field java/lang/System.out:Ljava/io/PrintStream;
     163: swap
     164: invokevirtual #62                 // Method java/io/PrintStream.print:(Ljava/lang/Object;)V
     167: iinc          3, 1
     170: goto          130
     173: return
}