import kotlin.math.abs
import kotlin.math.sign

fun main() {

    infix fun Point.follow(head: Point) {
        val dx = head.x - x
        val dy = head.y - y

        if (abs(dx) > 1 || abs(dy) > 1) {
            this += Point(dx.sign, dy.sign)
        }
    }

    fun part1(input: List<String>): Int {
        val head = Point(0, 0)
        val tail = Point(0, 0)
        val visited = mutableSetOf<Point>()

        input.map {
            it.split(" ")
        }.forEach { (direction, amount) ->
            val dirVector = when (direction) {
                "U" -> Point(0, +1)
                "D" -> Point(0, -1)
                "L" -> Point(-1, 0)
                "R" -> Point(+1, 0)
                else -> error("wrong direction $direction")
            }

            for (i in 0 until amount.toInt()) {
                head += dirVector
                tail.follow(head)
                visited.add(tail.copy())
            }
        }

        return visited.size
    }

    fun part2(input: List<String>): Int {
        val knots = MutableList(10) { Point(0, 0) }
        val visited = mutableSetOf<Point>()

        input.map {
            it.split(" ")
        }.forEach { (direction, amount) ->
            val dirVector = when (direction) {
                "U" -> Point(0, +1)
                "D" -> Point(0, -1)
                "L" -> Point(-1, 0)
                "R" -> Point(+1, 0)
                else -> error("wrong direction $direction")
            }

            for (i in 0 until amount.toInt()) {
                knots.forEachIndexed { index, knot ->
                    if (index == 0) {
                        knot += dirVector
                    } else {
                        knot follow knots[index-1]
                    }

                    if (index == 9) {
                        visited.add(knot.copy())
                    }
                }
            }
        }

        return visited.size
    }

    val input = readInput("inputs/Day09")
    println(part1(input))
    println(part2(input))
}

