import kotlin.math.abs

class Day09 {

    fun part1(input: List<String>): Int {
        val movement = input.map { it.split(" ") }
            .flatMap { (direction, step) -> (1..step.toInt()).map { direction.toDirection() } }
        return simulateMoves(movement, 2).size
    }

    fun part2(input: List<String>): Int {
        val movement = input.map { it.split(" ") }
            .flatMap { (direction, step) -> (1..step.toInt()).map { direction.toDirection() } }
        return simulateMoves(movement, 10).size
    }

    private fun simulateMoves(moves: List<Direction>, knotsNumber: Int): Set<Point> {
        val knots = MutableList(knotsNumber) { Point(0, 0) }
        val visitedTail = mutableSetOf<Point>()
        visitedTail.add(knots.last())

        moves.forEach { direction ->
            knots[0] = knots[0].move(direction)
            for ((headIndex, tailIndex) in knots.indices.zipWithNext()) {
                val head = knots[headIndex]
                val tail = knots[tailIndex]
                if (!tail.isAdjacentTo(head)) {
                    knots[tailIndex] = tail.moveTowards(head)
                }
            }
            visitedTail.add(knots.last())
        }

        return visitedTail
    }

    private fun Point.move(direction: Direction): Point {
        return when (direction) {
            Direction.UP -> Point(x, y + 1)
            Direction.DOWN -> Point(x, y - 1)
            Direction.LEFT -> Point(x - 1, y)
            Direction.RIGHT -> Point(x + 1, y)
        }
    }

    private fun Point.isAdjacentTo(other: Point): Boolean {
        return abs(x - other.x) <= 1 && abs(y - other.y) <= 1
    }

    private fun Point.moveTowards(head: Point): Point {
        return Point(
            x + (head.x - x).coerceIn(-1..1),
            y + (head.y - y).coerceIn(-1..1)
        )
    }

    data class Point(val x: Int, val y: Int)

    enum class Direction { UP, DOWN, LEFT, RIGHT }

    private fun String.toDirection(): Direction {
        return when (this) {
            "U" -> Direction.UP
            "D" -> Direction.DOWN
            "L" -> Direction.LEFT
            "R" -> Direction.RIGHT
            else -> error("wrong direction $this")
        }
    }

}

Compiled from "Day09.kt"
public final class Day09$WhenMappings {
  public static final int[] $EnumSwitchMapping$0;

