fun main() {
    fun getPriority(ch: Char): Long {
        if (ch in 'A'..'Z') {
            return ch - 'A' + 27L
        }

        return ch - 'a' + 1L
    }

    fun part1(input: List<String>): Long {
        return input.sumOf { line ->
            line
                .chunkedSequence(line.length / 2)
                .map { it.toSet() }
                .reduce { acc, chars -> acc.intersect(chars) }
                .sumOf {
                    getPriority(it)
                }
        }
    }

    fun part2(input: List<String>): Long {
        return input
            .chunked(3)
            .sumOf { group ->
                group
                    .map { it.toSet() }
                    .reduce { acc, chars -> acc.intersect(chars) }
                    .sumOf {
                        getPriority(it)
                    }
            }
    }

    check(getPriority('a') == 1L)
    check(getPriority('z') == 26L)
    check(getPriority('A') == 27L)
    check(getPriority('Z') == 52L)

    val testInput = readInput("Day03_test")
    check(part1(testInput) == 157L)
    check(part2(testInput) == 70L)

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

Compiled from "Day03.kt"
public final class Day03Kt {
  public static final void main();
    Code:
       0: bipush        97
       2: invokestatic  #10                 // Method main$getPriority:(C)J
       5: lconst_1
       6: lcmp
       7: ifne          14
      10: iconst_1
      11: goto          15
      14: iconst_0
      15: ifne          28
      18: new           #12                 // class java/lang/IllegalStateException
      21: dup
      22: ldc           #14                 // String Check failed.
      24: invokespecial #18                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      27: athrow
      28: bipush        122
      30: invokestatic  #10                 // Method main$getPriority:(C)J
      33: ldc2_w        #19                 // long 26l
      36: lcmp
      37: ifne          44
      40: iconst_1
      41: goto          45
      44: iconst_0
      45: ifne          58
      48: new           #12                 // class java/lang/IllegalStateException
      51: dup
      52: ldc           #14                 // String Check failed.
      54: invokespecial #18                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      57: athrow
      58: bipush        65
      60: invokestatic  #10                 // Method main$getPriority:(C)J
      63: ldc2_w        #21                 // long 27l
      66: lcmp
      67: ifne          74
      70: iconst_1
      71: goto          75
      74: iconst_0
      75: ifne          88
      78: new           #12                 // class java/lang/IllegalStateException
      81: dup
      82: ldc           #14                 // String Check failed.
      84: invokespecial #18                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      87: athrow
      88: bipush        90
      90: invokestatic  #10                 // Method main$getPriority:(C)J
      93: ldc2_w        #23                 // long 52l
      96: lcmp
      97: ifne          104
     100: iconst_1
     101: goto          105
     104: iconst_0
     105: ifne          118
     108: new           #12                 // class java/lang/IllegalStateException
     111: dup
     112: ldc           #14                 // String Check failed.
     114: invokespecial #18                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     117: athrow
     118: ldc           #26                 // String Day03_test
     120: invokestatic  #32                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
     123: astore_0
     124: aload_0
     125: invokestatic  #36                 // Method main$part1:(Ljava/util/List;)J
     128: ldc2_w        #37                 // long 157l
     131: lcmp
     132: ifne          139
     135: iconst_1
     136: goto          140
     139: iconst_0
     140: ifne          153
     143: new           #12                 // class java/lang/IllegalStateException
     146: dup
     147: ldc           #14                 // String Check failed.
     149: invokespecial #18                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     152: athrow
     153: aload_0
     154: invokestatic  #41                 // Method main$part2:(Ljava/util/List;)J
     157: ldc2_w        #42                 // long 70l
     160: lcmp
     161: ifne          168
     164: iconst_1
     165: goto          169
     168: iconst_0
     169: ifne          182
     172: new           #12                 // class java/lang/IllegalStateException
     175: dup
     176: ldc           #14                 // String Check failed.
     178: invokespecial #18                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     181: athrow
     182: ldc           #45                 // String Day03
     184: invokestatic  #32                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
     187: astore_1
     188: aload_1
     189: invokestatic  #36                 // Method main$part1:(Ljava/util/List;)J
     192: lstore_2
     193: getstatic     #51                 // Field java/lang/System.out:Ljava/io/PrintStream;
     196: lload_2
     197: invokevirtual #57                 // Method java/io/PrintStream.println:(J)V
     200: aload_1
     201: invokestatic  #41                 // Method main$part2:(Ljava/util/List;)J
     204: lstore_2
     205: getstatic     #51                 // Field java/lang/System.out:Ljava/io/PrintStream;
     208: lload_2
     209: invokevirtual #57                 // Method java/io/PrintStream.println:(J)V
     212: return

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

  private static final long main$getPriority(char);
    Code:
       0: bipush        65
       2: iload_0
       3: if_icmpgt     20
       6: iload_0
       7: bipush        91
       9: if_icmpge     16
      12: iconst_1
      13: goto          21
      16: iconst_0
      17: goto          21
      20: iconst_0
      21: ifeq          34
      24: iload_0
      25: bipush        65
      27: isub
      28: i2l
      29: ldc2_w        #21                 // long 27l
      32: ladd
      33: lreturn
      34: iload_0
      35: bipush        97
      37: isub
      38: i2l
      39: lconst_1
      40: ladd
      41: lreturn

  private static final java.util.Set main$part1$lambda$3$lambda$0(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #73                 // String it
       3: invokestatic  #79                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #81                 // class java/lang/CharSequence
      10: invokestatic  #87                 // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;
      13: areturn

  private static final long main$part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #91                 // class java/lang/Iterable
       4: astore_1
       5: lconst_0
       6: lstore_2
       7: aload_1
       8: invokeinterface #95,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      13: astore        4
      15: aload         4
      17: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      22: ifeq          250
      25: aload         4
      27: invokeinterface #105,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      32: astore        5
      34: lload_2
      35: aload         5
      37: checkcast     #107                // class java/lang/String
      40: astore        6
      42: lstore        21
      44: iconst_0
      45: istore        7
      47: aload         6
      49: checkcast     #81                 // class java/lang/CharSequence
      52: aload         6
      54: invokevirtual #111                // Method java/lang/String.length:()I
      57: iconst_2
      58: idiv
      59: invokestatic  #115                // Method kotlin/text/StringsKt.chunkedSequence:(Ljava/lang/CharSequence;I)Lkotlin/sequences/Sequence;
      62: invokedynamic #132,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      67: invokestatic  #138                // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      70: astore        8
      72: nop
      73: iconst_0
      74: istore        9
      76: aload         8
      78: invokeinterface #141,  1          // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
      83: astore        10
      85: aload         10
      87: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      92: ifne          105
      95: new           #143                // class java/lang/UnsupportedOperationException
      98: dup
      99: ldc           #145                // String Empty sequence can\'t be reduced.
     101: invokespecial #146                // Method java/lang/UnsupportedOperationException."<init>":(Ljava/lang/String;)V
     104: athrow
     105: aload         10
     107: invokeinterface #105,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     112: astore        11
     114: aload         10
     116: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     121: ifeq          164
     124: aload         11
     126: aload         10
     128: invokeinterface #105,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     133: checkcast     #148                // class java/util/Set
     136: astore        12
     138: checkcast     #148                // class java/util/Set
     141: astore        13
     143: iconst_0
     144: istore        14
     146: aload         13
     148: checkcast     #91                 // class java/lang/Iterable
     151: aload         12
     153: checkcast     #91                 // class java/lang/Iterable
     156: invokestatic  #154                // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
     159: astore        11
     161: goto          114
     164: aload         11
     166: checkcast     #91                 // class java/lang/Iterable
     169: astore        8
     171: lconst_0
     172: lstore        15
     174: aload         8
     176: invokeinterface #95,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     181: astore        11
     183: aload         11
     185: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     190: ifeq          236
     193: aload         11
     195: invokeinterface #105,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     200: astore        12
     202: lload         15
     204: aload         12
     206: checkcast     #156                // class java/lang/Character
     209: invokevirtual #160                // Method java/lang/Character.charValue:()C
     212: istore        13
     214: lstore        17
     216: iconst_0
     217: istore        14
     219: iload         13
     221: invokestatic  #10                 // Method main$getPriority:(C)J
     224: lstore        19
     226: lload         17
     228: lload         19
     230: ladd
     231: lstore        15
     233: goto          183
     236: lload         15
     238: nop
     239: lstore        23
     241: lload         21
     243: lload         23
     245: ladd
     246: lstore_2
     247: goto          15
     250: lload_2
     251: lreturn

  private static final long main$part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #91                 // class java/lang/Iterable
       4: iconst_3
       5: invokestatic  #179                // Method kotlin/collections/CollectionsKt.chunked:(Ljava/lang/Iterable;I)Ljava/util/List;
       8: checkcast     #91                 // class java/lang/Iterable
      11: astore_1
      12: lconst_0
      13: lstore_2
      14: aload_1
      15: invokeinterface #95,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      20: astore        4
      22: aload         4
      24: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      29: ifeq          342
      32: aload         4
      34: invokeinterface #105,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      39: astore        5
      41: lload_2
      42: aload         5
      44: checkcast     #62                 // class java/util/List
      47: astore        6
      49: lstore        24
      51: iconst_0
      52: istore        7
      54: aload         6
      56: checkcast     #91                 // class java/lang/Iterable
      59: astore        8
      61: nop
      62: iconst_0
      63: istore        9
      65: aload         8
      67: astore        10
      69: new           #181                // class java/util/ArrayList
      72: dup
      73: aload         8
      75: bipush        10
      77: invokestatic  #185                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      80: invokespecial #188                // Method java/util/ArrayList."<init>":(I)V
      83: checkcast     #190                // class java/util/Collection
      86: astore        11
      88: iconst_0
      89: istore        12
      91: aload         10
      93: invokeinterface #95,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      98: astore        13
     100: aload         13
     102: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     107: ifeq          153
     110: aload         13
     112: invokeinterface #105,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     117: astore        14
     119: aload         11
     121: aload         14
     123: checkcast     #107                // class java/lang/String
     126: astore        15
     128: astore        16
     130: iconst_0
     131: istore        17
     133: aload         15
     135: checkcast     #81                 // class java/lang/CharSequence
     138: invokestatic  #87                 // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;
     141: aload         16
     143: swap
     144: invokeinterface #194,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     149: pop
     150: goto          100
     153: aload         11
     155: checkcast     #62                 // class java/util/List
     158: nop
     159: checkcast     #91                 // class java/lang/Iterable
     162: astore        8
     164: nop
     165: iconst_0
     166: istore        9
     168: aload         8
     170: invokeinterface #95,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     175: astore        10
     177: aload         10
     179: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     184: ifne          197
     187: new           #143                // class java/lang/UnsupportedOperationException
     190: dup
     191: ldc           #196                // String Empty collection can\'t be reduced.
     193: invokespecial #146                // Method java/lang/UnsupportedOperationException."<init>":(Ljava/lang/String;)V
     196: athrow
     197: aload         10
     199: invokeinterface #105,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     204: astore        11
     206: aload         10
     208: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     213: ifeq          256
     216: aload         11
     218: aload         10
     220: invokeinterface #105,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     225: checkcast     #148                // class java/util/Set
     228: astore        12
     230: checkcast     #148                // class java/util/Set
     233: astore        13
     235: iconst_0
     236: istore        14
     238: aload         13
     240: checkcast     #91                 // class java/lang/Iterable
     243: aload         12
     245: checkcast     #91                 // class java/lang/Iterable
     248: invokestatic  #154                // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
     251: astore        11
     253: goto          206
     256: aload         11
     258: checkcast     #91                 // class java/lang/Iterable
     261: astore        8
     263: lconst_0
     264: lstore        18
     266: aload         8
     268: invokeinterface #95,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     273: astore        11
     275: aload         11
     277: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     282: ifeq          328
     285: aload         11
     287: invokeinterface #105,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     292: astore        12
     294: lload         18
     296: aload         12
     298: checkcast     #156                // class java/lang/Character
     301: invokevirtual #160                // Method java/lang/Character.charValue:()C
     304: istore        13
     306: lstore        20
     308: iconst_0
     309: istore        14
     311: iload         13
     313: invokestatic  #10                 // Method main$getPriority:(C)J
     316: lstore        22
     318: lload         20
     320: lload         22
     322: ladd
     323: lstore        18
     325: goto          275
     328: lload         18
     330: nop
     331: lstore        26
     333: lload         24
     335: lload         26
     337: ladd
     338: lstore_2
     339: goto          22
     342: lload_2
     343: lreturn
}


import kotlin.math.abs

class Command(val direction: Direction, val count: Int)

fun main() {
    fun parse(input: List<String>): List<Command> {
        return input.map { line ->
            val parts = line.split(' ')
            val direction = when (parts[0]) {
                "U" -> Direction.Up
                "D" -> Direction.Down
                "L" -> Direction.Left
                "R" -> Direction.Right
                else -> throw RuntimeException()
            }

            Command(direction, parts[1].toInt())
        }
    }

    fun move(point: Point, direction: Direction): Point {
        return when (direction) {
            Direction.Up -> Point(point.x, point.y + 1)
            Direction.Down -> Point(point.x, point.y - 1)
            Direction.Left -> Point(point.x - 1, point.y)
            Direction.Right -> Point(point.x + 1, point.y)
        }
    }

    fun isTouching(head: Point, tail: Point): Boolean {
        return abs(head.x - tail.x) <= 1 && abs(head.y - tail.y) <= 1
    }

    fun getDelta(head: Int, tail: Int): Int {
        if (head == tail) {
            return 0
        }

        if (head > tail) {
            return 1
        }

        return -1
    }

    fun tryMoveTail(head: Point, tail: Point): Point {
        if (isTouching(head, tail)) {
            return tail
        }

        val dx = getDelta(head.x, tail.x)
        val dy = getDelta(head.y, tail.y)

        return Point(tail.x + dx, tail.y + dy)
    }

    fun traverse(commands: List<Command>, totalSize: Int): Int {
        val visited = mutableSetOf<Point>()
        var head = Point(0, 0)
        val size = totalSize - 2
        val middle = (1..size).map { Point(0, 0) }.toMutableList()
        var tail = Point(0, 0)
        visited.add(tail)
        for (command in commands) {
            for (i in 1..command.count) {
                head = move(head, command.direction)
                var pointer = head
                for (j in 0 until size) {
                    middle[j] = tryMoveTail(pointer, middle[j])
                    pointer = middle[j]
                }
                tail = tryMoveTail(pointer, tail)
                visited.add(tail)
            }
        }

        return visited.count()
    }

    fun part1(input: List<String>): Int {
        val commands = parse(input)
        return traverse(commands, 2)
    }

    fun part2(input: List<String>): Int {
        val commands = parse(input)
        return traverse(commands, 10)
    }

    val testInput = readInput("Day09_test")
    assert(part1(testInput), 13)
    assert(part2(testInput), 1)

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

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

  static {};
    Code:
       0: invokestatic  #14                 // Method Direction.values:()[LDirection;
       3: arraylength
       4: newarray       int
       6: astore_0
       7: nop
       8: aload_0
       9: getstatic     #18                 // Field Direction.Up:LDirection;
      12: invokevirtual #22                 // Method Direction.ordinal:()I
      15: iconst_1
      16: iastore
      17: goto          21
      20: astore_1
      21: nop
      22: aload_0
      23: getstatic     #25                 // Field Direction.Down:LDirection;
      26: invokevirtual #22                 // Method Direction.ordinal:()I
      29: iconst_2
      30: iastore
      31: goto          35
      34: astore_1
      35: nop
      36: aload_0
      37: getstatic     #28                 // Field Direction.Left:LDirection;
      40: invokevirtual #22                 // Method Direction.ordinal:()I
      43: iconst_3
      44: iastore
      45: goto          49
      48: astore_1
      49: nop
      50: aload_0
      51: getstatic     #31                 // Field Direction.Right:LDirection;
      54: invokevirtual #22                 // Method 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 Day09Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String Day09_test
       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: invokestatic  #24                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      13: bipush        13
      15: invokestatic  #24                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      18: invokestatic  #28                 // Method UtilsKt.assert:(Ljava/lang/Object;Ljava/lang/Object;)V
      21: aload_0
      22: invokestatic  #31                 // Method main$part2:(Ljava/util/List;)I
      25: invokestatic  #24                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      28: iconst_1
      29: invokestatic  #24                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      32: invokestatic  #28                 // Method UtilsKt.assert:(Ljava/lang/Object;Ljava/lang/Object;)V
      35: ldc           #33                 // String Day09
      37: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
      40: astore_1
      41: aload_1
      42: invokestatic  #18                 // Method main$part1:(Ljava/util/List;)I
      45: istore_2
      46: getstatic     #39                 // Field java/lang/System.out:Ljava/io/PrintStream;
      49: iload_2
      50: invokevirtual #45                 // Method java/io/PrintStream.println:(I)V
      53: aload_1
      54: invokestatic  #31                 // Method main$part2:(Ljava/util/List;)I
      57: istore_2
      58: getstatic     #39                 // Field java/lang/System.out:Ljava/io/PrintStream;
      61: iload_2
      62: invokevirtual #45                 // Method java/io/PrintStream.println:(I)V
      65: return

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

  private static final java.util.List<Command> main$parse(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #58                 // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: astore_3
       9: new           #60                 // class java/util/ArrayList
      12: dup
      13: aload_1
      14: bipush        10
      16: invokestatic  #66                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      19: invokespecial #69                 // Method java/util/ArrayList."<init>":(I)V
      22: checkcast     #71                 // class java/util/Collection
      25: astore        4
      27: iconst_0
      28: istore        5
      30: aload_3
      31: invokeinterface #75,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      36: astore        6
      38: aload         6
      40: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      45: ifeq          281
      48: aload         6
      50: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      55: astore        7
      57: aload         4
      59: aload         7
      61: checkcast     #87                 // class java/lang/String
      64: astore        8
      66: astore        13
      68: iconst_0
      69: istore        9
      71: aload         8
      73: checkcast     #89                 // class java/lang/CharSequence
      76: iconst_1
      77: newarray       char
      79: astore        10
      81: aload         10
      83: iconst_0
      84: bipush        32
      86: castore
      87: aload         10
      89: iconst_0
      90: iconst_0
      91: bipush        6
      93: aconst_null
      94: invokestatic  #95                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[CZIILjava/lang/Object;)Ljava/util/List;
      97: astore        11
      99: aload         11
     101: iconst_0
     102: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     107: checkcast     #87                 // class java/lang/String
     110: astore        12
     112: aload         12
     114: invokevirtual #105                // Method java/lang/String.hashCode:()I
     117: lookupswitch  { // 4
                    68: 173
                    76: 199
                    82: 160
                    85: 186
               default: 236
          }
     160: aload         12
     162: ldc           #107                // String R
     164: invokevirtual #111                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     167: ifne          230
     170: goto          236
     173: aload         12
     175: ldc           #113                // String D
     177: invokevirtual #111                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     180: ifne          218
     183: goto          236
     186: aload         12
     188: ldc           #115                // String U
     190: invokevirtual #111                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     193: ifne          212
     196: goto          236
     199: aload         12
     201: ldc           #117                // String L
     203: invokevirtual #111                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     206: ifne          224
     209: goto          236
     212: getstatic     #123                // Field Direction.Up:LDirection;
     215: goto          244
     218: getstatic     #126                // Field Direction.Down:LDirection;
     221: goto          244
     224: getstatic     #129                // Field Direction.Left:LDirection;
     227: goto          244
     230: getstatic     #132                // Field Direction.Right:LDirection;
     233: goto          244
     236: new           #134                // class java/lang/RuntimeException
     239: dup
     240: invokespecial #136                // Method java/lang/RuntimeException."<init>":()V
     243: athrow
     244: astore        10
     246: new           #138                // class Command
     249: dup
     250: aload         10
     252: aload         11
     254: iconst_1
     255: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     260: checkcast     #87                 // class java/lang/String
     263: invokestatic  #142                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     266: invokespecial #145                // Method Command."<init>":(LDirection;I)V
     269: aload         13
     271: swap
     272: invokeinterface #148,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     277: pop
     278: goto          38
     281: aload         4
     283: checkcast     #97                 // class java/util/List
     286: nop
     287: areturn

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

  private static final boolean main$isTouching(Point, Point);
    Code:
       0: aload_0
       1: invokevirtual #181                // Method Point.getX:()I
       4: aload_1
       5: invokevirtual #181                // Method Point.getX:()I
       8: isub
       9: invokestatic  #200                // Method java/lang/Math.abs:(I)I
      12: iconst_1
      13: if_icmpgt     36
      16: aload_0
      17: invokevirtual #184                // Method Point.getY:()I
      20: aload_1
      21: invokevirtual #184                // Method Point.getY:()I
      24: isub
      25: invokestatic  #200                // 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 static final int main$getDelta(int, int);
    Code:
       0: iload_0
       1: iload_1
       2: if_icmpne     7
       5: iconst_0
       6: ireturn
       7: iload_0
       8: iload_1
       9: if_icmple     14
      12: iconst_1
      13: ireturn
      14: iconst_m1
      15: ireturn

  private static final Point main$tryMoveTail(Point, Point);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #208                // Method main$isTouching:(LPoint;LPoint;)Z
       5: ifeq          10
       8: aload_1
       9: areturn
      10: aload_0
      11: invokevirtual #181                // Method Point.getX:()I
      14: aload_1
      15: invokevirtual #181                // Method Point.getX:()I
      18: invokestatic  #210                // Method main$getDelta:(II)I
      21: istore_2
      22: aload_0
      23: invokevirtual #184                // Method Point.getY:()I
      26: aload_1
      27: invokevirtual #184                // Method Point.getY:()I
      30: invokestatic  #210                // Method main$getDelta:(II)I
      33: istore_3
      34: new           #178                // class Point
      37: dup
      38: aload_1
      39: invokevirtual #181                // Method Point.getX:()I
      42: iload_2
      43: iadd
      44: aload_1
      45: invokevirtual #184                // Method Point.getY:()I
      48: iload_3
      49: iadd
      50: invokespecial #187                // Method Point."<init>":(II)V
      53: areturn

  private static final int main$traverse(java.util.List<Command>, int);
    Code:
       0: new           #217                // class java/util/LinkedHashSet
       3: dup
       4: invokespecial #218                // Method java/util/LinkedHashSet."<init>":()V
       7: checkcast     #220                // class java/util/Set
      10: astore_2
      11: new           #178                // class Point
      14: dup
      15: iconst_0
      16: iconst_0
      17: invokespecial #187                // Method Point."<init>":(II)V
      20: astore_3
      21: iload_1
      22: iconst_2
      23: isub
      24: istore        4
      26: new           #222                // class kotlin/ranges/IntRange
      29: dup
      30: iconst_1
      31: iload         4
      33: invokespecial #223                // Method kotlin/ranges/IntRange."<init>":(II)V
      36: checkcast     #58                 // class java/lang/Iterable
      39: astore        6
      41: iconst_0
      42: istore        7
      44: aload         6
      46: astore        8
      48: new           #60                 // class java/util/ArrayList
      51: dup
      52: aload         6
      54: bipush        10
      56: invokestatic  #66                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      59: invokespecial #69                 // Method java/util/ArrayList."<init>":(I)V
      62: checkcast     #71                 // class java/util/Collection
      65: astore        9
      67: iconst_0
      68: istore        10
      70: aload         8
      72: invokeinterface #75,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      77: astore        11
      79: aload         11
      81: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      86: ifeq          131
      89: aload         11
      91: checkcast     #225                // class kotlin/collections/IntIterator
      94: invokevirtual #228                // Method kotlin/collections/IntIterator.nextInt:()I
      97: istore        12
      99: aload         9
     101: iload         12
     103: istore        13
     105: astore        15
     107: iconst_0
     108: istore        14
     110: new           #178                // class Point
     113: dup
     114: iconst_0
     115: iconst_0
     116: invokespecial #187                // Method Point."<init>":(II)V
     119: aload         15
     121: swap
     122: invokeinterface #148,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     127: pop
     128: goto          79
     131: aload         9
     133: checkcast     #97                 // class java/util/List
     136: nop
     137: checkcast     #71                 // class java/util/Collection
     140: invokestatic  #232                // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;
     143: astore        5
     145: new           #178                // class Point
     148: dup
     149: iconst_0
     150: iconst_0
     151: invokespecial #187                // Method Point."<init>":(II)V
     154: astore        6
     156: aload_2
     157: aload         6
     159: invokeinterface #233,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
     164: pop
     165: aload_0
     166: invokeinterface #234,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     171: astore        7
     173: aload         7
     175: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     180: ifeq          313
     183: aload         7
     185: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     190: checkcast     #138                // class Command
     193: astore        8
     195: iconst_1
     196: istore        9
     198: aload         8
     200: invokevirtual #237                // Method Command.getCount:()I
     203: istore        10
     205: iload         9
     207: iload         10
     209: if_icmpgt     173
     212: aload_3
     213: aload         8
     215: invokevirtual #241                // Method Command.getDirection:()LDirection;
     218: invokestatic  #243                // Method main$move:(LPoint;LDirection;)LPoint;
     221: astore_3
     222: aload_3
     223: astore        11
     225: iconst_0
     226: istore        12
     228: iload         12
     230: iload         4
     232: if_icmpge     282
     235: aload         5
     237: iload         12
     239: aload         11
     241: aload         5
     243: iload         12
     245: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     250: checkcast     #178                // class Point
     253: invokestatic  #245                // Method main$tryMoveTail:(LPoint;LPoint;)LPoint;
     256: invokeinterface #249,  3          // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;
     261: pop
     262: aload         5
     264: iload         12
     266: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     271: checkcast     #178                // class Point
     274: astore        11
     276: iinc          12, 1
     279: goto          228
     282: aload         11
     284: aload         6
     286: invokestatic  #245                // Method main$tryMoveTail:(LPoint;LPoint;)LPoint;
     289: astore        6
     291: aload_2
     292: aload         6
     294: invokeinterface #233,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
     299: pop
     300: iload         9
     302: iload         10
     304: if_icmpeq     173
     307: iinc          9, 1
     310: goto          212
     313: aload_2
     314: checkcast     #71                 // class java/util/Collection
     317: invokeinterface #252,  1          // InterfaceMethod java/util/Collection.size:()I
     322: ireturn

  private static final int main$part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #267                // Method main$parse:(Ljava/util/List;)Ljava/util/List;
       4: astore_1
       5: aload_1
       6: iconst_2
       7: invokestatic  #269                // Method main$traverse:(Ljava/util/List;I)I
      10: ireturn

  private static final int main$part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #267                // Method main$parse:(Ljava/util/List;)Ljava/util/List;
       4: astore_1
       5: aload_1
       6: bipush        10
       8: invokestatic  #269                // Method main$traverse:(Ljava/util/List;I)I
      11: ireturn
}


enum class Figure(val score: Int) {
    Rock(1),
    Paper(2),
    Scissors(3)
}

fun main() {
    fun createFigure(value: String): Figure {
        return when (value) {
            "A" -> Figure.Rock
            "B" -> Figure.Paper
            "C" -> Figure.Scissors
            "X" -> Figure.Rock
            "Y" -> Figure.Paper
            "Z" -> Figure.Scissors
            else -> throw Exception("Value unsupported $value")
        }
    }

    fun compare(f1: Figure, f2: Figure): Int {
        if (f1 == f2) {
            return 3
        }

        if (
            f1 == Figure.Paper && f2 == Figure.Scissors ||
            f1 == Figure.Rock && f2 == Figure.Paper ||
            f1 == Figure.Scissors && f2 == Figure.Rock
        ) {
            return 6
        }

        return 0
    }

    fun readTurns(lines: List<String>): List<Pair<Figure, Figure>> {
        return lines.map {
            val parts = it.split(' ')
            Pair(createFigure(parts[0]), createFigure(parts[1]))
        }
    }

    fun createFigure2(first: Figure, value: String): Figure {
        if (value == "Y") {
            return first
        }

        if (value == "X") {
            return when (first) {
                Figure.Rock -> Figure.Scissors
                Figure.Paper -> Figure.Rock
                Figure.Scissors -> Figure.Paper
            }
        }

        return when (first) {
            Figure.Rock -> Figure.Paper
            Figure.Paper -> Figure.Scissors
            Figure.Scissors -> Figure.Rock
        }
    }

    fun readTurns2(lines: List<String>): List<Pair<Figure, Figure>> {
        return lines.map {
            val parts = it.split(' ')
            val first = createFigure(parts[0])
            Pair(first, createFigure2(first, parts[1]))
        }
    }

    fun play(turns: List<Pair<Figure, Figure>>): Long {
        var result = 0L
        turns.map {
            compare(it.first, it.second) + it.second.score
        }.forEach {
            result += it
        }

        return result
    }

    fun part1(input: List<String>): Long {
        return play(readTurns(input))
    }

    fun part2(input: List<String>): Long {
        return play(readTurns2(input))
    }

    // test if implementation meets criteria from the description, like:
    val testInput = readInput("Day02_test")
    check(part1(testInput) == 15L)
    check(part2(testInput) == 12L)

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

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

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

  private static final Figure main$createFigure(java.lang.String);
    Code:
       0: aload_0
       1: astore_1
       2: aload_1
       3: invokevirtual #65                 // Method java/lang/String.hashCode:()I
       6: lookupswitch  { // 6
                    65: 64
                    66: 76
                    67: 88
                    88: 100
                    89: 112
                    90: 124
               default: 172
          }
      64: aload_1
      65: ldc           #67                 // String A
      67: invokevirtual #71                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
      70: ifne          136
      73: goto          172
      76: aload_1
      77: ldc           #73                 // String B
      79: invokevirtual #71                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
      82: ifne          142
      85: goto          172
      88: aload_1
      89: ldc           #75                 // String C
      91: invokevirtual #71                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
      94: ifne          148
      97: goto          172
     100: aload_1
     101: ldc           #77                 // String X
     103: invokevirtual #71                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     106: ifne          154
     109: goto          172
     112: aload_1
     113: ldc           #79                 // String Y
     115: invokevirtual #71                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     118: ifne          160
     121: goto          172
     124: aload_1
     125: ldc           #81                 // String Z
     127: invokevirtual #71                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     130: ifne          166
     133: goto          172
     136: getstatic     #87                 // Field Figure.Rock:LFigure;
     139: goto          199
     142: getstatic     #90                 // Field Figure.Paper:LFigure;
     145: goto          199
     148: getstatic     #93                 // Field Figure.Scissors:LFigure;
     151: goto          199
     154: getstatic     #87                 // Field Figure.Rock:LFigure;
     157: goto          199
     160: getstatic     #90                 // Field Figure.Paper:LFigure;
     163: goto          199
     166: getstatic     #93                 // Field Figure.Scissors:LFigure;
     169: goto          199
     172: new           #95                 // class java/lang/Exception
     175: dup
     176: new           #97                 // class java/lang/StringBuilder
     179: dup
     180: invokespecial #99                 // Method java/lang/StringBuilder."<init>":()V
     183: ldc           #101                // String Value unsupported
     185: invokevirtual #105                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     188: aload_0
     189: invokevirtual #105                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     192: invokevirtual #109                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     195: invokespecial #110                // Method java/lang/Exception."<init>":(Ljava/lang/String;)V
     198: athrow
     199: areturn

  private static final int main$compare(Figure, Figure);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_3
       6: ireturn
       7: aload_0
       8: getstatic     #90                 // Field Figure.Paper:LFigure;
      11: if_acmpne     21
      14: aload_1
      15: getstatic     #93                 // Field Figure.Scissors:LFigure;
      18: if_acmpeq     49
      21: aload_0
      22: getstatic     #87                 // Field Figure.Rock:LFigure;
      25: if_acmpne     35
      28: aload_1
      29: getstatic     #90                 // Field Figure.Paper:LFigure;
      32: if_acmpeq     49
      35: aload_0
      36: getstatic     #93                 // Field Figure.Scissors:LFigure;
      39: if_acmpne     52
      42: aload_1
      43: getstatic     #87                 // Field Figure.Rock:LFigure;
      46: if_acmpne     52
      49: bipush        6
      51: ireturn
      52: iconst_0
      53: ireturn

  private static final java.util.List<kotlin.Pair<Figure, Figure>> main$readTurns(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #121                // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: astore_3
       9: new           #123                // class java/util/ArrayList
      12: dup
      13: aload_1
      14: bipush        10
      16: invokestatic  #129                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      19: invokespecial #132                // Method java/util/ArrayList."<init>":(I)V
      22: checkcast     #134                // class java/util/Collection
      25: astore        4
      27: iconst_0
      28: istore        5
      30: aload_3
      31: invokeinterface #138,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      36: astore        6
      38: aload         6
      40: invokeinterface #144,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      45: ifeq          146
      48: aload         6
      50: invokeinterface #148,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      55: astore        7
      57: aload         4
      59: aload         7
      61: checkcast     #61                 // class java/lang/String
      64: astore        8
      66: astore        12
      68: iconst_0
      69: istore        9
      71: aload         8
      73: checkcast     #150                // class java/lang/CharSequence
      76: iconst_1
      77: newarray       char
      79: astore        10
      81: aload         10
      83: iconst_0
      84: bipush        32
      86: castore
      87: aload         10
      89: iconst_0
      90: iconst_0
      91: bipush        6
      93: aconst_null
      94: invokestatic  #156                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[CZIILjava/lang/Object;)Ljava/util/List;
      97: astore        11
      99: new           #158                // class kotlin/Pair
     102: dup
     103: aload         11
     105: iconst_0
     106: invokeinterface #162,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     111: checkcast     #61                 // class java/lang/String
     114: invokestatic  #164                // Method main$createFigure:(Ljava/lang/String;)LFigure;
     117: aload         11
     119: iconst_1
     120: invokeinterface #162,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     125: checkcast     #61                 // class java/lang/String
     128: invokestatic  #164                // Method main$createFigure:(Ljava/lang/String;)LFigure;
     131: invokespecial #167                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     134: aload         12
     136: swap
     137: invokeinterface #170,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     142: pop
     143: goto          38
     146: aload         4
     148: checkcast     #52                 // class java/util/List
     151: nop
     152: areturn

  private static final Figure main$createFigure2(Figure, java.lang.String);
    Code:
       0: aload_1
       1: ldc           #79                 // String Y
       3: invokestatic  #192                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
       6: ifeq          11
       9: aload_0
      10: areturn
      11: aload_1
      12: ldc           #77                 // String X
      14: invokestatic  #192                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      17: ifeq          83
      20: aload_0
      21: getstatic     #198                // Field Day02Kt$WhenMappings.$EnumSwitchMapping$0:[I
      24: swap
      25: invokevirtual #201                // Method Figure.ordinal:()I
      28: iaload
      29: tableswitch   { // 1 to 3
                     1: 56
                     2: 62
                     3: 68
               default: 74
          }
      56: getstatic     #93                 // Field Figure.Scissors:LFigure;
      59: goto          82
      62: getstatic     #87                 // Field Figure.Rock:LFigure;
      65: goto          82
      68: getstatic     #90                 // Field Figure.Paper:LFigure;
      71: goto          82
      74: new           #203                // class kotlin/NoWhenBranchMatchedException
      77: dup
      78: invokespecial #204                // Method kotlin/NoWhenBranchMatchedException."<init>":()V
      81: athrow
      82: areturn
      83: aload_0
      84: getstatic     #198                // Field Day02Kt$WhenMappings.$EnumSwitchMapping$0:[I
      87: swap
      88: invokevirtual #201                // Method Figure.ordinal:()I
      91: iaload
      92: tableswitch   { // 1 to 3
                     1: 120
                     2: 126
                     3: 132
               default: 138
          }
     120: getstatic     #90                 // Field Figure.Paper:LFigure;
     123: goto          146
     126: getstatic     #93                 // Field Figure.Scissors:LFigure;
     129: goto          146
     132: getstatic     #87                 // Field Figure.Rock:LFigure;
     135: goto          146
     138: new           #203                // class kotlin/NoWhenBranchMatchedException
     141: dup
     142: invokespecial #204                // Method kotlin/NoWhenBranchMatchedException."<init>":()V
     145: athrow
     146: areturn

  private static final java.util.List<kotlin.Pair<Figure, Figure>> main$readTurns2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #121                // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: astore_3
       9: new           #123                // class java/util/ArrayList
      12: dup
      13: aload_1
      14: bipush        10
      16: invokestatic  #129                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      19: invokespecial #132                // Method java/util/ArrayList."<init>":(I)V
      22: checkcast     #134                // class java/util/Collection
      25: astore        4
      27: iconst_0
      28: istore        5
      30: aload_3
      31: invokeinterface #138,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      36: astore        6
      38: aload         6
      40: invokeinterface #144,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      45: ifeq          152
      48: aload         6
      50: invokeinterface #148,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      55: astore        7
      57: aload         4
      59: aload         7
      61: checkcast     #61                 // class java/lang/String
      64: astore        8
      66: astore        12
      68: iconst_0
      69: istore        9
      71: aload         8
      73: checkcast     #150                // class java/lang/CharSequence
      76: iconst_1
      77: newarray       char
      79: astore        10
      81: aload         10
      83: iconst_0
      84: bipush        32
      86: castore
      87: aload         10
      89: iconst_0
      90: iconst_0
      91: bipush        6
      93: aconst_null
      94: invokestatic  #156                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[CZIILjava/lang/Object;)Ljava/util/List;
      97: astore        11
      99: aload         11
     101: iconst_0
     102: invokeinterface #162,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     107: checkcast     #61                 // class java/lang/String
     110: invokestatic  #164                // Method main$createFigure:(Ljava/lang/String;)LFigure;
     113: astore        10
     115: new           #158                // class kotlin/Pair
     118: dup
     119: aload         10
     121: aload         10
     123: aload         11
     125: iconst_1
     126: invokeinterface #162,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     131: checkcast     #61                 // class java/lang/String
     134: invokestatic  #208                // Method main$createFigure2:(LFigure;Ljava/lang/String;)LFigure;
     137: invokespecial #167                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     140: aload         12
     142: swap
     143: invokeinterface #170,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     148: pop
     149: goto          38
     152: aload         4
     154: checkcast     #52                 // class java/util/List
     157: nop
     158: areturn

  private static final long main$play(java.util.List<? extends kotlin.Pair<? extends Figure, ? extends Figure>>);
    Code:
       0: lconst_0
       1: lstore        11
       3: aload_0
       4: checkcast     #121                // class java/lang/Iterable
       7: astore_1
       8: iconst_0
       9: istore_2
      10: aload_1
      11: astore_3
      12: new           #123                // class java/util/ArrayList
      15: dup
      16: aload_1
      17: bipush        10
      19: invokestatic  #129                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      22: invokespecial #132                // Method java/util/ArrayList."<init>":(I)V
      25: checkcast     #134                // class java/util/Collection
      28: astore        4
      30: iconst_0
      31: istore        5
      33: aload_3
      34: invokeinterface #138,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      39: astore        6
      41: aload         6
      43: invokeinterface #144,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      48: ifeq          120
      51: aload         6
      53: invokeinterface #148,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      58: astore        7
      60: aload         4
      62: aload         7
      64: checkcast     #158                // class kotlin/Pair
      67: astore        8
      69: astore        10
      71: iconst_0
      72: istore        9
      74: aload         8
      76: invokevirtual #214                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      79: checkcast     #83                 // class Figure
      82: aload         8
      84: invokevirtual #217                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      87: checkcast     #83                 // class Figure
      90: invokestatic  #219                // Method main$compare:(LFigure;LFigure;)I
      93: aload         8
      95: invokevirtual #217                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      98: checkcast     #83                 // class Figure
     101: invokevirtual #222                // Method Figure.getScore:()I
     104: iadd
     105: invokestatic  #228                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     108: aload         10
     110: swap
     111: invokeinterface #170,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     116: pop
     117: goto          41
     120: aload         4
     122: checkcast     #52                 // class java/util/List
     125: nop
     126: checkcast     #121                // class java/lang/Iterable
     129: astore_1
     130: nop
     131: iconst_0
     132: istore_2
     133: aload_1
     134: invokeinterface #138,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     139: astore_3
     140: aload_3
     141: invokeinterface #144,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     146: ifeq          183
     149: aload_3
     150: invokeinterface #148,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     155: astore        4
     157: aload         4
     159: checkcast     #230                // class java/lang/Number
     162: invokevirtual #233                // Method java/lang/Number.intValue:()I
     165: istore        5
     167: iconst_0
     168: istore        6
     170: lload         11
     172: iload         5
     174: i2l
     175: ladd
     176: lstore        11
     178: nop
     179: nop
     180: goto          140
     183: nop
     184: lload         11
     186: lreturn

  private static final long main$part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #245                // Method main$readTurns:(Ljava/util/List;)Ljava/util/List;
       4: invokestatic  #247                // Method main$play:(Ljava/util/List;)J
       7: lreturn

  private static final long main$part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #249                // Method main$readTurns2:(Ljava/util/List;)Ljava/util/List;
       4: invokestatic  #247                // Method main$play:(Ljava/util/List;)J
       7: lreturn
}

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

  static {};
    Code:
       0: invokestatic  #14                 // Method Figure.values:()[LFigure;
       3: arraylength
       4: newarray       int
       6: astore_0
       7: nop
       8: aload_0
       9: getstatic     #18                 // Field Figure.Rock:LFigure;
      12: invokevirtual #22                 // Method Figure.ordinal:()I
      15: iconst_1
      16: iastore
      17: goto          21
      20: astore_1
      21: nop
      22: aload_0
      23: getstatic     #25                 // Field Figure.Paper:LFigure;
      26: invokevirtual #22                 // Method Figure.ordinal:()I
      29: iconst_2
      30: iastore
      31: goto          35
      34: astore_1
      35: nop
      36: aload_0
      37: getstatic     #28                 // Field Figure.Scissors:LFigure;
      40: invokevirtual #22                 // Method Figure.ordinal:()I
      43: iconst_3
      44: iastore
      45: goto          49
      48: astore_1
      49: aload_0
      50: putstatic     #32                 // Field $EnumSwitchMapping$0:[I
      53: 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
}


class Day12Input(
    val graph: Map<Point, Int>,
    val start: Point,
    val end: Point
)

data class Trace(val weight: Int, val current: Point, val prev: Point?, val distance: Int)

fun main() {
    fun getNeighbors(point: Point, graph: Map<Point, Int>): List<Point> {
        return listOf(
            Point(point.x - 1, point.y),
            Point(point.x + 1, point.y),
            Point(point.x, point.y - 1),
            Point(point.x, point.y + 1)
        ).filter { graph.contains(it) }
    }

    fun search(graph: Map<Point, Int>, startPoints: List<Point>, endPoint: Point): Int {
        val visited = startPoints.toMutableSet()
        val queue = ArrayDeque(
            startPoints.map { start -> Trace(graph[start]!!, start, null, 0) }
        )

        while (queue.isNotEmpty()) {
            val item = queue.removeFirst()
            if (item.current == endPoint) {
                return item.distance
            }

            val source = item.current
            val sourceWeight = graph[source]!!
            for (target in getNeighbors(source, graph)) {
                val targetWeight = graph[target]!!
                if (targetWeight - sourceWeight > 1 || target in visited) {
                    continue
                }
                visited.add(target)
                queue.addLast(Trace(targetWeight, target, source, item.distance + 1))
            }
        }

        return -1
    }

    fun parse(input: List<String>): Day12Input {
        var start = Point(0, 0)
        var end = Point(0, 0)
        val graph = input.mapIndexed { i, line ->
            line.mapIndexed { j, cell ->
                val value: Int = when (cell) {
                    'S' -> {
                        start = Point(i, j)
                        1
                    }
                    'E' -> {
                        end = Point(i, j)
                        'z' - 'a' + 1
                    }
                    else ->
                        (cell - 'a' + 1)
                }

                Point(i, j) to value
            }
        }.flatten().toMap()

        return Day12Input(graph, start, end)
    }

    fun part1(input: List<String>): Int {
        val day12Input = parse(input)
        return search(day12Input.graph, listOf(day12Input.start), day12Input.end)
    }

    fun part2(input: List<String>): Int {
        val day12Input = parse(input)
        val startPoints = day12Input.graph.filter { it.value == 1 }.map { it.key }
        return search(day12Input.graph, startPoints, day12Input.end)
    }

    val testInput = readInput("Day12_test")
    assert(part1(testInput), 31)
    assert(part2(testInput), 29)

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

Compiled from "Day12.kt"
public final class Day12Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String Day12_test
       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: invokestatic  #24                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      13: bipush        31
      15: invokestatic  #24                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      18: invokestatic  #28                 // Method UtilsKt.assert:(Ljava/lang/Object;Ljava/lang/Object;)V
      21: aload_0
      22: invokestatic  #31                 // Method main$part2:(Ljava/util/List;)I
      25: invokestatic  #24                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      28: bipush        29
      30: invokestatic  #24                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      33: invokestatic  #28                 // Method UtilsKt.assert:(Ljava/lang/Object;Ljava/lang/Object;)V
      36: ldc           #33                 // String Day12
      38: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
      41: astore_1
      42: aload_1
      43: invokestatic  #18                 // Method main$part1:(Ljava/util/List;)I
      46: istore_2
      47: getstatic     #39                 // Field java/lang/System.out:Ljava/io/PrintStream;
      50: iload_2
      51: invokevirtual #45                 // Method java/io/PrintStream.println:(I)V
      54: aload_1
      55: invokestatic  #31                 // Method main$part2:(Ljava/util/List;)I
      58: istore_2
      59: getstatic     #39                 // Field java/lang/System.out:Ljava/io/PrintStream;
      62: iload_2
      63: invokevirtual #45                 // Method java/io/PrintStream.println:(I)V
      66: return

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

  private static final java.util.List<Point> main$getNeighbors(Point, java.util.Map<Point, java.lang.Integer>);
    Code:
       0: iconst_4
       1: anewarray     #58                 // class Point
       4: astore_2
       5: aload_2
       6: iconst_0
       7: new           #58                 // class Point
      10: dup
      11: aload_0
      12: invokevirtual #62                 // Method Point.getX:()I
      15: iconst_1
      16: isub
      17: aload_0
      18: invokevirtual #65                 // Method Point.getY:()I
      21: invokespecial #69                 // Method Point."<init>":(II)V
      24: aastore
      25: aload_2
      26: iconst_1
      27: new           #58                 // class Point
      30: dup
      31: aload_0
      32: invokevirtual #62                 // Method Point.getX:()I
      35: iconst_1
      36: iadd
      37: aload_0
      38: invokevirtual #65                 // Method Point.getY:()I
      41: invokespecial #69                 // Method Point."<init>":(II)V
      44: aastore
      45: aload_2
      46: iconst_2
      47: new           #58                 // class Point
      50: dup
      51: aload_0
      52: invokevirtual #62                 // Method Point.getX:()I
      55: aload_0
      56: invokevirtual #65                 // Method Point.getY:()I
      59: iconst_1
      60: isub
      61: invokespecial #69                 // Method Point."<init>":(II)V
      64: aastore
      65: aload_2
      66: iconst_3
      67: new           #58                 // class Point
      70: dup
      71: aload_0
      72: invokevirtual #62                 // Method Point.getX:()I
      75: aload_0
      76: invokevirtual #65                 // Method Point.getY:()I
      79: iconst_1
      80: iadd
      81: invokespecial #69                 // Method Point."<init>":(II)V
      84: aastore
      85: aload_2
      86: invokestatic  #75                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      89: checkcast     #77                 // class java/lang/Iterable
      92: astore_2
      93: nop
      94: iconst_0
      95: istore_3
      96: aload_2
      97: astore        4
      99: new           #79                 // class java/util/ArrayList
     102: dup
     103: invokespecial #81                 // Method java/util/ArrayList."<init>":()V
     106: checkcast     #83                 // class java/util/Collection
     109: astore        5
     111: iconst_0
     112: istore        6
     114: aload         4
     116: invokeinterface #87,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     121: astore        7
     123: aload         7
     125: invokeinterface #93,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     130: ifeq          177
     133: aload         7
     135: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     140: astore        8
     142: aload         8
     144: checkcast     #58                 // class Point
     147: astore        9
     149: iconst_0
     150: istore        10
     152: aload_1
     153: aload         9
     155: invokeinterface #103,  2          // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z
     160: nop
     161: ifeq          123
     164: aload         5
     166: aload         8
     168: invokeinterface #106,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     173: pop
     174: goto          123
     177: aload         5
     179: checkcast     #108                // class java/util/List
     182: nop
     183: areturn

  private static final int main$search(java.util.Map<Point, java.lang.Integer>, java.util.List<Point>, Point);
    Code:
       0: aload_1
       1: checkcast     #77                 // class java/lang/Iterable
       4: invokestatic  #131                // Method kotlin/collections/CollectionsKt.toMutableSet:(Ljava/lang/Iterable;)Ljava/util/Set;
       7: astore_3
       8: aload_1
       9: checkcast     #77                 // class java/lang/Iterable
      12: astore        5
      14: iconst_0
      15: istore        6
      17: aload         5
      19: astore        7
      21: new           #79                 // class java/util/ArrayList
      24: dup
      25: aload         5
      27: bipush        10
      29: invokestatic  #135                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      32: invokespecial #137                // Method java/util/ArrayList."<init>":(I)V
      35: checkcast     #83                 // class java/util/Collection
      38: astore        8
      40: iconst_0
      41: istore        9
      43: aload         7
      45: invokeinterface #87,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      50: astore        10
      52: aload         10
      54: invokeinterface #93,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      59: ifeq          126
      62: aload         10
      64: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      69: astore        11
      71: aload         8
      73: aload         11
      75: checkcast     #58                 // class Point
      78: astore        12
      80: astore        14
      82: iconst_0
      83: istore        13
      85: new           #139                // class Trace
      88: dup
      89: aload_0
      90: aload         12
      92: invokeinterface #143,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      97: dup
      98: invokestatic  #149                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     101: checkcast     #151                // class java/lang/Number
     104: invokevirtual #154                // Method java/lang/Number.intValue:()I
     107: aload         12
     109: aconst_null
     110: iconst_0
     111: invokespecial #157                // Method Trace."<init>":(ILPoint;LPoint;I)V
     114: aload         14
     116: swap
     117: invokeinterface #106,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     122: pop
     123: goto          52
     126: aload         8
     128: checkcast     #108                // class java/util/List
     131: nop
     132: checkcast     #83                 // class java/util/Collection
     135: astore        15
     137: new           #159                // class kotlin/collections/ArrayDeque
     140: dup
     141: aload         15
     143: invokespecial #162                // Method kotlin/collections/ArrayDeque."<init>":(Ljava/util/Collection;)V
     146: astore        4
     148: aload         4
     150: checkcast     #83                 // class java/util/Collection
     153: invokeinterface #165,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
     158: ifne          165
     161: iconst_1
     162: goto          166
     165: iconst_0
     166: ifeq          339
     169: aload         4
     171: invokevirtual #168                // Method kotlin/collections/ArrayDeque.removeFirst:()Ljava/lang/Object;
     174: checkcast     #139                // class Trace
     177: astore        5
     179: aload         5
     181: invokevirtual #172                // Method Trace.getCurrent:()LPoint;
     184: aload_2
     185: invokestatic  #176                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     188: ifeq          197
     191: aload         5
     193: invokevirtual #179                // Method Trace.getDistance:()I
     196: ireturn
     197: aload         5
     199: invokevirtual #172                // Method Trace.getCurrent:()LPoint;
     202: astore        6
     204: aload_0
     205: aload         6
     207: invokeinterface #143,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     212: dup
     213: invokestatic  #149                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     216: checkcast     #151                // class java/lang/Number
     219: invokevirtual #154                // Method java/lang/Number.intValue:()I
     222: istore        7
     224: aload         6
     226: aload_0
     227: invokestatic  #181                // Method main$getNeighbors:(LPoint;Ljava/util/Map;)Ljava/util/List;
     230: invokeinterface #182,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     235: astore        8
     237: aload         8
     239: invokeinterface #93,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     244: ifeq          148
     247: aload         8
     249: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     254: checkcast     #58                 // class Point
     257: astore        9
     259: aload_0
     260: aload         9
     262: invokeinterface #143,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     267: dup
     268: invokestatic  #149                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     271: checkcast     #151                // class java/lang/Number
     274: invokevirtual #154                // Method java/lang/Number.intValue:()I
     277: istore        10
     279: iload         10
     281: iload         7
     283: isub
     284: iconst_1
     285: if_icmpgt     299
     288: aload_3
     289: aload         9
     291: invokeinterface #187,  2          // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
     296: ifeq          302
     299: goto          237
     302: aload_3
     303: aload         9
     305: invokeinterface #188,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
     310: pop
     311: aload         4
     313: new           #139                // class Trace
     316: dup
     317: iload         10
     319: aload         9
     321: aload         6
     323: aload         5
     325: invokevirtual #179                // Method Trace.getDistance:()I
     328: iconst_1
     329: iadd
     330: invokespecial #157                // Method Trace."<init>":(ILPoint;LPoint;I)V
     333: invokevirtual #191                // Method kotlin/collections/ArrayDeque.addLast:(Ljava/lang/Object;)V
     336: goto          237
     339: iconst_m1
     340: ireturn

  private static final Day12Input main$parse(java.util.List<java.lang.String>);
    Code:
       0: aconst_null
       1: astore_1
       2: new           #58                 // class Point
       5: dup
       6: iconst_0
       7: iconst_0
       8: invokespecial #69                 // Method Point."<init>":(II)V
      11: astore_1
      12: aconst_null
      13: astore_2
      14: new           #58                 // class Point
      17: dup
      18: iconst_0
      19: iconst_0
      20: invokespecial #69                 // Method Point."<init>":(II)V
      23: astore_2
      24: aload_0
      25: checkcast     #77                 // class java/lang/Iterable
      28: astore        4
      30: iconst_0
      31: istore        5
      33: aload         4
      35: astore        6
      37: new           #79                 // class java/util/ArrayList
      40: dup
      41: aload         4
      43: bipush        10
      45: invokestatic  #135                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      48: invokespecial #137                // Method java/util/ArrayList."<init>":(I)V
      51: checkcast     #83                 // class java/util/Collection
      54: astore        7
      56: iconst_0
      57: istore        8
      59: iconst_0
      60: istore        9
      62: aload         6
      64: invokeinterface #87,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      69: astore        10
      71: aload         10
      73: invokeinterface #93,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      78: ifeq          331
      81: aload         10
      83: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      88: astore        11
      90: aload         7
      92: iload         9
      94: iinc          9, 1
      97: istore        12
      99: iload         12
     101: ifge          107
     104: invokestatic  #216                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     107: iload         12
     109: aload         11
     111: checkcast     #218                // class java/lang/String
     114: astore        13
     116: istore        14
     118: astore        29
     120: iconst_0
     121: istore        15
     123: aload         13
     125: checkcast     #220                // class java/lang/CharSequence
     128: astore        16
     130: iconst_0
     131: istore        17
     133: aload         16
     135: astore        18
     137: new           #79                 // class java/util/ArrayList
     140: dup
     141: aload         16
     143: invokeinterface #223,  1          // InterfaceMethod java/lang/CharSequence.length:()I
     148: invokespecial #137                // Method java/util/ArrayList."<init>":(I)V
     151: checkcast     #83                 // class java/util/Collection
     154: astore        19
     156: iconst_0
     157: istore        20
     159: iconst_0
     160: istore        21
     162: iconst_0
     163: istore        22
     165: iload         22
     167: aload         18
     169: invokeinterface #223,  1          // InterfaceMethod java/lang/CharSequence.length:()I
     174: if_icmpge     312
     177: aload         18
     179: iload         22
     181: invokeinterface #227,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     186: istore        23
     188: aload         19
     190: iload         21
     192: iinc          21, 1
     195: iload         23
     197: istore        24
     199: istore        25
     201: astore        26
     203: iconst_0
     204: istore        27
     206: iload         24
     208: lookupswitch  { // 2
                    69: 252
                    83: 236
               default: 269
          }
     236: new           #58                 // class Point
     239: dup
     240: iload         14
     242: iload         25
     244: invokespecial #69                 // Method Point."<init>":(II)V
     247: astore_1
     248: iconst_1
     249: goto          276
     252: new           #58                 // class Point
     255: dup
     256: iload         14
     258: iload         25
     260: invokespecial #69                 // Method Point."<init>":(II)V
     263: astore_2
     264: bipush        26
     266: goto          276
     269: iload         24
     271: bipush        97
     273: isub
     274: iconst_1
     275: iadd
     276: istore        28
     278: new           #58                 // class Point
     281: dup
     282: iload         14
     284: iload         25
     286: invokespecial #69                 // Method Point."<init>":(II)V
     289: iload         28
     291: invokestatic  #24                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     294: invokestatic  #233                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     297: aload         26
     299: swap
     300: invokeinterface #106,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     305: pop
     306: iinc          22, 1
     309: goto          165
     312: aload         19
     314: checkcast     #108                // class java/util/List
     317: nop
     318: nop
     319: aload         29
     321: swap
     322: invokeinterface #106,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     327: pop
     328: goto          71
     331: aload         7
     333: checkcast     #108                // class java/util/List
     336: nop
     337: checkcast     #77                 // class java/lang/Iterable
     340: invokestatic  #237                // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;
     343: checkcast     #77                 // class java/lang/Iterable
     346: invokestatic  #243                // Method kotlin/collections/MapsKt.toMap:(Ljava/lang/Iterable;)Ljava/util/Map;
     349: astore_3
     350: new           #245                // class Day12Input
     353: dup
     354: aload_3
     355: aload_1
     356: aload_2
     357: invokespecial #248                // Method Day12Input."<init>":(Ljava/util/Map;LPoint;LPoint;)V
     360: areturn

  private static final int main$part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #267                // Method main$parse:(Ljava/util/List;)LDay12Input;
       4: astore_1
       5: aload_1
       6: invokevirtual #271                // Method Day12Input.getGraph:()Ljava/util/Map;
       9: aload_1
      10: invokevirtual #274                // Method Day12Input.getStart:()LPoint;
      13: invokestatic  #277                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
      16: aload_1
      17: invokevirtual #280                // Method Day12Input.getEnd:()LPoint;
      20: invokestatic  #282                // Method main$search:(Ljava/util/Map;Ljava/util/List;LPoint;)I
      23: ireturn

  private static final int main$part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #267                // Method main$parse:(Ljava/util/List;)LDay12Input;
       4: astore_1
       5: aload_1
       6: invokevirtual #271                // Method Day12Input.getGraph:()Ljava/util/Map;
       9: astore_3
      10: iconst_0
      11: istore        4
      13: aload_3
      14: astore        5
      16: new           #286                // class java/util/LinkedHashMap
      19: dup
      20: invokespecial #287                // Method java/util/LinkedHashMap."<init>":()V
      23: checkcast     #99                 // class java/util/Map
      26: astore        6
      28: iconst_0
      29: istore        7
      31: aload         5
      33: invokeinterface #291,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
      38: invokeinterface #292,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
      43: astore        8
      45: aload         8
      47: invokeinterface #93,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      52: ifeq          124
      55: aload         8
      57: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      62: checkcast     #294                // class java/util/Map$Entry
      65: astore        9
      67: aload         9
      69: astore        10
      71: iconst_0
      72: istore        11
      74: aload         10
      76: invokeinterface #297,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
      81: checkcast     #151                // class java/lang/Number
      84: invokevirtual #154                // Method java/lang/Number.intValue:()I
      87: iconst_1
      88: if_icmpne     95
      91: iconst_1
      92: goto          96
      95: iconst_0
      96: ifeq          45
      99: aload         6
     101: aload         9
     103: invokeinterface #300,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     108: aload         9
     110: invokeinterface #297,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     115: invokeinterface #304,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     120: pop
     121: goto          45
     124: aload         6
     126: nop
     127: astore_3
     128: nop
     129: iconst_0
     130: istore        4
     132: aload_3
     133: astore        5
     135: new           #79                 // class java/util/ArrayList
     138: dup
     139: aload_3
     140: invokeinterface #307,  1          // InterfaceMethod java/util/Map.size:()I
     145: invokespecial #137                // Method java/util/ArrayList."<init>":(I)V
     148: checkcast     #83                 // class java/util/Collection
     151: astore        6
     153: iconst_0
     154: istore        7
     156: aload         5
     158: invokeinterface #291,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     163: invokeinterface #292,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     168: astore        8
     170: aload         8
     172: invokeinterface #93,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     177: ifeq          225
     180: aload         8
     182: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     187: checkcast     #294                // class java/util/Map$Entry
     190: astore        9
     192: aload         6
     194: aload         9
     196: astore        10
     198: astore        12
     200: iconst_0
     201: istore        11
     203: aload         10
     205: invokeinterface #300,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     210: checkcast     #58                 // class Point
     213: aload         12
     215: swap
     216: invokeinterface #106,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     221: pop
     222: goto          170
     225: aload         6
     227: checkcast     #108                // class java/util/List
     230: nop
     231: astore_2
     232: aload_1
     233: invokevirtual #271                // Method Day12Input.getGraph:()Ljava/util/Map;
     236: aload_2
     237: aload_1
     238: invokevirtual #280                // Method Day12Input.getEnd:()LPoint;
     241: invokestatic  #282                // Method main$search:(Ljava/util/Map;Ljava/util/List;LPoint;)I
     244: ireturn
}