Compiled from "Day09.kt"
public final class Day09Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String inputs/Day09
       2: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: aload_0
       7: invokestatic  #18                 // Method main$part1:(Ljava/util/List;)I
      10: istore_1
      11: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      14: iload_1
      15: invokevirtual #30                 // Method java/io/PrintStream.println:(I)V
      18: aload_0
      19: invokestatic  #33                 // Method main$part2:(Ljava/util/List;)I
      22: istore_1
      23: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      26: iload_1
      27: invokevirtual #30                 // Method java/io/PrintStream.println:(I)V
      30: return

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

  private static final void main$follow(Point, Point);
    Code:
       0: aload_1
       1: invokevirtual #48                 // Method Point.getX:()I
       4: aload_0
       5: invokevirtual #48                 // Method Point.getX:()I
       8: isub
       9: istore_2
      10: aload_1
      11: invokevirtual #51                 // Method Point.getY:()I
      14: aload_0
      15: invokevirtual #51                 // Method Point.getY:()I
      18: isub
      19: istore_3
      20: iload_2
      21: invokestatic  #57                 // Method java/lang/Math.abs:(I)I
      24: iconst_1
      25: if_icmpgt     36
      28: iload_3
      29: invokestatic  #57                 // Method java/lang/Math.abs:(I)I
      32: iconst_1
      33: if_icmple     55
      36: aload_0
      37: new           #44                 // class Point
      40: dup
      41: iload_2
      42: invokestatic  #62                 // Method kotlin/math/MathKt.getSign:(I)I
      45: iload_3
      46: invokestatic  #62                 // Method kotlin/math/MathKt.getSign:(I)I
      49: invokespecial #66                 // Method Point."<init>":(II)V
      52: invokevirtual #70                 // Method Point.plusAssign:(LPoint;)V
      55: return

  private static final int main$part1(java.util.List<java.lang.String>);
    Code:
       0: new           #44                 // class Point
       3: dup
       4: iconst_0
       5: iconst_0
       6: invokespecial #66                 // Method Point."<init>":(II)V
       9: astore_1
      10: new           #44                 // class Point
      13: dup
      14: iconst_0
      15: iconst_0
      16: invokespecial #66                 // Method Point."<init>":(II)V
      19: astore_2
      20: new           #79                 // class java/util/LinkedHashSet
      23: dup
      24: invokespecial #81                 // Method java/util/LinkedHashSet."<init>":()V
      27: checkcast     #83                 // class java/util/Set
      30: astore_3
      31: aload_0
      32: checkcast     #85                 // class java/lang/Iterable
      35: astore        4
      37: iconst_0
      38: istore        5
      40: aload         4
      42: astore        6
      44: new           #87                 // class java/util/ArrayList
      47: dup
      48: aload         4
      50: bipush        10
      52: invokestatic  #93                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      55: invokespecial #95                 // Method java/util/ArrayList."<init>":(I)V
      58: checkcast     #97                 // class java/util/Collection
      61: astore        7
      63: iconst_0
      64: istore        8
      66: aload         6
      68: invokeinterface #101,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      73: astore        9
      75: aload         9
      77: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      82: ifeq          147
      85: aload         9
      87: invokeinterface #111,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      92: astore        10
      94: aload         7
      96: aload         10
      98: checkcast     #113                // class java/lang/String
     101: astore        11
     103: astore        15
     105: iconst_0
     106: istore        12
     108: aload         11
     110: checkcast     #115                // class java/lang/CharSequence
     113: iconst_1
     114: anewarray     #113                // class java/lang/String
     117: astore        13
     119: aload         13
     121: iconst_0
     122: ldc           #117                // String
     124: aastore
     125: aload         13
     127: iconst_0
     128: iconst_0
     129: bipush        6
     131: aconst_null
     132: invokestatic  #123                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     135: aload         15
     137: swap
     138: invokeinterface #127,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     143: pop
     144: goto          75
     147: aload         7
     149: checkcast     #129                // class java/util/List
     152: nop
     153: checkcast     #85                 // class java/lang/Iterable
     156: astore        4
     158: nop
     159: iconst_0
     160: istore        5
     162: aload         4
     164: invokeinterface #101,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     169: astore        6
     171: aload         6
     173: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     178: ifeq          463
     181: aload         6
     183: invokeinterface #111,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     188: astore        7
     190: aload         7
     192: checkcast     #129                // class java/util/List
     195: astore        8
     197: iconst_0
     198: istore        9
     200: aload         8
     202: iconst_0
     203: invokeinterface #133,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     208: checkcast     #113                // class java/lang/String
     211: astore        10
     213: aload         8
     215: iconst_1
     216: invokeinterface #133,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     221: checkcast     #113                // class java/lang/String
     224: astore        11
     226: aload         10
     228: astore        12
     230: aload         12
     232: invokevirtual #136                // Method java/lang/String.hashCode:()I
     235: lookupswitch  { // 4
                    68: 289
                    76: 315
                    82: 276
                    85: 302
               default: 376
          }
     276: aload         12
     278: ldc           #138                // String R
     280: invokevirtual #141                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     283: ifne          364
     286: goto          376
     289: aload         12
     291: ldc           #143                // String D
     293: invokevirtual #141                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     296: ifne          340
     299: goto          376
     302: aload         12
     304: ldc           #145                // String U
     306: invokevirtual #141                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     309: ifne          328
     312: goto          376
     315: aload         12
     317: ldc           #147                // String L
     319: invokevirtual #141                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     322: ifne          352
     325: goto          376
     328: new           #44                 // class Point
     331: dup
     332: iconst_0
     333: iconst_1
     334: invokespecial #66                 // Method Point."<init>":(II)V
     337: goto          407
     340: new           #44                 // class Point
     343: dup
     344: iconst_0
     345: iconst_m1
     346: invokespecial #66                 // Method Point."<init>":(II)V
     349: goto          407
     352: new           #44                 // class Point
     355: dup
     356: iconst_m1
     357: iconst_0
     358: invokespecial #66                 // Method Point."<init>":(II)V
     361: goto          407
     364: new           #44                 // class Point
     367: dup
     368: iconst_1
     369: iconst_0
     370: invokespecial #66                 // Method Point."<init>":(II)V
     373: goto          407
     376: new           #149                // class java/lang/IllegalStateException
     379: dup
     380: new           #151                // class java/lang/StringBuilder
     383: dup
     384: invokespecial #152                // Method java/lang/StringBuilder."<init>":()V
     387: ldc           #154                // String wrong direction
     389: invokevirtual #158                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     392: aload         10
     394: invokevirtual #158                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     397: invokevirtual #162                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     400: invokevirtual #163                // Method java/lang/Object.toString:()Ljava/lang/String;
     403: invokespecial #166                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     406: athrow
     407: astore        13
     409: iconst_0
     410: istore        12
     412: aload         11
     414: invokestatic  #172                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     417: istore        14
     419: iload         12
     421: iload         14
     423: if_icmpge     458
     426: aload_1
     427: aload         13
     429: invokevirtual #70                 // Method Point.plusAssign:(LPoint;)V
     432: aload_2
     433: aload_1
     434: invokestatic  #174                // Method main$follow:(LPoint;LPoint;)V
     437: aload_3
     438: aload_2
     439: iconst_0
     440: iconst_0
     441: iconst_3
     442: aconst_null
     443: invokestatic  #178                // Method Point.copy$default:(LPoint;IIILjava/lang/Object;)LPoint;
     446: invokeinterface #179,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
     451: pop
     452: iinc          12, 1
     455: goto          419
     458: nop
     459: nop
     460: goto          171
     463: nop
     464: aload_3
     465: invokeinterface #182,  1          // InterfaceMethod java/util/Set.size:()I
     470: ireturn

  private static final int main$part2(java.util.List<java.lang.String>);
    Code:
       0: bipush        10
       2: istore_2
       3: new           #87                 // class java/util/ArrayList
       6: dup
       7: iload_2
       8: invokespecial #95                 // Method java/util/ArrayList."<init>":(I)V
      11: astore_3
      12: iconst_0
      13: istore        4
      15: iload         4
      17: iload_2
      18: if_icmpge     57
      21: iload         4
      23: istore        5
      25: aload_3
      26: iload         5
      28: istore        6
      30: astore        23
      32: iconst_0
      33: istore        7
      35: new           #44                 // class Point
      38: dup
      39: iconst_0
      40: iconst_0
      41: invokespecial #66                 // Method Point."<init>":(II)V
      44: aload         23
      46: swap
      47: invokevirtual #206                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      50: pop
      51: iinc          4, 1
      54: goto          15
      57: aload_3
      58: checkcast     #129                // class java/util/List
      61: astore_1
      62: new           #79                 // class java/util/LinkedHashSet
      65: dup
      66: invokespecial #81                 // Method java/util/LinkedHashSet."<init>":()V
      69: checkcast     #83                 // class java/util/Set
      72: astore_2
      73: aload_0
      74: checkcast     #85                 // class java/lang/Iterable
      77: astore_3
      78: iconst_0
      79: istore        4
      81: aload_3
      82: astore        5
      84: new           #87                 // class java/util/ArrayList
      87: dup
      88: aload_3
      89: bipush        10
      91: invokestatic  #93                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      94: invokespecial #95                 // Method java/util/ArrayList."<init>":(I)V
      97: checkcast     #97                 // class java/util/Collection
     100: astore        6
     102: iconst_0
     103: istore        7
     105: aload         5
     107: invokeinterface #101,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     112: astore        8
     114: aload         8
     116: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     121: ifeq          186
     124: aload         8
     126: invokeinterface #111,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     131: astore        9
     133: aload         6
     135: aload         9
     137: checkcast     #113                // class java/lang/String
     140: astore        10
     142: astore        23
     144: iconst_0
     145: istore        11
     147: aload         10
     149: checkcast     #115                // class java/lang/CharSequence
     152: iconst_1
     153: anewarray     #113                // class java/lang/String
     156: astore        12
     158: aload         12
     160: iconst_0
     161: ldc           #117                // String
     163: aastore
     164: aload         12
     166: iconst_0
     167: iconst_0
     168: bipush        6
     170: aconst_null
     171: invokestatic  #123                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     174: aload         23
     176: swap
     177: invokeinterface #127,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     182: pop
     183: goto          114
     186: aload         6
     188: checkcast     #129                // class java/util/List
     191: nop
     192: checkcast     #85                 // class java/lang/Iterable
     195: astore_3
     196: nop
     197: iconst_0
     198: istore        4
     200: aload_3
     201: invokeinterface #101,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     206: astore        5
     208: aload         5
     210: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     215: ifeq          608
     218: aload         5
     220: invokeinterface #111,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     225: astore        6
     227: aload         6
     229: checkcast     #129                // class java/util/List
     232: astore        7
     234: iconst_0
     235: istore        8
     237: aload         7
     239: iconst_0
     240: invokeinterface #133,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     245: checkcast     #113                // class java/lang/String
     248: astore        9
     250: aload         7
     252: iconst_1
     253: invokeinterface #133,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     258: checkcast     #113                // class java/lang/String
     261: astore        10
     263: aload         9
     265: astore        11
     267: aload         11
     269: invokevirtual #136                // Method java/lang/String.hashCode:()I
     272: lookupswitch  { // 4
                    68: 329
                    76: 355
                    82: 316
                    85: 342
               default: 416
          }
     316: aload         11
     318: ldc           #138                // String R
     320: invokevirtual #141                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     323: ifne          404
     326: goto          416
     329: aload         11
     331: ldc           #143                // String D
     333: invokevirtual #141                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     336: ifne          380
     339: goto          416
     342: aload         11
     344: ldc           #145                // String U
     346: invokevirtual #141                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     349: ifne          368
     352: goto          416
     355: aload         11
     357: ldc           #147                // String L
     359: invokevirtual #141                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     362: ifne          392
     365: goto          416
     368: new           #44                 // class Point
     371: dup
     372: iconst_0
     373: iconst_1
     374: invokespecial #66                 // Method Point."<init>":(II)V
     377: goto          447
     380: new           #44                 // class Point
     383: dup
     384: iconst_0
     385: iconst_m1
     386: invokespecial #66                 // Method Point."<init>":(II)V
     389: goto          447
     392: new           #44                 // class Point
     395: dup
     396: iconst_m1
     397: iconst_0
     398: invokespecial #66                 // Method Point."<init>":(II)V
     401: goto          447
     404: new           #44                 // class Point
     407: dup
     408: iconst_1
     409: iconst_0
     410: invokespecial #66                 // Method Point."<init>":(II)V
     413: goto          447
     416: new           #149                // class java/lang/IllegalStateException
     419: dup
     420: new           #151                // class java/lang/StringBuilder
     423: dup
     424: invokespecial #152                // Method java/lang/StringBuilder."<init>":()V
     427: ldc           #154                // String wrong direction
     429: invokevirtual #158                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     432: aload         9
     434: invokevirtual #158                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     437: invokevirtual #162                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     440: invokevirtual #163                // Method java/lang/Object.toString:()Ljava/lang/String;
     443: invokespecial #166                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     446: athrow
     447: astore        12
     449: iconst_0
     450: istore        11
     452: aload         10
     454: invokestatic  #172                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     457: istore        13
     459: iload         11
     461: iload         13
     463: if_icmpge     603
     466: aload_1
     467: checkcast     #85                 // class java/lang/Iterable
     470: astore        14
     472: iconst_0
     473: istore        15
     475: iconst_0
     476: istore        16
     478: aload         14
     480: invokeinterface #101,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     485: astore        17
     487: aload         17
     489: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     494: ifeq          596
     497: aload         17
     499: invokeinterface #111,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     504: astore        18
     506: iload         16
     508: iinc          16, 1
     511: istore        19
     513: iload         19
     515: ifge          521
     518: invokestatic  #209                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     521: iload         19
     523: aload         18
     525: checkcast     #44                 // class Point
     528: astore        20
     530: istore        21
     532: iconst_0
     533: istore        22
     535: iload         21
     537: ifne          550
     540: aload         20
     542: aload         12
     544: invokevirtual #70                 // Method Point.plusAssign:(LPoint;)V
     547: goto          568
     550: aload         20
     552: aload_1
     553: iload         21
     555: iconst_1
     556: isub
     557: invokeinterface #133,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     562: checkcast     #44                 // class Point
     565: invokestatic  #174                // Method main$follow:(LPoint;LPoint;)V
     568: iload         21
     570: bipush        9
     572: if_icmpne     591
     575: aload_2
     576: aload         20
     578: iconst_0
     579: iconst_0
     580: iconst_3
     581: aconst_null
     582: invokestatic  #178                // Method Point.copy$default:(LPoint;IIILjava/lang/Object;)LPoint;
     585: invokeinterface #179,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
     590: pop
     591: nop
     592: nop
     593: goto          487
     596: nop
     597: iinc          11, 1
     600: goto          459
     603: nop
     604: nop
     605: goto          208
     608: nop
     609: aload_2
     610: invokeinterface #182,  1          // InterfaceMethod java/util/Set.size:()I
     615: ireturn
}