  static {};
    Code:
       0: invokestatic  #14                 // Method Day09$Direction.values:()[LDay09$Direction;
       3: arraylength
       4: newarray       int
       6: astore_0
       7: nop
       8: aload_0
       9: getstatic     #18                 // Field Day09$Direction.UP:LDay09$Direction;
      12: invokevirtual #22                 // Method Day09$Direction.ordinal:()I
      15: iconst_1
      16: iastore
      17: goto          21
      20: astore_1
      21: nop
      22: aload_0
      23: getstatic     #25                 // Field Day09$Direction.DOWN:LDay09$Direction;
      26: invokevirtual #22                 // Method Day09$Direction.ordinal:()I
      29: iconst_2
      30: iastore
      31: goto          35
      34: astore_1
      35: nop
      36: aload_0
      37: getstatic     #28                 // Field Day09$Direction.LEFT:LDay09$Direction;
      40: invokevirtual #22                 // Method Day09$Direction.ordinal:()I
      43: iconst_3
      44: iastore
      45: goto          49
      48: astore_1
      49: nop
      50: aload_0
      51: getstatic     #31                 // Field Day09$Direction.RIGHT:LDay09$Direction;
      54: invokevirtual #22                 // Method Day09$Direction.ordinal:()I
      57: iconst_4
      58: iastore
      59: goto          63
      62: astore_1
      63: aload_0
      64: putstatic     #35                 // Field $EnumSwitchMapping$0:[I
      67: return
    Exception table:
       from    to  target type
           7    17    20   Class java/lang/NoSuchFieldError
          21    31    34   Class java/lang/NoSuchFieldError
          35    45    48   Class java/lang/NoSuchFieldError
          49    59    62   Class java/lang/NoSuchFieldError
}

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

  public final int part1(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #16                 // String input
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #24                 // class java/lang/Iterable
      10: astore_3
      11: iconst_0
      12: istore        4
      14: aload_3
      15: astore        5
      17: new           #26                 // class java/util/ArrayList
      20: dup
      21: aload_3
      22: bipush        10
      24: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      27: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
      30: checkcast     #37                 // class java/util/Collection
      33: astore        6
      35: iconst_0
      36: istore        7
      38: aload         5
      40: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      45: astore        8
      47: aload         8
      49: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      54: ifeq          119
      57: aload         8
      59: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      64: astore        9
      66: aload         6
      68: aload         9
      70: checkcast     #53                 // class java/lang/String
      73: astore        10
      75: astore        24
      77: iconst_0
      78: istore        11
      80: aload         10
      82: checkcast     #55                 // class java/lang/CharSequence
      85: iconst_1
      86: anewarray     #53                 // class java/lang/String
      89: astore        12
      91: aload         12
      93: iconst_0
      94: ldc           #57                 // String
      96: aastore
      97: aload         12
      99: iconst_0
     100: iconst_0
     101: bipush        6
     103: aconst_null
     104: invokestatic  #63                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     107: aload         24
     109: swap
     110: invokeinterface #67,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     115: pop
     116: goto          47
     119: aload         6
     121: checkcast     #69                 // class java/util/List
     124: nop
     125: checkcast     #24                 // class java/lang/Iterable
     128: astore_3
     129: nop
     130: iconst_0
     131: istore        4
     133: aload_3
     134: astore        5
     136: new           #26                 // class java/util/ArrayList
     139: dup
     140: invokespecial #70                 // Method java/util/ArrayList."<init>":()V
     143: checkcast     #37                 // class java/util/Collection
     146: astore        6
     148: iconst_0
     149: istore        7
     151: aload         5
     153: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     158: astore        8
     160: aload         8
     162: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     167: ifeq          343
     170: aload         8
     172: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     177: astore        9
     179: aload         9
     181: checkcast     #69                 // class java/util/List
     184: astore        10
     186: iconst_0
     187: istore        11
     189: aload         10
     191: iconst_0
     192: invokeinterface #74,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     197: checkcast     #53                 // class java/lang/String
     200: astore        12
     202: aload         10
     204: iconst_1
     205: invokeinterface #74,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     210: checkcast     #53                 // class java/lang/String
     213: astore        13
     215: new           #76                 // class kotlin/ranges/IntRange
     218: dup
     219: iconst_1
     220: aload         13
     222: invokestatic  #82                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     225: invokespecial #85                 // Method kotlin/ranges/IntRange."<init>":(II)V
     228: checkcast     #24                 // class java/lang/Iterable
     231: astore        14
     233: iconst_0
     234: istore        15
     236: aload         14
     238: astore        16
     240: new           #26                 // class java/util/ArrayList
     243: dup
     244: aload         14
     246: bipush        10
     248: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     251: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
     254: checkcast     #37                 // class java/util/Collection
     257: astore        17
     259: iconst_0
     260: istore        18
     262: aload         16
     264: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     269: astore        19
     271: aload         19
     273: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     278: ifeq          320
     281: aload         19
     283: checkcast     #87                 // class kotlin/collections/IntIterator
     286: invokevirtual #91                 // Method kotlin/collections/IntIterator.nextInt:()I
     289: istore        20
     291: aload         17
     293: iload         20
     295: istore        21
     297: astore        22
     299: iconst_0
     300: istore        23
     302: aload_0
     303: aload         12
     305: invokespecial #95                 // Method toDirection:(Ljava/lang/String;)LDay09$Direction;
     308: aload         22
     310: swap
     311: invokeinterface #67,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     316: pop
     317: goto          271
     320: aload         17
     322: checkcast     #69                 // class java/util/List
     325: nop
     326: checkcast     #24                 // class java/lang/Iterable
     329: nop
     330: astore        10
     332: aload         6
     334: aload         10
     336: invokestatic  #99                 // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     339: pop
     340: goto          160
     343: aload         6
     345: checkcast     #69                 // class java/util/List
     348: nop
     349: astore_2
     350: aload_0
     351: aload_2
     352: iconst_2
     353: invokespecial #103                // Method simulateMoves:(Ljava/util/List;I)Ljava/util/Set;
     356: invokeinterface #108,  1          // InterfaceMethod java/util/Set.size:()I
     361: ireturn

  public final int part2(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #16                 // String input
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #24                 // class java/lang/Iterable
      10: astore_3
      11: iconst_0
      12: istore        4
      14: aload_3
      15: astore        5
      17: new           #26                 // class java/util/ArrayList
      20: dup
      21: aload_3
      22: bipush        10
      24: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      27: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
      30: checkcast     #37                 // class java/util/Collection
      33: astore        6
      35: iconst_0
      36: istore        7
      38: aload         5
      40: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      45: astore        8
      47: aload         8
      49: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      54: ifeq          119
      57: aload         8
      59: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      64: astore        9
      66: aload         6
      68: aload         9
      70: checkcast     #53                 // class java/lang/String
      73: astore        10
      75: astore        24
      77: iconst_0
      78: istore        11
      80: aload         10
      82: checkcast     #55                 // class java/lang/CharSequence
      85: iconst_1
      86: anewarray     #53                 // class java/lang/String
      89: astore        12
      91: aload         12
      93: iconst_0
      94: ldc           #57                 // String
      96: aastore
      97: aload         12
      99: iconst_0
     100: iconst_0
     101: bipush        6
     103: aconst_null
     104: invokestatic  #63                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     107: aload         24
     109: swap
     110: invokeinterface #67,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     115: pop
     116: goto          47
     119: aload         6
     121: checkcast     #69                 // class java/util/List
     124: nop
     125: checkcast     #24                 // class java/lang/Iterable
     128: astore_3
     129: nop
     130: iconst_0
     131: istore        4
     133: aload_3
     134: astore        5
     136: new           #26                 // class java/util/ArrayList
     139: dup
     140: invokespecial #70                 // Method java/util/ArrayList."<init>":()V
     143: checkcast     #37                 // class java/util/Collection
     146: astore        6
     148: iconst_0
     149: istore        7
     151: aload         5
     153: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     158: astore        8
     160: aload         8
     162: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     167: ifeq          343
     170: aload         8
     172: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     177: astore        9
     179: aload         9
     181: checkcast     #69                 // class java/util/List
     184: astore        10
     186: iconst_0
     187: istore        11
     189: aload         10
     191: iconst_0
     192: invokeinterface #74,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     197: checkcast     #53                 // class java/lang/String
     200: astore        12
     202: aload         10
     204: iconst_1
     205: invokeinterface #74,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     210: checkcast     #53                 // class java/lang/String
     213: astore        13
     215: new           #76                 // class kotlin/ranges/IntRange
     218: dup
     219: iconst_1
     220: aload         13
     222: invokestatic  #82                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     225: invokespecial #85                 // Method kotlin/ranges/IntRange."<init>":(II)V
     228: checkcast     #24                 // class java/lang/Iterable
     231: astore        14
     233: iconst_0
     234: istore        15
     236: aload         14
     238: astore        16
     240: new           #26                 // class java/util/ArrayList
     243: dup
     244: aload         14
     246: bipush        10
     248: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     251: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
     254: checkcast     #37                 // class java/util/Collection
     257: astore        17
     259: iconst_0
     260: istore        18
     262: aload         16
     264: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     269: astore        19
     271: aload         19
     273: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     278: ifeq          320
     281: aload         19
     283: checkcast     #87                 // class kotlin/collections/IntIterator
     286: invokevirtual #91                 // Method kotlin/collections/IntIterator.nextInt:()I
     289: istore        20
     291: aload         17
     293: iload         20
     295: istore        21
     297: astore        22
     299: iconst_0
     300: istore        23
     302: aload_0
     303: aload         12
     305: invokespecial #95                 // Method toDirection:(Ljava/lang/String;)LDay09$Direction;
     308: aload         22
     310: swap
     311: invokeinterface #67,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     316: pop
     317: goto          271
     320: aload         17
     322: checkcast     #69                 // class java/util/List
     325: nop
     326: checkcast     #24                 // class java/lang/Iterable
     329: nop
     330: astore        10
     332: aload         6
     334: aload         10
     336: invokestatic  #99                 // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     339: pop
     340: goto          160
     343: aload         6
     345: checkcast     #69                 // class java/util/List
     348: nop
     349: astore_2
     350: aload_0
     351: aload_2
     352: bipush        10
     354: invokespecial #103                // Method simulateMoves:(Ljava/util/List;I)Ljava/util/Set;
     357: invokeinterface #108,  1          // InterfaceMethod java/util/Set.size:()I
     362: ireturn

  private final java.util.Set<Day09$Point> simulateMoves(java.util.List<? extends Day09$Direction>, int);
    Code:
       0: new           #26                 // class java/util/ArrayList
       3: dup
       4: iload_2
       5: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
       8: astore        4
      10: iconst_0
      11: istore        5
      13: iload         5
      15: iload_2
      16: if_icmpge     56
      19: iload         5
      21: istore        6
      23: aload         4
      25: iload         6
      27: istore        7
      29: astore        17
      31: iconst_0
      32: istore        8
      34: new           #140                // class Day09$Point
      37: dup
      38: iconst_0
      39: iconst_0
      40: invokespecial #141                // Method Day09$Point."<init>":(II)V
      43: aload         17
      45: swap
      46: invokevirtual #142                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      49: pop
      50: iinc          5, 1
      53: goto          13
      56: aload         4
      58: checkcast     #69                 // class java/util/List
      61: astore_3
      62: new           #144                // class java/util/LinkedHashSet
      65: dup
      66: invokespecial #145                // Method java/util/LinkedHashSet."<init>":()V
      69: checkcast     #105                // class java/util/Set
      72: astore        4
      74: aload         4
      76: aload_3
      77: invokestatic  #149                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
      80: invokeinterface #150,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
      85: pop
      86: aload_1
      87: checkcast     #24                 // class java/lang/Iterable
      90: astore        5
      92: iconst_0
      93: istore        6
      95: aload         5
      97: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     102: astore        7
     104: aload         7
     106: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     111: ifeq          299
     114: aload         7
     116: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     121: astore        8
     123: aload         8
     125: checkcast     #152                // class Day09$Direction
     128: astore        9
     130: iconst_0
     131: istore        10
     133: aload_3
     134: iconst_0
     135: aload_0
     136: aload_3
     137: iconst_0
     138: invokeinterface #74,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     143: checkcast     #140                // class Day09$Point
     146: aload         9
     148: invokespecial #156                // Method move:(LDay09$Point;LDay09$Direction;)LDay09$Point;
     151: invokeinterface #160,  3          // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;
     156: pop
     157: aload_3
     158: checkcast     #37                 // class java/util/Collection
     161: invokestatic  #164                // Method kotlin/collections/CollectionsKt.getIndices:(Ljava/util/Collection;)Lkotlin/ranges/IntRange;
     164: checkcast     #24                 // class java/lang/Iterable
     167: invokestatic  #168                // Method kotlin/collections/CollectionsKt.zipWithNext:(Ljava/lang/Iterable;)Ljava/util/List;
     170: invokeinterface #169,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     175: astore        11
     177: aload         11
     179: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     184: ifeq          282
     187: aload         11
     189: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     194: checkcast     #171                // class kotlin/Pair
     197: astore        12
     199: aload         12
     201: invokevirtual #174                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     204: checkcast     #176                // class java/lang/Number
     207: invokevirtual #179                // Method java/lang/Number.intValue:()I
     210: istore        13
     212: aload         12
     214: invokevirtual #182                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     217: checkcast     #176                // class java/lang/Number
     220: invokevirtual #179                // Method java/lang/Number.intValue:()I
     223: istore        14
     225: aload_3
     226: iload         13
     228: invokeinterface #74,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     233: checkcast     #140                // class Day09$Point
     236: astore        15
     238: aload_3
     239: iload         14
     241: invokeinterface #74,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     246: checkcast     #140                // class Day09$Point
     249: astore        16
     251: aload_0
     252: aload         16
     254: aload         15
     256: invokespecial #186                // Method isAdjacentTo:(LDay09$Point;LDay09$Point;)Z
     259: ifne          177
     262: aload_3
     263: iload         14
     265: aload_0
     266: aload         16
     268: aload         15
     270: invokespecial #190                // Method moveTowards:(LDay09$Point;LDay09$Point;)LDay09$Point;
     273: invokeinterface #160,  3          // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;
     278: pop
     279: goto          177
     282: aload         4
     284: aload_3
     285: invokestatic  #149                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     288: invokeinterface #150,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
     293: pop
     294: nop
     295: nop
     296: goto          104
     299: nop
     300: aload         4
     302: areturn

  private final Day09$Point move(Day09$Point, Day09$Direction);
    Code:
       0: aload_2
       1: getstatic     #212                // Field Day09$WhenMappings.$EnumSwitchMapping$0:[I
       4: swap
       5: invokevirtual #215                // Method Day09$Direction.ordinal:()I
       8: iaload
       9: tableswitch   { // 1 to 4
                     1: 40
                     2: 60
                     3: 80
                     4: 100
               default: 120
          }
      40: new           #140                // class Day09$Point
      43: dup
      44: aload_1
      45: invokevirtual #218                // Method Day09$Point.getX:()I
      48: aload_1
      49: invokevirtual #221                // Method Day09$Point.getY:()I
      52: iconst_1
      53: iadd
      54: invokespecial #141                // Method Day09$Point."<init>":(II)V
      57: goto          128
      60: new           #140                // class Day09$Point
      63: dup
      64: aload_1
      65: invokevirtual #218                // Method Day09$Point.getX:()I
      68: aload_1
      69: invokevirtual #221                // Method Day09$Point.getY:()I
      72: iconst_1
      73: isub
      74: invokespecial #141                // Method Day09$Point."<init>":(II)V
      77: goto          128
      80: new           #140                // class Day09$Point
      83: dup
      84: aload_1
      85: invokevirtual #218                // Method Day09$Point.getX:()I
      88: iconst_1
      89: isub
      90: aload_1
      91: invokevirtual #221                // Method Day09$Point.getY:()I
      94: invokespecial #141                // Method Day09$Point."<init>":(II)V
      97: goto          128
     100: new           #140                // class Day09$Point
     103: dup
     104: aload_1
     105: invokevirtual #218                // Method Day09$Point.getX:()I
     108: iconst_1
     109: iadd
     110: aload_1
     111: invokevirtual #221                // Method Day09$Point.getY:()I
     114: invokespecial #141                // Method Day09$Point."<init>":(II)V
     117: goto          128
     120: new           #223                // class kotlin/NoWhenBranchMatchedException
     123: dup
     124: invokespecial #224                // Method kotlin/NoWhenBranchMatchedException."<init>":()V
     127: athrow
     128: areturn

  private final boolean isAdjacentTo(Day09$Point, Day09$Point);
    Code:
       0: aload_1
       1: invokevirtual #218                // Method Day09$Point.getX:()I
       4: aload_2
       5: invokevirtual #218                // Method Day09$Point.getX:()I
       8: isub
       9: invokestatic  #231                // Method java/lang/Math.abs:(I)I
      12: iconst_1
      13: if_icmpgt     36
      16: aload_1
      17: invokevirtual #221                // Method Day09$Point.getY:()I
      20: aload_2
      21: invokevirtual #221                // Method Day09$Point.getY:()I
      24: isub
      25: invokestatic  #231                // Method java/lang/Math.abs:(I)I
      28: iconst_1
      29: if_icmpgt     36
      32: iconst_1
      33: goto          37
      36: iconst_0
      37: ireturn

  private final Day09$Point moveTowards(Day09$Point, Day09$Point);
    Code:
       0: new           #140                // class Day09$Point
       3: dup
       4: aload_1
       5: invokevirtual #218                // Method Day09$Point.getX:()I
       8: aload_2
       9: invokevirtual #218                // Method Day09$Point.getX:()I
      12: aload_1
      13: invokevirtual #218                // Method Day09$Point.getX:()I
      16: isub
      17: new           #76                 // class kotlin/ranges/IntRange
      20: dup
      21: iconst_m1
      22: iconst_1
      23: invokespecial #85                 // Method kotlin/ranges/IntRange."<init>":(II)V
      26: checkcast     #235                // class kotlin/ranges/ClosedRange
      29: invokestatic  #241                // Method kotlin/ranges/RangesKt.coerceIn:(ILkotlin/ranges/ClosedRange;)I
      32: iadd
      33: aload_1
      34: invokevirtual #221                // Method Day09$Point.getY:()I
      37: aload_2
      38: invokevirtual #221                // Method Day09$Point.getY:()I
      41: aload_1
      42: invokevirtual #221                // Method Day09$Point.getY:()I
      45: isub
      46: new           #76                 // class kotlin/ranges/IntRange
      49: dup
      50: iconst_m1
      51: iconst_1
      52: invokespecial #85                 // Method kotlin/ranges/IntRange."<init>":(II)V
      55: checkcast     #235                // class kotlin/ranges/ClosedRange
      58: invokestatic  #241                // Method kotlin/ranges/RangesKt.coerceIn:(ILkotlin/ranges/ClosedRange;)I
      61: iadd
      62: invokespecial #141                // Method Day09$Point."<init>":(II)V
      65: areturn

  private final Day09$Direction toDirection(java.lang.String);
    Code:
       0: aload_1
       1: astore_2
       2: aload_2
       3: invokevirtual #245                // Method java/lang/String.hashCode:()I
       6: lookupswitch  { // 4
                    68: 60
                    76: 84
                    82: 48
                    85: 72
               default: 121
          }
      48: aload_2
      49: ldc           #247                // String R
      51: invokevirtual #250                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
      54: ifne          115
      57: goto          121
      60: aload_2
      61: ldc           #252                // String D
      63: invokevirtual #250                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
      66: ifne          103
      69: goto          121
      72: aload_2
      73: ldc           #254                // String U
      75: invokevirtual #250                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
      78: ifne          97
      81: goto          121
      84: aload_2
      85: ldc_w         #256                // String L
      88: invokevirtual #250                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
      91: ifne          109
      94: goto          121
      97: getstatic     #259                // Field Day09$Direction.UP:LDay09$Direction;
     100: goto          152
     103: getstatic     #262                // Field Day09$Direction.DOWN:LDay09$Direction;
     106: goto          152
     109: getstatic     #265                // Field Day09$Direction.LEFT:LDay09$Direction;
     112: goto          152
     115: getstatic     #268                // Field Day09$Direction.RIGHT:LDay09$Direction;
     118: goto          152
     121: new           #270                // class java/lang/IllegalStateException
     124: dup
     125: new           #272                // class java/lang/StringBuilder
     128: dup
     129: invokespecial #273                // Method java/lang/StringBuilder."<init>":()V
     132: ldc_w         #275                // String wrong direction
     135: invokevirtual #279                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     138: aload_1
     139: invokevirtual #279                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     142: invokevirtual #283                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     145: invokevirtual #284                // Method java/lang/Object.toString:()Ljava/lang/String;
     148: invokespecial #287                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     151: athrow
     152: areturn
}

Compiled from "Day09.kt"
public final class Day09$Direction extends java.lang.Enum<Day09$Direction> {
  public static final Day09$Direction UP;

  public static final Day09$Direction DOWN;

  public static final Day09$Direction LEFT;

  public static final Day09$Direction RIGHT;

  private static final Day09$Direction[] $VALUES;

  private static final kotlin.enums.EnumEntries $ENTRIES;

  private Day09$Direction();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: invokespecial #10                 // Method java/lang/Enum."<init>":(Ljava/lang/String;I)V
       6: return

  public static Day09$Direction[] values();
    Code:
       0: getstatic     #22                 // Field $VALUES:[LDay09$Direction;
       3: invokevirtual #28                 // Method java/lang/Object.clone:()Ljava/lang/Object;
       6: checkcast     #29                 // class "[LDay09$Direction;"
       9: areturn

  public static Day09$Direction valueOf(java.lang.String);
    Code:
       0: ldc           #2                  // class Day09$Direction
       2: aload_0
       3: invokestatic  #34                 // Method java/lang/Enum.valueOf:(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;
       6: checkcast     #2                  // class Day09$Direction
       9: areturn

  public static kotlin.enums.EnumEntries<Day09$Direction> getEntries();
    Code:
       0: getstatic     #43                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
       3: areturn

  private static final Day09$Direction[] $values();
    Code:
       0: iconst_4
       1: anewarray     #2                  // class Day09$Direction
       4: astore_0
       5: aload_0
       6: iconst_0
       7: getstatic     #47                 // Field UP:LDay09$Direction;
      10: aastore
      11: aload_0
      12: iconst_1
      13: getstatic     #50                 // Field DOWN:LDay09$Direction;
      16: aastore
      17: aload_0
      18: iconst_2
      19: getstatic     #53                 // Field LEFT:LDay09$Direction;
      22: aastore
      23: aload_0
      24: iconst_3
      25: getstatic     #56                 // Field RIGHT:LDay09$Direction;
      28: aastore
      29: aload_0
      30: areturn

  static {};
    Code:
       0: new           #2                  // class Day09$Direction
       3: dup
       4: ldc           #58                 // String UP
       6: iconst_0
       7: invokespecial #59                 // Method "<init>":(Ljava/lang/String;I)V
      10: putstatic     #47                 // Field UP:LDay09$Direction;
      13: new           #2                  // class Day09$Direction
      16: dup
      17: ldc           #60                 // String DOWN
      19: iconst_1
      20: invokespecial #59                 // Method "<init>":(Ljava/lang/String;I)V
      23: putstatic     #50                 // Field DOWN:LDay09$Direction;
      26: new           #2                  // class Day09$Direction
      29: dup
      30: ldc           #61                 // String LEFT
      32: iconst_2
      33: invokespecial #59                 // Method "<init>":(Ljava/lang/String;I)V
      36: putstatic     #53                 // Field LEFT:LDay09$Direction;
      39: new           #2                  // class Day09$Direction
      42: dup
      43: ldc           #62                 // String RIGHT
      45: iconst_3
      46: invokespecial #59                 // Method "<init>":(Ljava/lang/String;I)V
      49: putstatic     #56                 // Field RIGHT:LDay09$Direction;
      52: invokestatic  #64                 // Method $values:()[LDay09$Direction;
      55: putstatic     #22                 // Field $VALUES:[LDay09$Direction;
      58: getstatic     #22                 // Field $VALUES:[LDay09$Direction;
      61: checkcast     #66                 // class "[Ljava/lang/Enum;"
      64: invokestatic  #72                 // Method kotlin/enums/EnumEntriesKt.enumEntries:([Ljava/lang/Enum;)Lkotlin/enums/EnumEntries;
      67: putstatic     #43                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
      70: return
}

Compiled from "Day09.kt"
public final class Day09$Point {
  private final int x;

  private final int y;

  public Day09$Point(int, int);
    Code:
       0: aload_0
       1: invokespecial #9                  // Method java/lang/Object."<init>":()V
       4: aload_0
       5: iload_1
       6: putfield      #13                 // Field x:I
       9: aload_0
      10: iload_2
      11: putfield      #16                 // Field y:I
      14: return

  public final int getX();
    Code:
       0: aload_0
       1: getfield      #13                 // Field x:I
       4: ireturn

  public final int getY();
    Code:
       0: aload_0
       1: getfield      #16                 // Field y:I
       4: ireturn

  public final int component1();
    Code:
       0: aload_0
       1: getfield      #13                 // Field x:I
       4: ireturn

  public final int component2();
    Code:
       0: aload_0
       1: getfield      #16                 // Field y:I
       4: ireturn

  public final Day09$Point copy(int, int);
    Code:
       0: new           #2                  // class Day09$Point
       3: dup
       4: iload_1
       5: iload_2
       6: invokespecial #28                 // Method "<init>":(II)V
       9: areturn

  public static Day09$Point copy$default(Day09$Point, int, int, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #13                 // Field x:I
      10: istore_1
      11: iload_3
      12: iconst_2
      13: iand
      14: ifeq          22
      17: aload_0
      18: getfield      #16                 // Field y:I
      21: istore_2
      22: aload_0
      23: iload_1
      24: iload_2
      25: invokevirtual #32                 // Method copy:(II)LDay09$Point;
      28: areturn

  public java.lang.String toString();
    Code:
       0: new           #36                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #37                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #39                 // String Point(x=
       9: invokevirtual #43                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #13                 // Field x:I
      16: invokevirtual #46                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: ldc           #48                 // String , y=
      21: invokevirtual #43                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #16                 // Field y:I
      28: invokevirtual #46                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: bipush        41
      33: invokevirtual #51                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      36: invokevirtual #53                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      39: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #13                 // Field x:I
       4: invokestatic  #59                 // Method java/lang/Integer.hashCode:(I)I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #16                 // Field y:I
      16: invokestatic  #59                 // Method java/lang/Integer.hashCode:(I)I
      19: iadd
      20: istore_1
      21: iload_1
      22: ireturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class Day09$Point
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Day09$Point
      20: astore_2
      21: aload_0
      22: getfield      #13                 // Field x:I
      25: aload_2
      26: getfield      #13                 // Field x:I
      29: if_icmpeq     34
      32: iconst_0
      33: ireturn
      34: aload_0
      35: getfield      #16                 // Field y:I
      38: aload_2
      39: getfield      #16                 // Field y:I
      42: if_icmpeq     47
      45: iconst_0
      46: ireturn
      47: iconst_1
      48: ireturn
}


class Day03 {

    fun part1(input: List<String>): Int {
        return input
            .map { Rucksack(it) }
            .flatMap { it.getCompartmentIntersection() }
            .sumOf { it.toPriorityScore() }
    }

    fun part2(input: List<String>): Int {
        return input
            .chunked(3)
            .map { (elf1, elf2, elf3) -> Triple(Rucksack(elf1), Rucksack(elf2), Rucksack(elf3)) }
            .map { it.first.getCompartmentIntersectionFrom(it.second, it.third).single() }
            .sumOf { it.toPriorityScore() }
    }

    class Rucksack(private val content: String) {

        fun getCompartmentIntersection(): Set<Char> {
            val splitIndex = if (content.length % 2 == 0) content.length / 2 else content.length / 2 + 1
            val first = content.take(splitIndex).toSet()
            val second = content.substring(splitIndex).toSet()
            return first.intersect(second)
        }

        fun getCompartmentIntersectionFrom(other: Rucksack, another: Rucksack): Set<Char> {
            return content.toSet()
                .intersect(other.content.toSet())
                .intersect(another.content.toSet())
        }
    }

    private fun Char.toPriorityScore(): Int {
        return when {
            //  Lowercase item types a through z have priorities 1 through 26.
            isLowerCase() -> this - 'a' + 1
            // Uppercase item types A through Z have priorities 27 through 52.
            isUpperCase() -> this - 'A' + 27
            else -> error("Wrong input")
        }
    }
}

Compiled from "Day03.kt"
public final class Day03$Rucksack {
  private final java.lang.String content;

  public Day03$Rucksack(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #9                  // String content
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #18                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: aload_1
      12: putfield      #21                 // Field content:Ljava/lang/String;
      15: return

  public final java.util.Set<java.lang.Character> getCompartmentIntersection();
    Code:
       0: aload_0
       1: getfield      #21                 // Field content:Ljava/lang/String;
       4: invokevirtual #32                 // Method java/lang/String.length:()I
       7: iconst_2
       8: irem
       9: ifne          24
      12: aload_0
      13: getfield      #21                 // Field content:Ljava/lang/String;
      16: invokevirtual #32                 // Method java/lang/String.length:()I
      19: iconst_2
      20: idiv
      21: goto          35
      24: aload_0
      25: getfield      #21                 // Field content:Ljava/lang/String;
      28: invokevirtual #32                 // Method java/lang/String.length:()I
      31: iconst_2
      32: idiv
      33: iconst_1
      34: iadd
      35: istore_1
      36: aload_0
      37: getfield      #21                 // Field content:Ljava/lang/String;
      40: iload_1
      41: invokestatic  #38                 // Method kotlin/text/StringsKt.take:(Ljava/lang/String;I)Ljava/lang/String;
      44: checkcast     #40                 // class java/lang/CharSequence
      47: invokestatic  #44                 // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;
      50: astore_2
      51: aload_0
      52: getfield      #21                 // Field content:Ljava/lang/String;
      55: iload_1
      56: invokevirtual #48                 // Method java/lang/String.substring:(I)Ljava/lang/String;
      59: dup
      60: ldc           #50                 // String substring(...)
      62: invokestatic  #53                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      65: checkcast     #40                 // class java/lang/CharSequence
      68: invokestatic  #44                 // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;
      71: astore_3
      72: aload_2
      73: checkcast     #55                 // class java/lang/Iterable
      76: aload_3
      77: checkcast     #55                 // class java/lang/Iterable
      80: invokestatic  #61                 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
      83: areturn

  public final java.util.Set<java.lang.Character> getCompartmentIntersectionFrom(Day03$Rucksack, Day03$Rucksack);
    Code:
       0: aload_1
       1: ldc           #71                 // String other
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #73                 // String another
       9: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: getfield      #21                 // Field content:Ljava/lang/String;
      16: checkcast     #40                 // class java/lang/CharSequence
      19: invokestatic  #44                 // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;
      22: checkcast     #55                 // class java/lang/Iterable
      25: aload_1
      26: getfield      #21                 // Field content:Ljava/lang/String;
      29: checkcast     #40                 // class java/lang/CharSequence
      32: invokestatic  #44                 // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;
      35: checkcast     #55                 // class java/lang/Iterable
      38: invokestatic  #61                 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
      41: checkcast     #55                 // class java/lang/Iterable
      44: aload_2
      45: getfield      #21                 // Field content:Ljava/lang/String;
      48: checkcast     #40                 // class java/lang/CharSequence
      51: invokestatic  #44                 // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;
      54: checkcast     #55                 // class java/lang/Iterable
      57: invokestatic  #61                 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
      60: areturn
}

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

  public final int part1(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #16                 // String input
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #24                 // class java/lang/Iterable
      10: astore_2
      11: nop
      12: iconst_0
      13: istore_3
      14: aload_2
      15: astore        4
      17: new           #26                 // class java/util/ArrayList
      20: dup
      21: aload_2
      22: bipush        10
      24: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      27: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
      30: checkcast     #37                 // class java/util/Collection
      33: astore        5
      35: iconst_0
      36: istore        6
      38: aload         4
      40: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      45: astore        7
      47: aload         7
      49: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      54: ifeq          101
      57: aload         7
      59: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      64: astore        8
      66: aload         5
      68: aload         8
      70: checkcast     #53                 // class java/lang/String
      73: astore        9
      75: astore        11
      77: iconst_0
      78: istore        10
      80: new           #55                 // class Day03$Rucksack
      83: dup
      84: aload         9
      86: invokespecial #58                 // Method Day03$Rucksack."<init>":(Ljava/lang/String;)V
      89: aload         11
      91: swap
      92: invokeinterface #62,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      97: pop
      98: goto          47
     101: aload         5
     103: checkcast     #64                 // class java/util/List
     106: nop
     107: checkcast     #24                 // class java/lang/Iterable
     110: astore_2
     111: nop
     112: iconst_0
     113: istore_3
     114: aload_2
     115: astore        4
     117: new           #26                 // class java/util/ArrayList
     120: dup
     121: invokespecial #65                 // Method java/util/ArrayList."<init>":()V
     124: checkcast     #37                 // class java/util/Collection
     127: astore        5
     129: iconst_0
     130: istore        6
     132: aload         4
     134: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     139: astore        7
     141: aload         7
     143: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     148: ifeq          191
     151: aload         7
     153: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     158: astore        8
     160: aload         8
     162: checkcast     #55                 // class Day03$Rucksack
     165: astore        9
     167: iconst_0
     168: istore        10
     170: aload         9
     172: invokevirtual #69                 // Method Day03$Rucksack.getCompartmentIntersection:()Ljava/util/Set;
     175: checkcast     #24                 // class java/lang/Iterable
     178: astore        9
     180: aload         5
     182: aload         9
     184: invokestatic  #73                 // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     187: pop
     188: goto          141
     191: aload         5
     193: checkcast     #64                 // class java/util/List
     196: nop
     197: checkcast     #24                 // class java/lang/Iterable
     200: astore_2
     201: iconst_0
     202: istore_3
     203: aload_2
     204: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     209: astore        4
     211: aload         4
     213: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     218: ifeq          263
     221: aload         4
     223: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     228: astore        5
     230: iload_3
     231: aload         5
     233: checkcast     #75                 // class java/lang/Character
     236: invokevirtual #79                 // Method java/lang/Character.charValue:()C
     239: istore        6
     241: istore        11
     243: iconst_0
     244: istore        7
     246: aload_0
     247: iload         6
     249: invokespecial #83                 // Method toPriorityScore:(C)I
     252: istore        12
     254: iload         11
     256: iload         12
     258: iadd
     259: istore_3
     260: goto          211
     263: iload_3
     264: ireturn

  public final int part2(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #16                 // String input
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #24                 // class java/lang/Iterable
      10: iconst_3
      11: invokestatic  #112                // Method kotlin/collections/CollectionsKt.chunked:(Ljava/lang/Iterable;I)Ljava/util/List;
      14: checkcast     #24                 // class java/lang/Iterable
      17: astore_2
      18: nop
      19: iconst_0
      20: istore_3
      21: aload_2
      22: astore        4
      24: new           #26                 // class java/util/ArrayList
      27: dup
      28: aload_2
      29: bipush        10
      31: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      34: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
      37: checkcast     #37                 // class java/util/Collection
      40: astore        5
      42: iconst_0
      43: istore        6
      45: aload         4
      47: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      52: astore        7
      54: aload         7
      56: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      61: ifeq          172
      64: aload         7
      66: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      71: astore        8
      73: aload         5
      75: aload         8
      77: checkcast     #64                 // class java/util/List
      80: astore        9
      82: astore        14
      84: iconst_0
      85: istore        10
      87: aload         9
      89: iconst_0
      90: invokeinterface #116,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      95: checkcast     #53                 // class java/lang/String
      98: astore        11
     100: aload         9
     102: iconst_1
     103: invokeinterface #116,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     108: checkcast     #53                 // class java/lang/String
     111: astore        12
     113: aload         9
     115: iconst_2
     116: invokeinterface #116,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     121: checkcast     #53                 // class java/lang/String
     124: astore        13
     126: new           #118                // class kotlin/Triple
     129: dup
     130: new           #55                 // class Day03$Rucksack
     133: dup
     134: aload         11
     136: invokespecial #58                 // Method Day03$Rucksack."<init>":(Ljava/lang/String;)V
     139: new           #55                 // class Day03$Rucksack
     142: dup
     143: aload         12
     145: invokespecial #58                 // Method Day03$Rucksack."<init>":(Ljava/lang/String;)V
     148: new           #55                 // class Day03$Rucksack
     151: dup
     152: aload         13
     154: invokespecial #58                 // Method Day03$Rucksack."<init>":(Ljava/lang/String;)V
     157: invokespecial #121                // Method kotlin/Triple."<init>":(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
     160: aload         14
     162: swap
     163: invokeinterface #62,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     168: pop
     169: goto          54
     172: aload         5
     174: checkcast     #64                 // class java/util/List
     177: nop
     178: checkcast     #24                 // class java/lang/Iterable
     181: astore_2
     182: nop
     183: iconst_0
     184: istore_3
     185: aload_2
     186: astore        4
     188: new           #26                 // class java/util/ArrayList
     191: dup
     192: aload_2
     193: bipush        10
     195: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     198: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
     201: checkcast     #37                 // class java/util/Collection
     204: astore        5
     206: iconst_0
     207: istore        6
     209: aload         4
     211: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     216: astore        7
     218: aload         7
     220: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     225: ifeq          305
     228: aload         7
     230: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     235: astore        8
     237: aload         5
     239: aload         8
     241: checkcast     #118                // class kotlin/Triple
     244: astore        9
     246: astore        14
     248: iconst_0
     249: istore        10
     251: aload         9
     253: invokevirtual #124                // Method kotlin/Triple.getFirst:()Ljava/lang/Object;
     256: checkcast     #55                 // class Day03$Rucksack
     259: aload         9
     261: invokevirtual #127                // Method kotlin/Triple.getSecond:()Ljava/lang/Object;
     264: checkcast     #55                 // class Day03$Rucksack
     267: aload         9
     269: invokevirtual #130                // Method kotlin/Triple.getThird:()Ljava/lang/Object;
     272: checkcast     #55                 // class Day03$Rucksack
     275: invokevirtual #134                // Method Day03$Rucksack.getCompartmentIntersectionFrom:(LDay03$Rucksack;LDay03$Rucksack;)Ljava/util/Set;
     278: checkcast     #24                 // class java/lang/Iterable
     281: invokestatic  #138                // Method kotlin/collections/CollectionsKt.single:(Ljava/lang/Iterable;)Ljava/lang/Object;
     284: checkcast     #75                 // class java/lang/Character
     287: invokevirtual #79                 // Method java/lang/Character.charValue:()C
     290: invokestatic  #142                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     293: aload         14
     295: swap
     296: invokeinterface #62,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     301: pop
     302: goto          218
     305: aload         5
     307: checkcast     #64                 // class java/util/List
     310: nop
     311: checkcast     #24                 // class java/lang/Iterable
     314: astore_2
     315: iconst_0
     316: istore_3
     317: aload_2
     318: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     323: astore        4
     325: aload         4
     327: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     332: ifeq          377
     335: aload         4
     337: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     342: astore        5
     344: iload_3
     345: aload         5
     347: checkcast     #75                 // class java/lang/Character
     350: invokevirtual #79                 // Method java/lang/Character.charValue:()C
     353: istore        6
     355: istore        14
     357: iconst_0
     358: istore        7
     360: aload_0
     361: iload         6
     363: invokespecial #83                 // Method toPriorityScore:(C)I
     366: istore        15
     368: iload         14
     370: iload         15
     372: iadd
     373: istore_3
     374: goto          325
     377: iload_3
     378: ireturn

  private final int toPriorityScore(char);
    Code:
       0: nop
       1: iload_1
       2: invokestatic  #153                // Method java/lang/Character.isLowerCase:(C)Z
       5: ifeq          17
       8: iload_1
       9: bipush        97
      11: isub
      12: iconst_1
      13: iadd
      14: goto          47
      17: iload_1
      18: invokestatic  #156                // Method java/lang/Character.isUpperCase:(C)Z
      21: ifeq          34
      24: iload_1
      25: bipush        65
      27: isub
      28: bipush        27
      30: iadd
      31: goto          47
      34: new           #158                // class java/lang/IllegalStateException
      37: dup
      38: ldc           #160                // String Wrong input
      40: invokevirtual #164                // Method java/lang/Object.toString:()Ljava/lang/String;
      43: invokespecial #165                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      46: athrow
      47: ireturn
}