fun main() {

    fun part1(input: List<String>): Int {
        val matrix = input.map { it.toList() }
        return matrix.count { row, col -> matrix.visible(row, col) }
    }

    fun part2(input: List<String>): Int {
        val matrix = input.map { it.toList() }
        return matrix.maxOf { row, col -> matrix.score(row, col) }
    }

    val input = readInput("inputs/Day08")
    println(part1(input))
    println(part2(input))
}

fun List<List<Char>>.score(row: Int, col: Int) = scoreUp(row, col) * scoreDown(row, col) * scoreLeft(row, col) * scoreRight(row, col)

fun List<List<Char>>.scoreUp(row: Int, col: Int): Int {
    var count = 0

    for (i in row-1 downTo 0) {
        count++

        if (this[i][col] >= this[row][col]) {
            break
        }
    }

    return count
}

fun List<List<Char>>.scoreDown(row: Int, col: Int): Int {
    var count = 0

    for (i in row+1 until size) {
        count++

        if (this[i][col] >= this[row][col]) {
            break
        }
    }

    return count
}

fun List<List<Char>>.scoreLeft(row: Int, col: Int): Int {
    var count = 0

    for (i in col-1 downTo 0) {
        count++

        if (this[row][i] >= this[row][col]) {
            break
        }
    }

    return count
}

fun List<List<Char>>.scoreRight(row: Int, col: Int): Int {
    var count = 0

    for (i in col+1 until first().size) {
        count++

        if (this[row][i] >= this[row][col]) {
            break
        }
    }

    return count
}

fun List<List<Char>>.visibleUp(row: Int, col: Int): Boolean {
    for (i in 0 until row) {
        if (this[i][col] >= this[row][col]) {
            return false
        }
    }

    return true
}

fun List<List<Char>>.visibleDown(row: Int, col: Int): Boolean {
    for (i in row+1 until size) {
        if (this[i][col] >= this[row][col]) {
            return false
        }
    }

    return true
}

fun List<List<Char>>.visibleLeft(row: Int, col: Int): Boolean {
    for (i in 0 until col) {
        if (this[row][i] >= this[row][col]) {
            return false
        }
    }

    return true
}

fun List<List<Char>>.visibleRight(row: Int, col: Int): Boolean {
    for (i in col+1 until first().size) {
        if (this[row][i] >= this[row][col]) {
            return false
        }
    }

    return true
}

fun List<List<Char>>.visible(row: Int, col: Int): Boolean {
    if (row == 0 || col == 0) {
        return true
    } else if (row == size-1 || col == first().size-1) {
        return true
    }

    return visibleUp(row, col) || visibleDown(row, col) || visibleRight(row, col) || visibleLeft(row, col)
}

Compiled from "Day08.kt"
public final class Day08Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String inputs/Day08
       2: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: aload_0
       7: invokestatic  #18                 // Method main$part1:(Ljava/util/List;)I
      10: istore_1
      11: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      14: iload_1
      15: invokevirtual #30                 // Method java/io/PrintStream.println:(I)V
      18: aload_0
      19: invokestatic  #33                 // Method main$part2:(Ljava/util/List;)I
      22: istore_1
      23: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      26: iload_1
      27: invokevirtual #30                 // Method java/io/PrintStream.println:(I)V
      30: return

  public static final int score(java.util.List<? extends java.util.List<java.lang.Character>>, int, int);
    Code:
       0: aload_0
       1: ldc           #41                 // String <this>
       3: invokestatic  #47                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: iload_1
       8: iload_2
       9: invokestatic  #50                 // Method scoreUp:(Ljava/util/List;II)I
      12: aload_0
      13: iload_1
      14: iload_2
      15: invokestatic  #53                 // Method scoreDown:(Ljava/util/List;II)I
      18: imul
      19: aload_0
      20: iload_1
      21: iload_2
      22: invokestatic  #56                 // Method scoreLeft:(Ljava/util/List;II)I
      25: imul
      26: aload_0
      27: iload_1
      28: iload_2
      29: invokestatic  #59                 // Method scoreRight:(Ljava/util/List;II)I
      32: imul
      33: ireturn

  public static final int scoreUp(java.util.List<? extends java.util.List<java.lang.Character>>, int, int);
    Code:
       0: aload_0
       1: ldc           #41                 // String <this>
       3: invokestatic  #47                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_0
       7: istore_3
       8: iload_1
       9: iconst_1
      10: isub
      11: istore        4
      13: iconst_m1
      14: iload         4
      16: if_icmpge     82
      19: iinc          3, 1
      22: aload_0
      23: iload         4
      25: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      30: checkcast     #65                 // class java/util/List
      33: iload_2
      34: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      39: checkcast     #71                 // class java/lang/Character
      42: invokevirtual #75                 // Method java/lang/Character.charValue:()C
      45: aload_0
      46: iload_1
      47: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      52: checkcast     #65                 // class java/util/List
      55: iload_2
      56: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      61: checkcast     #71                 // class java/lang/Character
      64: invokevirtual #75                 // Method java/lang/Character.charValue:()C
      67: invokestatic  #79                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      70: iflt          76
      73: goto          82
      76: iinc          4, -1
      79: goto          13
      82: iload_3
      83: ireturn

  public static final int scoreDown(java.util.List<? extends java.util.List<java.lang.Character>>, int, int);
    Code:
       0: aload_0
       1: ldc           #41                 // String <this>
       3: invokestatic  #47                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_0
       7: istore_3
       8: iload_1
       9: iconst_1
      10: iadd
      11: istore        4
      13: aload_0
      14: invokeinterface #86,  1           // InterfaceMethod java/util/List.size:()I
      19: istore        5
      21: iload         4
      23: iload         5
      25: if_icmpge     91
      28: iinc          3, 1
      31: aload_0
      32: iload         4
      34: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      39: checkcast     #65                 // class java/util/List
      42: iload_2
      43: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      48: checkcast     #71                 // class java/lang/Character
      51: invokevirtual #75                 // Method java/lang/Character.charValue:()C
      54: aload_0
      55: iload_1
      56: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      61: checkcast     #65                 // class java/util/List
      64: iload_2
      65: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      70: checkcast     #71                 // class java/lang/Character
      73: invokevirtual #75                 // Method java/lang/Character.charValue:()C
      76: invokestatic  #79                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      79: iflt          85
      82: goto          91
      85: iinc          4, 1
      88: goto          21
      91: iload_3
      92: ireturn

  public static final int scoreLeft(java.util.List<? extends java.util.List<java.lang.Character>>, int, int);
    Code:
       0: aload_0
       1: ldc           #41                 // String <this>
       3: invokestatic  #47                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_0
       7: istore_3
       8: iload_2
       9: iconst_1
      10: isub
      11: istore        4
      13: iconst_m1
      14: iload         4
      16: if_icmpge     82
      19: iinc          3, 1
      22: aload_0
      23: iload_1
      24: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      29: checkcast     #65                 // class java/util/List
      32: iload         4
      34: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      39: checkcast     #71                 // class java/lang/Character
      42: invokevirtual #75                 // Method java/lang/Character.charValue:()C
      45: aload_0
      46: iload_1
      47: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      52: checkcast     #65                 // class java/util/List
      55: iload_2
      56: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      61: checkcast     #71                 // class java/lang/Character
      64: invokevirtual #75                 // Method java/lang/Character.charValue:()C
      67: invokestatic  #79                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      70: iflt          76
      73: goto          82
      76: iinc          4, -1
      79: goto          13
      82: iload_3
      83: ireturn

  public static final int scoreRight(java.util.List<? extends java.util.List<java.lang.Character>>, int, int);
    Code:
       0: aload_0
       1: ldc           #41                 // String <this>
       3: invokestatic  #47                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_0
       7: istore_3
       8: iload_2
       9: iconst_1
      10: iadd
      11: istore        4
      13: aload_0
      14: invokestatic  #94                 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
      17: checkcast     #65                 // class java/util/List
      20: invokeinterface #86,  1           // InterfaceMethod java/util/List.size:()I
      25: istore        5
      27: iload         4
      29: iload         5
      31: if_icmpge     97
      34: iinc          3, 1
      37: aload_0
      38: iload_1
      39: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      44: checkcast     #65                 // class java/util/List
      47: iload         4
      49: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      54: checkcast     #71                 // class java/lang/Character
      57: invokevirtual #75                 // Method java/lang/Character.charValue:()C
      60: aload_0
      61: iload_1
      62: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      67: checkcast     #65                 // class java/util/List
      70: iload_2
      71: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      76: checkcast     #71                 // class java/lang/Character
      79: invokevirtual #75                 // Method java/lang/Character.charValue:()C
      82: invokestatic  #79                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      85: iflt          91
      88: goto          97
      91: iinc          4, 1
      94: goto          27
      97: iload_3
      98: ireturn

  public static final boolean visibleUp(java.util.List<? extends java.util.List<java.lang.Character>>, int, int);
    Code:
       0: aload_0
       1: ldc           #41                 // String <this>
       3: invokestatic  #47                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_0
       7: istore_3
       8: iload_3
       9: iload_1
      10: if_icmpge     71
      13: aload_0
      14: iload_3
      15: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      20: checkcast     #65                 // class java/util/List
      23: iload_2
      24: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      29: checkcast     #71                 // class java/lang/Character
      32: invokevirtual #75                 // Method java/lang/Character.charValue:()C
      35: aload_0
      36: iload_1
      37: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      42: checkcast     #65                 // class java/util/List
      45: iload_2
      46: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      51: checkcast     #71                 // class java/lang/Character
      54: invokevirtual #75                 // Method java/lang/Character.charValue:()C
      57: invokestatic  #79                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      60: iflt          65
      63: iconst_0
      64: ireturn
      65: iinc          3, 1
      68: goto          8
      71: iconst_1
      72: ireturn

  public static final boolean visibleDown(java.util.List<? extends java.util.List<java.lang.Character>>, int, int);
    Code:
       0: aload_0
       1: ldc           #41                 // String <this>
       3: invokestatic  #47                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iload_1
       7: iconst_1
       8: iadd
       9: istore_3
      10: aload_0
      11: invokeinterface #86,  1           // InterfaceMethod java/util/List.size:()I
      16: istore        4
      18: iload_3
      19: iload         4
      21: if_icmpge     82
      24: aload_0
      25: iload_3
      26: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      31: checkcast     #65                 // class java/util/List
      34: iload_2
      35: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      40: checkcast     #71                 // class java/lang/Character
      43: invokevirtual #75                 // Method java/lang/Character.charValue:()C
      46: aload_0
      47: iload_1
      48: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      53: checkcast     #65                 // class java/util/List
      56: iload_2
      57: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      62: checkcast     #71                 // class java/lang/Character
      65: invokevirtual #75                 // Method java/lang/Character.charValue:()C
      68: invokestatic  #79                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      71: iflt          76
      74: iconst_0
      75: ireturn
      76: iinc          3, 1
      79: goto          18
      82: iconst_1
      83: ireturn

  public static final boolean visibleLeft(java.util.List<? extends java.util.List<java.lang.Character>>, int, int);
    Code:
       0: aload_0
       1: ldc           #41                 // String <this>
       3: invokestatic  #47                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_0
       7: istore_3
       8: iload_3
       9: iload_2
      10: if_icmpge     71
      13: aload_0
      14: iload_1
      15: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      20: checkcast     #65                 // class java/util/List
      23: iload_3
      24: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      29: checkcast     #71                 // class java/lang/Character
      32: invokevirtual #75                 // Method java/lang/Character.charValue:()C
      35: aload_0
      36: iload_1
      37: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      42: checkcast     #65                 // class java/util/List
      45: iload_2
      46: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      51: checkcast     #71                 // class java/lang/Character
      54: invokevirtual #75                 // Method java/lang/Character.charValue:()C
      57: invokestatic  #79                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      60: iflt          65
      63: iconst_0
      64: ireturn
      65: iinc          3, 1
      68: goto          8
      71: iconst_1
      72: ireturn

  public static final boolean visibleRight(java.util.List<? extends java.util.List<java.lang.Character>>, int, int);
    Code:
       0: aload_0
       1: ldc           #41                 // String <this>
       3: invokestatic  #47                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iload_2
       7: iconst_1
       8: iadd
       9: istore_3
      10: aload_0
      11: invokestatic  #94                 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
      14: checkcast     #65                 // class java/util/List
      17: invokeinterface #86,  1           // InterfaceMethod java/util/List.size:()I
      22: istore        4
      24: iload_3
      25: iload         4
      27: if_icmpge     88
      30: aload_0
      31: iload_1
      32: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      37: checkcast     #65                 // class java/util/List
      40: iload_3
      41: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      46: checkcast     #71                 // class java/lang/Character
      49: invokevirtual #75                 // Method java/lang/Character.charValue:()C
      52: aload_0
      53: iload_1
      54: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      59: checkcast     #65                 // class java/util/List
      62: iload_2
      63: invokeinterface #69,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      68: checkcast     #71                 // class java/lang/Character
      71: invokevirtual #75                 // Method java/lang/Character.charValue:()C
      74: invokestatic  #79                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      77: iflt          82
      80: iconst_0
      81: ireturn
      82: iinc          3, 1
      85: goto          24
      88: iconst_1
      89: ireturn

  public static final boolean visible(java.util.List<? extends java.util.List<java.lang.Character>>, int, int);
    Code:
       0: aload_0
       1: ldc           #41                 // String <this>
       3: invokestatic  #47                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iload_1
       7: ifeq          14
      10: iload_2
      11: ifne          16
      14: iconst_1
      15: ireturn
      16: iload_1
      17: aload_0
      18: invokeinterface #86,  1           // InterfaceMethod java/util/List.size:()I
      23: iconst_1
      24: isub
      25: if_icmpeq     46
      28: iload_2
      29: aload_0
      30: invokestatic  #94                 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
      33: checkcast     #65                 // class java/util/List
      36: invokeinterface #86,  1           // InterfaceMethod java/util/List.size:()I
      41: iconst_1
      42: isub
      43: if_icmpne     48
      46: iconst_1
      47: ireturn
      48: aload_0
      49: iload_1
      50: iload_2
      51: invokestatic  #108                // Method visibleUp:(Ljava/util/List;II)Z
      54: ifne          84
      57: aload_0
      58: iload_1
      59: iload_2
      60: invokestatic  #110                // Method visibleDown:(Ljava/util/List;II)Z
      63: ifne          84
      66: aload_0
      67: iload_1
      68: iload_2
      69: invokestatic  #112                // Method visibleRight:(Ljava/util/List;II)Z
      72: ifne          84
      75: aload_0
      76: iload_1
      77: iload_2
      78: invokestatic  #114                // Method visibleLeft:(Ljava/util/List;II)Z
      81: ifeq          88
      84: iconst_1
      85: goto          89
      88: iconst_0
      89: ireturn

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

  private static final boolean main$part1$lambda$1(java.util.List, int, int);
    Code:
       0: aload_0
       1: iload_1
       2: iload_2
       3: invokestatic  #123                // Method visible:(Ljava/util/List;II)Z
       6: ireturn

  private static final int main$part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #127                // class java/lang/Iterable
       4: astore_2
       5: iconst_0
       6: istore_3
       7: aload_2
       8: astore        4
      10: new           #129                // class java/util/ArrayList
      13: dup
      14: aload_2
      15: bipush        10
      17: invokestatic  #133                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      20: invokespecial #136                // Method java/util/ArrayList."<init>":(I)V
      23: checkcast     #138                // class java/util/Collection
      26: astore        5
      28: iconst_0
      29: istore        6
      31: aload         4
      33: invokeinterface #142,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      38: astore        7
      40: aload         7
      42: invokeinterface #148,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      47: ifeq          93
      50: aload         7
      52: invokeinterface #152,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      57: astore        8
      59: aload         5
      61: aload         8
      63: checkcast     #154                // class java/lang/String
      66: astore        9
      68: astore        11
      70: iconst_0
      71: istore        10
      73: aload         9
      75: checkcast     #156                // class java/lang/CharSequence
      78: invokestatic  #162                // Method kotlin/text/StringsKt.toList:(Ljava/lang/CharSequence;)Ljava/util/List;
      81: aload         11
      83: swap
      84: invokeinterface #166,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      89: pop
      90: goto          40
      93: aload         5
      95: checkcast     #65                 // class java/util/List
      98: nop
      99: astore_1
     100: aload_1
     101: aload_1
     102: invokedynamic #184,  0            // InvokeDynamic #0:invoke:(Ljava/util/List;)Lkotlin/jvm/functions/Function2;
     107: invokestatic  #187                // Method UtilsKt.count:(Ljava/util/List;Lkotlin/jvm/functions/Function2;)I
     110: ireturn

  private static final int main$part2$lambda$3(java.util.List, int, int);
    Code:
       0: aload_0
       1: iload_1
       2: iload_2
       3: invokestatic  #203                // Method score:(Ljava/util/List;II)I
       6: ireturn

  private static final int main$part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #127                // class java/lang/Iterable
       4: astore_2
       5: iconst_0
       6: istore_3
       7: aload_2
       8: astore        4
      10: new           #129                // class java/util/ArrayList
      13: dup
      14: aload_2
      15: bipush        10
      17: invokestatic  #133                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      20: invokespecial #136                // Method java/util/ArrayList."<init>":(I)V
      23: checkcast     #138                // class java/util/Collection
      26: astore        5
      28: iconst_0
      29: istore        6
      31: aload         4
      33: invokeinterface #142,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      38: astore        7
      40: aload         7
      42: invokeinterface #148,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      47: ifeq          93
      50: aload         7
      52: invokeinterface #152,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      57: astore        8
      59: aload         5
      61: aload         8
      63: checkcast     #154                // class java/lang/String
      66: astore        9
      68: astore        11
      70: iconst_0
      71: istore        10
      73: aload         9
      75: checkcast     #156                // class java/lang/CharSequence
      78: invokestatic  #162                // Method kotlin/text/StringsKt.toList:(Ljava/lang/CharSequence;)Ljava/util/List;
      81: aload         11
      83: swap
      84: invokeinterface #166,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      89: pop
      90: goto          40
      93: aload         5
      95: checkcast     #65                 // class java/util/List
      98: nop
      99: astore_1
     100: aload_1
     101: aload_1
     102: invokedynamic #209,  0            // InvokeDynamic #1:invoke:(Ljava/util/List;)Lkotlin/jvm/functions/Function2;
     107: invokestatic  #212                // Method UtilsKt.maxOf:(Ljava/util/List;Lkotlin/jvm/functions/Function2;)I
     110: ireturn
}


fun main() {
    fun part1(input: List<String>): Int {
        var elfNum = 0
        return input.groupBy { if (it.isBlank()) elfNum++; elfNum }
                    .map { elf -> elf.value.filterNot { calories -> calories.isBlank() } }
                    .maxOf { it.sumOf { n -> n.toInt() } }
    }

    fun part2(input: List<String>): Int {
        var elfNum = 0
        return input.groupBy { if (it.isBlank()) elfNum++; elfNum }
            .map { elf -> elf.value.filterNot { calories -> calories.isBlank() } }
            .map { it.sumOf { n -> n.toInt() } }
            .sortedDescending()
            .take(3)
            .sum()
    }

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

Compiled from "Day01.kt"
public final class Day01Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String inputs/Day01
       2: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: aload_0
       7: invokestatic  #18                 // Method main$part1:(Ljava/util/List;)I
      10: istore_1
      11: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      14: iload_1
      15: invokevirtual #30                 // Method java/io/PrintStream.println:(I)V
      18: aload_0
      19: invokestatic  #33                 // Method main$part2:(Ljava/util/List;)I
      22: istore_1
      23: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      26: iload_1
      27: invokevirtual #30                 // Method java/io/PrintStream.println:(I)V
      30: return

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

  private static final int main$part1(java.util.List<java.lang.String>);
    Code:
       0: iconst_0
       1: istore_1
       2: aload_0
       3: checkcast     #43                 // class java/lang/Iterable
       6: astore_2
       7: iconst_0
       8: istore_3
       9: aload_2
      10: astore        4
      12: new           #45                 // class java/util/LinkedHashMap
      15: dup
      16: invokespecial #48                 // Method java/util/LinkedHashMap."<init>":()V
      19: checkcast     #50                 // class java/util/Map
      22: astore        5
      24: iconst_0
      25: istore        6
      27: aload         4
      29: invokeinterface #54,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      34: astore        7
      36: aload         7
      38: invokeinterface #60,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      43: ifeq          162
      46: aload         7
      48: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      53: astore        8
      55: aload         8
      57: checkcast     #66                 // class java/lang/String
      60: astore        9
      62: iconst_0
      63: istore        10
      65: aload         9
      67: checkcast     #68                 // class java/lang/CharSequence
      70: invokestatic  #74                 // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
      73: ifeq          80
      76: iload_1
      77: iconst_1
      78: iadd
      79: istore_1
      80: iload_1
      81: invokestatic  #80                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      84: astore        12
      86: aload         5
      88: astore        13
      90: iconst_0
      91: istore        14
      93: aload         13
      95: aload         12
      97: invokeinterface #84,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     102: astore        15
     104: aload         15
     106: ifnonnull     141
     109: iconst_0
     110: istore        16
     112: new           #86                 // class java/util/ArrayList
     115: dup
     116: invokespecial #87                 // Method java/util/ArrayList."<init>":()V
     119: checkcast     #89                 // class java/util/List
     122: astore        16
     124: aload         13
     126: aload         12
     128: aload         16
     130: invokeinterface #93,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     135: pop
     136: aload         16
     138: goto          143
     141: aload         15
     143: nop
     144: checkcast     #89                 // class java/util/List
     147: astore        17
     149: aload         17
     151: aload         8
     153: invokeinterface #97,  2           // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     158: pop
     159: goto          36
     162: aload         5
     164: nop
     165: astore_2
     166: nop
     167: iconst_0
     168: istore_3
     169: aload_2
     170: astore        4
     172: new           #86                 // class java/util/ArrayList
     175: dup
     176: aload_2
     177: invokeinterface #101,  1          // InterfaceMethod java/util/Map.size:()I
     182: invokespecial #103                // Method java/util/ArrayList."<init>":(I)V
     185: checkcast     #105                // class java/util/Collection
     188: astore        5
     190: iconst_0
     191: istore        6
     193: aload         4
     195: invokeinterface #109,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     200: invokeinterface #112,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     205: astore        7
     207: aload         7
     209: invokeinterface #60,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     214: ifeq          355
     217: aload         7
     219: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     224: checkcast     #114                // class java/util/Map$Entry
     227: astore        8
     229: aload         5
     231: aload         8
     233: astore        9
     235: astore        20
     237: iconst_0
     238: istore        10
     240: aload         9
     242: invokeinterface #117,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     247: checkcast     #43                 // class java/lang/Iterable
     250: astore        11
     252: iconst_0
     253: istore        12
     255: aload         11
     257: astore        13
     259: new           #86                 // class java/util/ArrayList
     262: dup
     263: invokespecial #87                 // Method java/util/ArrayList."<init>":()V
     266: checkcast     #105                // class java/util/Collection
     269: astore        14
     271: iconst_0
     272: istore        15
     274: aload         13
     276: invokeinterface #54,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     281: astore        16
     283: aload         16
     285: invokeinterface #60,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     290: ifeq          336
     293: aload         16
     295: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     300: astore        17
     302: aload         17
     304: checkcast     #66                 // class java/lang/String
     307: astore        18
     309: iconst_0
     310: istore        19
     312: aload         18
     314: checkcast     #68                 // class java/lang/CharSequence
     317: invokestatic  #74                 // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
     320: ifne          283
     323: aload         14
     325: aload         17
     327: invokeinterface #118,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     332: pop
     333: goto          283
     336: aload         14
     338: checkcast     #89                 // class java/util/List
     341: nop
     342: nop
     343: aload         20
     345: swap
     346: invokeinterface #118,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     351: pop
     352: goto          207
     355: aload         5
     357: checkcast     #89                 // class java/util/List
     360: nop
     361: checkcast     #43                 // class java/lang/Iterable
     364: invokeinterface #54,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     369: astore_3
     370: aload_3
     371: invokeinterface #60,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     376: ifne          387
     379: new           #120                // class java/util/NoSuchElementException
     382: dup
     383: invokespecial #121                // Method java/util/NoSuchElementException."<init>":()V
     386: athrow
     387: aload_3
     388: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     393: checkcast     #89                 // class java/util/List
     396: astore        4
     398: iconst_0
     399: istore        5
     401: aload         4
     403: checkcast     #43                 // class java/lang/Iterable
     406: astore        6
     408: iconst_0
     409: istore        7
     411: aload         6
     413: invokeinterface #54,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     418: astore        8
     420: aload         8
     422: invokeinterface #60,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     427: ifeq          471
     430: aload         8
     432: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     437: astore        9
     439: iload         7
     441: aload         9
     443: checkcast     #66                 // class java/lang/String
     446: astore        10
     448: istore        11
     450: iconst_0
     451: istore        12
     453: aload         10
     455: invokestatic  #125                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     458: nop
     459: istore        13
     461: iload         11
     463: iload         13
     465: iadd
     466: istore        7
     468: goto          420
     471: iload         7
     473: nop
     474: istore        4
     476: aload_3
     477: invokeinterface #60,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     482: ifeq          588
     485: aload_3
     486: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     491: checkcast     #89                 // class java/util/List
     494: astore        5
     496: iconst_0
     497: istore        6
     499: aload         5
     501: checkcast     #43                 // class java/lang/Iterable
     504: astore        7
     506: iconst_0
     507: istore        8
     509: aload         7
     511: invokeinterface #54,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     516: astore        9
     518: aload         9
     520: invokeinterface #60,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     525: ifeq          569
     528: aload         9
     530: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     535: astore        10
     537: iload         8
     539: aload         10
     541: checkcast     #66                 // class java/lang/String
     544: astore        11
     546: istore        12
     548: iconst_0
     549: istore        13
     551: aload         11
     553: invokestatic  #125                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     556: nop
     557: istore        14
     559: iload         12
     561: iload         14
     563: iadd
     564: istore        8
     566: goto          518
     569: iload         8
     571: nop
     572: istore        5
     574: iload         4
     576: iload         5
     578: if_icmpge     476
     581: iload         5
     583: istore        4
     585: goto          476
     588: iload         4
     590: ireturn

  private static final int main$part2(java.util.List<java.lang.String>);
    Code:
       0: iconst_0
       1: istore_1
       2: aload_0
       3: checkcast     #43                 // class java/lang/Iterable
       6: astore_2
       7: iconst_0
       8: istore_3
       9: aload_2
      10: astore        4
      12: new           #45                 // class java/util/LinkedHashMap
      15: dup
      16: invokespecial #48                 // Method java/util/LinkedHashMap."<init>":()V
      19: checkcast     #50                 // class java/util/Map
      22: astore        5
      24: iconst_0
      25: istore        6
      27: aload         4
      29: invokeinterface #54,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      34: astore        7
      36: aload         7
      38: invokeinterface #60,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      43: ifeq          162
      46: aload         7
      48: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      53: astore        8
      55: aload         8
      57: checkcast     #66                 // class java/lang/String
      60: astore        9
      62: iconst_0
      63: istore        10
      65: aload         9
      67: checkcast     #68                 // class java/lang/CharSequence
      70: invokestatic  #74                 // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
      73: ifeq          80
      76: iload_1
      77: iconst_1
      78: iadd
      79: istore_1
      80: iload_1
      81: invokestatic  #80                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      84: astore        12
      86: aload         5
      88: astore        13
      90: iconst_0
      91: istore        14
      93: aload         13
      95: aload         12
      97: invokeinterface #84,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     102: astore        15
     104: aload         15
     106: ifnonnull     141
     109: iconst_0
     110: istore        16
     112: new           #86                 // class java/util/ArrayList
     115: dup
     116: invokespecial #87                 // Method java/util/ArrayList."<init>":()V
     119: checkcast     #89                 // class java/util/List
     122: astore        16
     124: aload         13
     126: aload         12
     128: aload         16
     130: invokeinterface #93,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     135: pop
     136: aload         16
     138: goto          143
     141: aload         15
     143: nop
     144: checkcast     #89                 // class java/util/List
     147: astore        17
     149: aload         17
     151: aload         8
     153: invokeinterface #97,  2           // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     158: pop
     159: goto          36
     162: aload         5
     164: nop
     165: astore_2
     166: nop
     167: iconst_0
     168: istore_3
     169: aload_2
     170: astore        4
     172: new           #86                 // class java/util/ArrayList
     175: dup
     176: aload_2
     177: invokeinterface #101,  1          // InterfaceMethod java/util/Map.size:()I
     182: invokespecial #103                // Method java/util/ArrayList."<init>":(I)V
     185: checkcast     #105                // class java/util/Collection
     188: astore        5
     190: iconst_0
     191: istore        6
     193: aload         4
     195: invokeinterface #109,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     200: invokeinterface #112,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     205: astore        7
     207: aload         7
     209: invokeinterface #60,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     214: ifeq          355
     217: aload         7
     219: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     224: checkcast     #114                // class java/util/Map$Entry
     227: astore        8
     229: aload         5
     231: aload         8
     233: astore        9
     235: astore        20
     237: iconst_0
     238: istore        10
     240: aload         9
     242: invokeinterface #117,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     247: checkcast     #43                 // class java/lang/Iterable
     250: astore        11
     252: iconst_0
     253: istore        12
     255: aload         11
     257: astore        13
     259: new           #86                 // class java/util/ArrayList
     262: dup
     263: invokespecial #87                 // Method java/util/ArrayList."<init>":()V
     266: checkcast     #105                // class java/util/Collection
     269: astore        14
     271: iconst_0
     272: istore        15
     274: aload         13
     276: invokeinterface #54,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     281: astore        16
     283: aload         16
     285: invokeinterface #60,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     290: ifeq          336
     293: aload         16
     295: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     300: astore        17
     302: aload         17
     304: checkcast     #66                 // class java/lang/String
     307: astore        18
     309: iconst_0
     310: istore        19
     312: aload         18
     314: checkcast     #68                 // class java/lang/CharSequence
     317: invokestatic  #74                 // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
     320: ifne          283
     323: aload         14
     325: aload         17
     327: invokeinterface #118,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     332: pop
     333: goto          283
     336: aload         14
     338: checkcast     #89                 // class java/util/List
     341: nop
     342: nop
     343: aload         20
     345: swap
     346: invokeinterface #118,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     351: pop
     352: goto          207
     355: aload         5
     357: checkcast     #89                 // class java/util/List
     360: nop
     361: checkcast     #43                 // class java/lang/Iterable
     364: astore_2
     365: nop
     366: iconst_0
     367: istore_3
     368: aload_2
     369: astore        4
     371: new           #86                 // class java/util/ArrayList
     374: dup
     375: aload_2
     376: bipush        10
     378: invokestatic  #170                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     381: invokespecial #103                // Method java/util/ArrayList."<init>":(I)V
     384: checkcast     #105                // class java/util/Collection
     387: astore        5
     389: iconst_0
     390: istore        6
     392: aload         4
     394: invokeinterface #54,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     399: astore        7
     401: aload         7
     403: invokeinterface #60,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     408: ifeq          522
     411: aload         7
     413: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     418: astore        8
     420: aload         5
     422: aload         8
     424: checkcast     #89                 // class java/util/List
     427: astore        9
     429: astore        20
     431: iconst_0
     432: istore        10
     434: aload         9
     436: checkcast     #43                 // class java/lang/Iterable
     439: astore        11
     441: iconst_0
     442: istore        12
     444: aload         11
     446: invokeinterface #54,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     451: astore        13
     453: aload         13
     455: invokeinterface #60,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     460: ifeq          504
     463: aload         13
     465: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     470: astore        14
     472: iload         12
     474: aload         14
     476: checkcast     #66                 // class java/lang/String
     479: astore        15
     481: istore        16
     483: iconst_0
     484: istore        17
     486: aload         15
     488: invokestatic  #125                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     491: nop
     492: istore        18
     494: iload         16
     496: iload         18
     498: iadd
     499: istore        12
     501: goto          453
     504: iload         12
     506: nop
     507: invokestatic  #80                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     510: aload         20
     512: swap
     513: invokeinterface #118,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     518: pop
     519: goto          401
     522: aload         5
     524: checkcast     #89                 // class java/util/List
     527: nop
     528: checkcast     #43                 // class java/lang/Iterable
     531: invokestatic  #174                // Method kotlin/collections/CollectionsKt.sortedDescending:(Ljava/lang/Iterable;)Ljava/util/List;
     534: checkcast     #43                 // class java/lang/Iterable
     537: iconst_3
     538: invokestatic  #178                // Method kotlin/collections/CollectionsKt.take:(Ljava/lang/Iterable;I)Ljava/util/List;
     541: checkcast     #43                 // class java/lang/Iterable
     544: invokestatic  #182                // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
     547: ireturn
}


import java.io.File
import kotlin.math.max

class Advent2306 {
    private fun chargeToDistance(charge: Long, duration: Long): Long {
        val timeLeft = duration - charge
        return charge * max(0, timeLeft)
    }

    private fun getBestResults(filename: String): List<Pair<Long, Long>> {
        val times = mutableListOf<Long>()
        val distances = mutableListOf<Long>()
        File(this::class.java.getResource(filename)!!.file).forEachLine { line ->
            val parts = line.split(":")

            when (parts[0]) {
                "Time" -> times += Regex("""\d+""").findAll(parts[1]).map { it.value.toLong() }.toList()
                "Distance" -> distances += Regex("""\d+""").findAll(parts[1]).map { it.value.toLong() }.toList()
            }
        }

        assert(times.size == distances.size)

        val races = mutableListOf<Pair<Long, Long>>()
        for (i in 0..<times.size) {
            races += Pair(times[i], distances[i])
        }

        return races
    }

    fun getWaysToWin1(filename: String): Int {
        val races = getBestResults(filename)
        var waysToWinMultiplied = 0
        races.forEach {
            val duration = it.first
            val distance = it.second
            var wins = 0
            for (charge in 0..<duration) {
                if (chargeToDistance(charge, duration) > distance) {
                    wins++
                }
            }

            waysToWinMultiplied = if (waysToWinMultiplied == 0) {
                wins
            } else {
                waysToWinMultiplied * wins
            }
        }

        return waysToWinMultiplied
    }

    private fun getResult(filename: String): Pair<Long, Long> {
        var duration = 0L
        var distance = 0L
        File(this::class.java.getResource(filename)!!.file).forEachLine { line ->
            val parts = line.split(":")
            when (parts[0]) {
                "Time" -> duration = parts[1].replace(" ", "").toLong()
                "Distance" -> distance = parts[1].replace(" ", "").toLong()
            }
        }

        return Pair(duration, distance)
    }

    fun getWaysToWin2(filename: String): Int {
        val result = getResult(filename)
        var waysToWin = 0
        for (charge in 0..<result.first) {
            if (chargeToDistance(charge, result.first) > result.second) {
                ++waysToWin
            }
        }

        return waysToWin
    }
}

Compiled from "Advent2306.kt"
public final class Advent2306 {
  public Advent2306();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  private final long chargeToDistance(long, long);
    Code:
       0: lload_3
       1: lload_1
       2: lsub
       3: lstore        5
       5: lload_1
       6: lconst_0
       7: lload         5
       9: invokestatic  #17                 // Method java/lang/Math.max:(JJ)J
      12: lmul
      13: lreturn

  private final java.util.List<kotlin.Pair<java.lang.Long, java.lang.Long>> getBestResults(java.lang.String);
    Code:
       0: new           #26                 // class java/util/ArrayList
       3: dup
       4: invokespecial #27                 // Method java/util/ArrayList."<init>":()V
       7: checkcast     #29                 // class java/util/List
      10: astore_2
      11: new           #26                 // class java/util/ArrayList
      14: dup
      15: invokespecial #27                 // Method java/util/ArrayList."<init>":()V
      18: checkcast     #29                 // class java/util/List
      21: astore_3
      22: new           #31                 // class java/io/File
      25: dup
      26: aload_0
      27: invokevirtual #35                 // Method java/lang/Object.getClass:()Ljava/lang/Class;
      30: aload_1
      31: invokevirtual #41                 // Method java/lang/Class.getResource:(Ljava/lang/String;)Ljava/net/URL;
      34: dup
      35: invokestatic  #47                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      38: invokevirtual #53                 // Method java/net/URL.getFile:()Ljava/lang/String;
      41: invokespecial #56                 // Method java/io/File."<init>":(Ljava/lang/String;)V
      44: aconst_null
      45: aload_2
      46: aload_3
      47: invokedynamic #76,  0             // InvokeDynamic #0:invoke:(Ljava/util/List;Ljava/util/List;)Lkotlin/jvm/functions/Function1;
      52: iconst_1
      53: aconst_null
      54: invokestatic  #82                 // Method kotlin/io/FilesKt.forEachLine$default:(Ljava/io/File;Ljava/nio/charset/Charset;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
      57: aload_2
      58: invokeinterface #86,  1           // InterfaceMethod java/util/List.size:()I
      63: aload_3
      64: invokeinterface #86,  1           // InterfaceMethod java/util/List.size:()I
      69: if_icmpne     76
      72: iconst_1
      73: goto          77
      76: iconst_0
      77: istore        4
      79: getstatic     #92                 // Field kotlin/_Assertions.ENABLED:Z
      82: ifeq          104
      85: iload         4
      87: ifne          104
      90: ldc           #94                 // String Assertion failed
      92: astore        5
      94: new           #96                 // class java/lang/AssertionError
      97: dup
      98: aload         5
     100: invokespecial #98                 // Method java/lang/AssertionError."<init>":(Ljava/lang/Object;)V
     103: athrow
     104: new           #26                 // class java/util/ArrayList
     107: dup
     108: invokespecial #27                 // Method java/util/ArrayList."<init>":()V
     111: checkcast     #29                 // class java/util/List
     114: astore        4
     116: iconst_0
     117: istore        5
     119: aload_2
     120: invokeinterface #86,  1           // InterfaceMethod java/util/List.size:()I
     125: istore        6
     127: iload         5
     129: iload         6
     131: if_icmpge     174
     134: aload         4
     136: checkcast     #100                // class java/util/Collection
     139: new           #102                // class kotlin/Pair
     142: dup
     143: aload_2
     144: iload         5
     146: invokeinterface #106,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     151: aload_3
     152: iload         5
     154: invokeinterface #106,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     159: invokespecial #109                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     162: invokeinterface #113,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     167: pop
     168: iinc          5, 1
     171: goto          127
     174: aload         4
     176: areturn

  public final int getWaysToWin1(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #127                // String filename
       3: invokestatic  #131                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: invokespecial #133                // Method getBestResults:(Ljava/lang/String;)Ljava/util/List;
      11: astore_2
      12: iconst_0
      13: istore_3
      14: aload_2
      15: checkcast     #135                // class java/lang/Iterable
      18: astore        4
      20: iconst_0
      21: istore        5
      23: aload         4
      25: invokeinterface #139,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      30: astore        6
      32: aload         6
      34: invokeinterface #145,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      39: ifeq          146
      42: aload         6
      44: invokeinterface #149,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      49: astore        7
      51: aload         7
      53: checkcast     #102                // class kotlin/Pair
      56: astore        8
      58: iconst_0
      59: istore        9
      61: aload         8
      63: invokevirtual #152                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      66: checkcast     #154                // class java/lang/Number
      69: invokevirtual #158                // Method java/lang/Number.longValue:()J
      72: lstore        10
      74: aload         8
      76: invokevirtual #161                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      79: checkcast     #154                // class java/lang/Number
      82: invokevirtual #158                // Method java/lang/Number.longValue:()J
      85: lstore        12
      87: iconst_0
      88: istore        14
      90: lconst_0
      91: lstore        15
      93: lload         15
      95: lload         10
      97: lcmp
      98: ifge          127
     101: aload_0
     102: lload         15
     104: lload         10
     106: invokespecial #163                // Method chargeToDistance:(JJ)J
     109: lload         12
     111: lcmp
     112: ifle          118
     115: iinc          14, 1
     118: lload         15
     120: lconst_1
     121: ladd
     122: lstore        15
     124: goto          93
     127: iload_3
     128: ifne          136
     131: iload         14
     133: goto          140
     136: iload_3
     137: iload         14
     139: imul
     140: istore_3
     141: nop
     142: nop
     143: goto          32
     146: nop
     147: iload_3
     148: ireturn

  private final kotlin.Pair<java.lang.Long, java.lang.Long> getResult(java.lang.String);
    Code:
       0: new           #179                // class kotlin/jvm/internal/Ref$LongRef
       3: dup
       4: invokespecial #180                // Method kotlin/jvm/internal/Ref$LongRef."<init>":()V
       7: astore_2
       8: new           #179                // class kotlin/jvm/internal/Ref$LongRef
      11: dup
      12: invokespecial #180                // Method kotlin/jvm/internal/Ref$LongRef."<init>":()V
      15: astore_3
      16: new           #31                 // class java/io/File
      19: dup
      20: aload_0
      21: invokevirtual #35                 // Method java/lang/Object.getClass:()Ljava/lang/Class;
      24: aload_1
      25: invokevirtual #41                 // Method java/lang/Class.getResource:(Ljava/lang/String;)Ljava/net/URL;
      28: dup
      29: invokestatic  #47                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      32: invokevirtual #53                 // Method java/net/URL.getFile:()Ljava/lang/String;
      35: invokespecial #56                 // Method java/io/File."<init>":(Ljava/lang/String;)V
      38: aconst_null
      39: aload_2
      40: aload_3
      41: invokedynamic #188,  0            // InvokeDynamic #1:invoke:(Lkotlin/jvm/internal/Ref$LongRef;Lkotlin/jvm/internal/Ref$LongRef;)Lkotlin/jvm/functions/Function1;
      46: iconst_1
      47: aconst_null
      48: invokestatic  #82                 // Method kotlin/io/FilesKt.forEachLine$default:(Ljava/io/File;Ljava/nio/charset/Charset;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
      51: new           #102                // class kotlin/Pair
      54: dup
      55: aload_2
      56: getfield      #191                // Field kotlin/jvm/internal/Ref$LongRef.element:J
      59: invokestatic  #197                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      62: aload_3
      63: getfield      #191                // Field kotlin/jvm/internal/Ref$LongRef.element:J
      66: invokestatic  #197                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      69: invokespecial #109                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
      72: areturn

  public final int getWaysToWin2(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #127                // String filename
       3: invokestatic  #131                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: invokespecial #201                // Method getResult:(Ljava/lang/String;)Lkotlin/Pair;
      11: astore_2
      12: iconst_0
      13: istore_3
      14: lconst_0
      15: lstore        4
      17: aload_2
      18: invokevirtual #152                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      21: checkcast     #154                // class java/lang/Number
      24: invokevirtual #158                // Method java/lang/Number.longValue:()J
      27: lstore        6
      29: lload         4
      31: lload         6
      33: lcmp
      34: ifge          79
      37: aload_0
      38: lload         4
      40: aload_2
      41: invokevirtual #152                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      44: checkcast     #154                // class java/lang/Number
      47: invokevirtual #158                // Method java/lang/Number.longValue:()J
      50: invokespecial #163                // Method chargeToDistance:(JJ)J
      53: aload_2
      54: invokevirtual #161                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      57: checkcast     #154                // class java/lang/Number
      60: invokevirtual #158                // Method java/lang/Number.longValue:()J
      63: lcmp
      64: ifle          70
      67: iinc          3, 1
      70: lload         4
      72: lconst_1
      73: ladd
      74: lstore        4
      76: goto          29
      79: iload_3
      80: ireturn

  private static final long getBestResults$lambda$2$lambda$0(kotlin.text.MatchResult);
    Code:
       0: aload_0
       1: ldc           #206                // String it
       3: invokestatic  #131                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokeinterface #211,  1          // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;
      12: invokestatic  #215                // Method java/lang/Long.parseLong:(Ljava/lang/String;)J
      15: lreturn

  private static final long getBestResults$lambda$2$lambda$1(kotlin.text.MatchResult);
    Code:
       0: aload_0
       1: ldc           #206                // String it
       3: invokestatic  #131                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokeinterface #211,  1          // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;
      12: invokestatic  #215                // Method java/lang/Long.parseLong:(Ljava/lang/String;)J
      15: lreturn

  private static final kotlin.Unit getBestResults$lambda$2(java.util.List, java.util.List, java.lang.String);
    Code:
       0: aload_2
       1: ldc           #219                // String line
       3: invokestatic  #131                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: checkcast     #221                // class java/lang/CharSequence
      10: iconst_1
      11: anewarray     #123                // class java/lang/String
      14: astore        4
      16: aload         4
      18: iconst_0
      19: ldc           #223                // String :
      21: aastore
      22: aload         4
      24: iconst_0
      25: iconst_0
      26: bipush        6
      28: aconst_null
      29: invokestatic  #229                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      32: astore_3
      33: aload_3
      34: iconst_0
      35: invokeinterface #106,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      40: checkcast     #123                // class java/lang/String
      43: astore        4
      45: aload         4
      47: ldc           #231                // String Time
      49: invokestatic  #235                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      52: ifeq          105
      55: aload_0
      56: checkcast     #100                // class java/util/Collection
      59: new           #237                // class kotlin/text/Regex
      62: dup
      63: ldc           #239                // String \\d+
      65: invokespecial #240                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      68: aload_3
      69: iconst_1
      70: invokeinterface #106,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      75: checkcast     #221                // class java/lang/CharSequence
      78: iconst_0
      79: iconst_2
      80: aconst_null
      81: invokestatic  #244                // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;
      84: invokedynamic #252,  0            // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function1;
      89: invokestatic  #258                // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      92: invokestatic  #262                // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;
      95: checkcast     #135                // class java/lang/Iterable
      98: invokestatic  #268                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     101: pop
     102: goto          163
     105: aload         4
     107: ldc_w         #270                // String Distance
     110: invokestatic  #235                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     113: ifeq          163
     116: aload_1
     117: checkcast     #100                // class java/util/Collection
     120: new           #237                // class kotlin/text/Regex
     123: dup
     124: ldc           #239                // String \\d+
     126: invokespecial #240                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
     129: aload_3
     130: iconst_1
     131: invokeinterface #106,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     136: checkcast     #221                // class java/lang/CharSequence
     139: iconst_0
     140: iconst_2
     141: aconst_null
     142: invokestatic  #244                // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;
     145: invokedynamic #274,  0            // InvokeDynamic #3:invoke:()Lkotlin/jvm/functions/Function1;
     150: invokestatic  #258                // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
     153: invokestatic  #262                // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;
     156: checkcast     #135                // class java/lang/Iterable
     159: invokestatic  #268                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     162: pop
     163: getstatic     #280                // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
     166: areturn

  private static final kotlin.Unit getResult$lambda$4(kotlin.jvm.internal.Ref$LongRef, kotlin.jvm.internal.Ref$LongRef, java.lang.String);
    Code:
       0: aload_2
       1: ldc           #219                // String line
       3: invokestatic  #131                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: checkcast     #221                // class java/lang/CharSequence
      10: iconst_1
      11: anewarray     #123                // class java/lang/String
      14: astore        4
      16: aload         4
      18: iconst_0
      19: ldc           #223                // String :
      21: aastore
      22: aload         4
      24: iconst_0
      25: iconst_0
      26: bipush        6
      28: aconst_null
      29: invokestatic  #229                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      32: astore_3
      33: aload_3
      34: iconst_0
      35: invokeinterface #106,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      40: checkcast     #123                // class java/lang/String
      43: astore        4
      45: aload         4
      47: ldc           #231                // String Time
      49: invokestatic  #235                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      52: ifeq          87
      55: aload_0
      56: aload_3
      57: iconst_1
      58: invokeinterface #106,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      63: checkcast     #123                // class java/lang/String
      66: ldc_w         #285                // String
      69: ldc_w         #287                // String
      72: iconst_0
      73: iconst_4
      74: aconst_null
      75: invokestatic  #291                // Method kotlin/text/StringsKt.replace$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Ljava/lang/String;
      78: invokestatic  #215                // Method java/lang/Long.parseLong:(Ljava/lang/String;)J
      81: putfield      #191                // Field kotlin/jvm/internal/Ref$LongRef.element:J
      84: goto          127
      87: aload         4
      89: ldc_w         #270                // String Distance
      92: invokestatic  #235                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      95: ifeq          127
      98: aload_1
      99: aload_3
     100: iconst_1
     101: invokeinterface #106,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     106: checkcast     #123                // class java/lang/String
     109: ldc_w         #285                // String
     112: ldc_w         #287                // String
     115: iconst_0
     116: iconst_4
     117: aconst_null
     118: invokestatic  #291                // Method kotlin/text/StringsKt.replace$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Ljava/lang/String;
     121: invokestatic  #215                // Method java/lang/Long.parseLong:(Ljava/lang/String;)J
     124: putfield      #191                // Field kotlin/jvm/internal/Ref$LongRef.element:J
     127: getstatic     #280                // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
     130: areturn
}