package day07

import java.io.File

data class Bid(val hand: String, val bet: Int)

fun main() {
    run(encode1, ::part1)
    run(encode2, ::part2)
}

fun run(encode: Map<Char, Char>, rank: (String) -> Char) {
    val result = File("input.data").readLines().map { parseHand(it, encode, rank) }.sortedBy { it.hand }.withIndex()
        .sumOf { (idx, card) -> (idx + 1) * card.bet }
    println(result)
}

fun parseHand(line: String, encode: Map<Char, Char>, type: (String) -> Char): Bid {
    val (handStr, bet) = line.split(" ")
    val hand = handStr.map { encode[it] }.joinToString(separator = "")
    return Bid(hand = type(handStr) + hand, bet = bet.toInt())
}

fun part1(hand: String): Char {
    val sizes = hand.map { it }.groupBy { it }.map { it.value.size }.sortedBy { -it }
    return type(sizes)
}

fun part2(hand: String): Char {
    val g = hand.map { it }.groupBy { it }.map { it.value }.toList().sortedBy { -it.size }.toList()
    var bestRank = g[0][0]
    if (bestRank == 'J' && g.size > 1) {
        bestRank = g[1][0]
    }
    val sizes =
        hand.replace('J', bestRank).map { it }.groupBy { it }.map { it.value.size }.sortedBy { -it }
            .toList()

    return type(sizes)
}

fun type(sizes: List<Int>): Char = when (sizes[0]) {
    1 -> 'a'        // high card
    2 -> when (sizes[1]) {
        1 -> 'b'    // pair
        else -> 'c' // two pair
    }

    3 -> when (sizes[1]) {
        1 -> 'd'    // three of a kind
        else -> 'e' // full house
    }

    4 -> 'f'        // four of a kind
    5 -> 'g'        // 5 aces?
    else -> 'x'
}

// encode rank to sortable code
val encode1 = mapOf(
    '2' to 'b',
    '3' to 'c',
    '4' to 'd',
    '5' to 'e',
    '6' to 'f',
    '7' to 'g',
    '8' to 'h',
    '9' to 'i',
    'T' to 'j',
    'J' to 'k',
    'Q' to 'l',
    'K' to 'm',
    'A' to 'n',
)

// encode rank to sortable code
val encode2 = mapOf(
    'J' to 'a',
    '2' to 'b',
    '3' to 'c',
    '4' to 'd',
    '5' to 'e',
    '6' to 'f',
    '7' to 'g',
    '8' to 'h',
    '9' to 'i',
    'T' to 'j',
    'Q' to 'l',
    'K' to 'm',
    'A' to 'n',
)

//251927063
//255632664

Compiled from "Comparisons.kt"
public final class day07.Day07Kt$part1$$inlined$sortedBy$1<T> implements java.util.Comparator {
  public day07.Day07Kt$part1$$inlined$sortedBy$1();
    Code:
       0: aload_0
       1: invokespecial #16                 // Method java/lang/Object."<init>":()V
       4: return

  public final int compare(T, T);
    Code:
       0: aload_1
       1: checkcast     #23                 // class java/lang/Number
       4: invokevirtual #27                 // Method java/lang/Number.intValue:()I
       7: istore_3
       8: iconst_0
       9: istore        4
      11: iload_3
      12: ineg
      13: invokestatic  #33                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      16: checkcast     #35                 // class java/lang/Comparable
      19: aload_2
      20: checkcast     #23                 // class java/lang/Number
      23: invokevirtual #27                 // Method java/lang/Number.intValue:()I
      26: istore_3
      27: astore        5
      29: iconst_0
      30: istore        4
      32: iload_3
      33: ineg
      34: invokestatic  #33                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      37: aload         5
      39: swap
      40: checkcast     #35                 // class java/lang/Comparable
      43: invokestatic  #41                 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I
      46: ireturn
}

Compiled from "day07.kt"
public final class day07.Day07Kt {
  private static final java.util.Map<java.lang.Character, java.lang.Character> encode1;

  private static final java.util.Map<java.lang.Character, java.lang.Character> encode2;

  public static final void main();
    Code:
       0: getstatic     #10                 // Field encode1:Ljava/util/Map;
       3: getstatic     #16                 // Field day07/Day07Kt$main$1.INSTANCE:Lday07/Day07Kt$main$1;
       6: checkcast     #18                 // class kotlin/jvm/functions/Function1
       9: invokestatic  #22                 // Method run:(Ljava/util/Map;Lkotlin/jvm/functions/Function1;)V
      12: getstatic     #25                 // Field encode2:Ljava/util/Map;
      15: getstatic     #30                 // Field day07/Day07Kt$main$2.INSTANCE:Lday07/Day07Kt$main$2;
      18: checkcast     #18                 // class kotlin/jvm/functions/Function1
      21: invokestatic  #22                 // Method run:(Ljava/util/Map;Lkotlin/jvm/functions/Function1;)V
      24: return

  public static final void run(java.util.Map<java.lang.Character, java.lang.Character>, kotlin.jvm.functions.Function1<? super java.lang.String, java.lang.Character>);
    Code:
       0: aload_0
       1: ldc           #34                 // String encode
       3: invokestatic  #40                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #42                 // String rank
       9: invokestatic  #40                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: new           #44                 // class java/io/File
      15: dup
      16: ldc           #46                 // String input.data
      18: invokespecial #50                 // Method java/io/File."<init>":(Ljava/lang/String;)V
      21: aconst_null
      22: iconst_1
      23: aconst_null
      24: invokestatic  #56                 // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;
      27: checkcast     #58                 // class java/lang/Iterable
      30: astore_3
      31: iconst_0
      32: istore        4
      34: aload_3
      35: astore        5
      37: new           #60                 // class java/util/ArrayList
      40: dup
      41: aload_3
      42: bipush        10
      44: invokestatic  #66                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      47: invokespecial #69                 // Method java/util/ArrayList."<init>":(I)V
      50: checkcast     #71                 // class java/util/Collection
      53: astore        6
      55: iconst_0
      56: istore        7
      58: aload         5
      60: invokeinterface #75,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      65: astore        8
      67: aload         8
      69: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      74: ifeq          119
      77: aload         8
      79: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      84: astore        9
      86: aload         6
      88: aload         9
      90: checkcast     #87                 // class java/lang/String
      93: astore        10
      95: astore        12
      97: iconst_0
      98: istore        11
     100: aload         10
     102: aload_0
     103: aload_1
     104: invokestatic  #91                 // Method parseHand:(Ljava/lang/String;Ljava/util/Map;Lkotlin/jvm/functions/Function1;)Lday07/Bid;
     107: aload         12
     109: swap
     110: invokeinterface #95,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     115: pop
     116: goto          67
     119: aload         6
     121: checkcast     #97                 // class java/util/List
     124: nop
     125: checkcast     #58                 // class java/lang/Iterable
     128: astore_3
     129: nop
     130: iconst_0
     131: istore        4
     133: aload_3
     134: new           #99                 // class day07/Day07Kt$run$$inlined$sortedBy$1
     137: dup
     138: invokespecial #101                // Method day07/Day07Kt$run$$inlined$sortedBy$1."<init>":()V
     141: checkcast     #103                // class java/util/Comparator
     144: invokestatic  #107                // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
     147: checkcast     #58                 // class java/lang/Iterable
     150: invokestatic  #111                // Method kotlin/collections/CollectionsKt.withIndex:(Ljava/lang/Iterable;)Ljava/lang/Iterable;
     153: astore_3
     154: iconst_0
     155: istore        4
     157: aload_3
     158: invokeinterface #75,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     163: astore        5
     165: aload         5
     167: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     172: ifeq          237
     175: aload         5
     177: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     182: astore        6
     184: iload         4
     186: aload         6
     188: checkcast     #113                // class kotlin/collections/IndexedValue
     191: astore        7
     193: istore        12
     195: iconst_0
     196: istore        8
     198: aload         7
     200: invokevirtual #117                // Method kotlin/collections/IndexedValue.component1:()I
     203: istore        9
     205: aload         7
     207: invokevirtual #120                // Method kotlin/collections/IndexedValue.component2:()Ljava/lang/Object;
     210: checkcast     #122                // class day07/Bid
     213: astore        10
     215: iload         9
     217: iconst_1
     218: iadd
     219: aload         10
     221: invokevirtual #125                // Method day07/Bid.getBet:()I
     224: imul
     225: istore        13
     227: iload         12
     229: iload         13
     231: iadd
     232: istore        4
     234: goto          165
     237: iload         4
     239: istore_2
     240: getstatic     #131                // Field java/lang/System.out:Ljava/io/PrintStream;
     243: iload_2
     244: invokevirtual #136                // Method java/io/PrintStream.println:(I)V
     247: return

  public static final day07.Bid parseHand(java.lang.String, java.util.Map<java.lang.Character, java.lang.Character>, kotlin.jvm.functions.Function1<? super java.lang.String, java.lang.Character>);
    Code:
       0: aload_0
       1: ldc           #162                // String line
       3: invokestatic  #40                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #34                 // String encode
       9: invokestatic  #40                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_2
      13: ldc           #164                // String type
      15: invokestatic  #40                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: aload_0
      19: checkcast     #166                // class java/lang/CharSequence
      22: iconst_1
      23: anewarray     #87                 // class java/lang/String
      26: astore        4
      28: aload         4
      30: iconst_0
      31: ldc           #168                // String
      33: aastore
      34: aload         4
      36: iconst_0
      37: iconst_0
      38: bipush        6
      40: aconst_null
      41: invokestatic  #174                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      44: astore_3
      45: aload_3
      46: iconst_0
      47: invokeinterface #178,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      52: checkcast     #87                 // class java/lang/String
      55: astore        4
      57: aload_3
      58: iconst_1
      59: invokeinterface #178,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      64: checkcast     #87                 // class java/lang/String
      67: astore        5
      69: aload         4
      71: checkcast     #166                // class java/lang/CharSequence
      74: astore        7
      76: iconst_0
      77: istore        8
      79: aload         7
      81: astore        9
      83: new           #60                 // class java/util/ArrayList
      86: dup
      87: aload         7
      89: invokeinterface #181,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      94: invokespecial #69                 // Method java/util/ArrayList."<init>":(I)V
      97: checkcast     #71                 // class java/util/Collection
     100: astore        10
     102: iconst_0
     103: istore        11
     105: iconst_0
     106: istore        12
     108: iload         12
     110: aload         9
     112: invokeinterface #181,  1          // InterfaceMethod java/lang/CharSequence.length:()I
     117: if_icmpge     171
     120: aload         9
     122: iload         12
     124: invokeinterface #185,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     129: istore        13
     131: aload         10
     133: iload         13
     135: istore        14
     137: astore        16
     139: iconst_0
     140: istore        15
     142: aload_1
     143: iload         14
     145: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     148: invokeinterface #194,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     153: checkcast     #187                // class java/lang/Character
     156: aload         16
     158: swap
     159: invokeinterface #95,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     164: pop
     165: iinc          12, 1
     168: goto          108
     171: aload         10
     173: checkcast     #97                 // class java/util/List
     176: nop
     177: checkcast     #58                 // class java/lang/Iterable
     180: ldc           #196                // String
     182: checkcast     #166                // class java/lang/CharSequence
     185: aconst_null
     186: aconst_null
     187: iconst_0
     188: aconst_null
     189: aconst_null
     190: bipush        62
     192: aconst_null
     193: invokestatic  #200                // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
     196: astore        6
     198: new           #122                // class day07/Bid
     201: dup
     202: aload_2
     203: aload         4
     205: invokeinterface #203,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
     210: checkcast     #187                // class java/lang/Character
     213: invokevirtual #207                // Method java/lang/Character.charValue:()C
     216: istore        7
     218: new           #209                // class java/lang/StringBuilder
     221: dup
     222: invokespecial #210                // Method java/lang/StringBuilder."<init>":()V
     225: iload         7
     227: invokevirtual #214                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     230: aload         6
     232: invokevirtual #217                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     235: invokevirtual #221                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     238: aload         5
     240: invokestatic  #227                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     243: invokespecial #230                // Method day07/Bid."<init>":(Ljava/lang/String;I)V
     246: areturn

  public static final char part1(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #239                // String hand
       3: invokestatic  #40                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #166                // class java/lang/CharSequence
      10: astore_2
      11: iconst_0
      12: istore_3
      13: aload_2
      14: astore        4
      16: new           #60                 // class java/util/ArrayList
      19: dup
      20: aload_2
      21: invokeinterface #181,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      26: invokespecial #69                 // Method java/util/ArrayList."<init>":(I)V
      29: checkcast     #71                 // class java/util/Collection
      32: astore        5
      34: iconst_0
      35: istore        6
      37: iconst_0
      38: istore        7
      40: iload         7
      42: aload         4
      44: invokeinterface #181,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      49: if_icmpge     94
      52: aload         4
      54: iload         7
      56: invokeinterface #185,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
      61: istore        8
      63: aload         5
      65: iload         8
      67: istore        9
      69: astore        16
      71: iconst_0
      72: istore        10
      74: iload         9
      76: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      79: aload         16
      81: swap
      82: invokeinterface #95,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      87: pop
      88: iinc          7, 1
      91: goto          40
      94: aload         5
      96: checkcast     #97                 // class java/util/List
      99: nop
     100: checkcast     #58                 // class java/lang/Iterable
     103: astore_2
     104: nop
     105: iconst_0
     106: istore_3
     107: aload_2
     108: astore        4
     110: new           #241                // class java/util/LinkedHashMap
     113: dup
     114: invokespecial #242                // Method java/util/LinkedHashMap."<init>":()V
     117: checkcast     #159                // class java/util/Map
     120: astore        5
     122: iconst_0
     123: istore        6
     125: aload         4
     127: invokeinterface #75,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     132: astore        7
     134: aload         7
     136: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     141: ifeq          249
     144: aload         7
     146: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     151: astore        8
     153: aload         8
     155: checkcast     #187                // class java/lang/Character
     158: invokevirtual #207                // Method java/lang/Character.charValue:()C
     161: istore        9
     163: iconst_0
     164: istore        10
     166: iload         9
     168: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     171: astore        11
     173: aload         5
     175: astore        12
     177: iconst_0
     178: istore        13
     180: aload         12
     182: aload         11
     184: invokeinterface #194,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     189: astore        14
     191: aload         14
     193: ifnonnull     228
     196: iconst_0
     197: istore        15
     199: new           #60                 // class java/util/ArrayList
     202: dup
     203: invokespecial #243                // Method java/util/ArrayList."<init>":()V
     206: checkcast     #97                 // class java/util/List
     209: astore        15
     211: aload         12
     213: aload         11
     215: aload         15
     217: invokeinterface #247,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     222: pop
     223: aload         15
     225: goto          230
     228: aload         14
     230: nop
     231: checkcast     #97                 // class java/util/List
     234: astore        9
     236: aload         9
     238: aload         8
     240: invokeinterface #248,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     245: pop
     246: goto          134
     249: aload         5
     251: nop
     252: astore_2
     253: nop
     254: iconst_0
     255: istore_3
     256: aload_2
     257: astore        4
     259: new           #60                 // class java/util/ArrayList
     262: dup
     263: aload_2
     264: invokeinterface #251,  1          // InterfaceMethod java/util/Map.size:()I
     269: invokespecial #69                 // Method java/util/ArrayList."<init>":(I)V
     272: checkcast     #71                 // class java/util/Collection
     275: astore        5
     277: iconst_0
     278: istore        6
     280: aload         4
     282: invokeinterface #255,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     287: invokeinterface #258,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     292: astore        7
     294: aload         7
     296: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     301: ifeq          357
     304: aload         7
     306: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     311: checkcast     #260                // class java/util/Map$Entry
     314: astore        8
     316: aload         5
     318: aload         8
     320: astore        9
     322: astore        16
     324: iconst_0
     325: istore        10
     327: aload         9
     329: invokeinterface #263,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     334: checkcast     #97                 // class java/util/List
     337: invokeinterface #264,  1          // InterfaceMethod java/util/List.size:()I
     342: invokestatic  #267                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     345: aload         16
     347: swap
     348: invokeinterface #95,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     353: pop
     354: goto          294
     357: aload         5
     359: checkcast     #97                 // class java/util/List
     362: nop
     363: checkcast     #58                 // class java/lang/Iterable
     366: astore_2
     367: nop
     368: iconst_0
     369: istore_3
     370: aload_2
     371: new           #269                // class day07/Day07Kt$part1$$inlined$sortedBy$1
     374: dup
     375: invokespecial #270                // Method day07/Day07Kt$part1$$inlined$sortedBy$1."<init>":()V
     378: checkcast     #103                // class java/util/Comparator
     381: invokestatic  #107                // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
     384: astore_1
     385: aload_1
     386: invokestatic  #273                // Method type:(Ljava/util/List;)C
     389: ireturn

  public static final char part2(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #239                // String hand
       3: invokestatic  #40                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #166                // class java/lang/CharSequence
      10: astore_2
      11: iconst_0
      12: istore_3
      13: aload_2
      14: astore        4
      16: new           #60                 // class java/util/ArrayList
      19: dup
      20: aload_2
      21: invokeinterface #181,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      26: invokespecial #69                 // Method java/util/ArrayList."<init>":(I)V
      29: checkcast     #71                 // class java/util/Collection
      32: astore        5
      34: iconst_0
      35: istore        6
      37: iconst_0
      38: istore        7
      40: iload         7
      42: aload         4
      44: invokeinterface #181,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      49: if_icmpge     94
      52: aload         4
      54: iload         7
      56: invokeinterface #185,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
      61: istore        8
      63: aload         5
      65: iload         8
      67: istore        9
      69: astore        18
      71: iconst_0
      72: istore        10
      74: iload         9
      76: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      79: aload         18
      81: swap
      82: invokeinterface #95,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      87: pop
      88: iinc          7, 1
      91: goto          40
      94: aload         5
      96: checkcast     #97                 // class java/util/List
      99: nop
     100: checkcast     #58                 // class java/lang/Iterable
     103: astore_2
     104: nop
     105: iconst_0
     106: istore_3
     107: aload_2
     108: astore        4
     110: new           #241                // class java/util/LinkedHashMap
     113: dup
     114: invokespecial #242                // Method java/util/LinkedHashMap."<init>":()V
     117: checkcast     #159                // class java/util/Map
     120: astore        5
     122: iconst_0
     123: istore        6
     125: aload         4
     127: invokeinterface #75,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     132: astore        7
     134: aload         7
     136: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     141: ifeq          249
     144: aload         7
     146: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     151: astore        8
     153: aload         8
     155: checkcast     #187                // class java/lang/Character
     158: invokevirtual #207                // Method java/lang/Character.charValue:()C
     161: istore        9
     163: iconst_0
     164: istore        10
     166: iload         9
     168: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     171: astore        11
     173: aload         5
     175: astore        12
     177: iconst_0
     178: istore        13
     180: aload         12
     182: aload         11
     184: invokeinterface #194,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     189: astore        14
     191: aload         14
     193: ifnonnull     228
     196: iconst_0
     197: istore        15
     199: new           #60                 // class java/util/ArrayList
     202: dup
     203: invokespecial #243                // Method java/util/ArrayList."<init>":()V
     206: checkcast     #97                 // class java/util/List
     209: astore        15
     211: aload         12
     213: aload         11
     215: aload         15
     217: invokeinterface #247,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     222: pop
     223: aload         15
     225: goto          230
     228: aload         14
     230: nop
     231: checkcast     #97                 // class java/util/List
     234: astore        9
     236: aload         9
     238: aload         8
     240: invokeinterface #248,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     245: pop
     246: goto          134
     249: aload         5
     251: nop
     252: astore_2
     253: nop
     254: iconst_0
     255: istore_3
     256: aload_2
     257: astore        4
     259: new           #60                 // class java/util/ArrayList
     262: dup
     263: aload_2
     264: invokeinterface #251,  1          // InterfaceMethod java/util/Map.size:()I
     269: invokespecial #69                 // Method java/util/ArrayList."<init>":(I)V
     272: checkcast     #71                 // class java/util/Collection
     275: astore        5
     277: iconst_0
     278: istore        6
     280: aload         4
     282: invokeinterface #255,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     287: invokeinterface #258,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     292: astore        7
     294: aload         7
     296: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     301: ifeq          349
     304: aload         7
     306: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     311: checkcast     #260                // class java/util/Map$Entry
     314: astore        8
     316: aload         5
     318: aload         8
     320: astore        9
     322: astore        18
     324: iconst_0
     325: istore        10
     327: aload         9
     329: invokeinterface #263,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     334: checkcast     #97                 // class java/util/List
     337: aload         18
     339: swap
     340: invokeinterface #95,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     345: pop
     346: goto          294
     349: aload         5
     351: checkcast     #97                 // class java/util/List
     354: nop
     355: checkcast     #58                 // class java/lang/Iterable
     358: invokestatic  #296                // Method kotlin/collections/CollectionsKt.toList:(Ljava/lang/Iterable;)Ljava/util/List;
     361: checkcast     #58                 // class java/lang/Iterable
     364: astore_2
     365: iconst_0
     366: istore_3
     367: aload_2
     368: new           #298                // class day07/Day07Kt$part2$$inlined$sortedBy$1
     371: dup
     372: invokespecial #299                // Method day07/Day07Kt$part2$$inlined$sortedBy$1."<init>":()V
     375: checkcast     #103                // class java/util/Comparator
     378: invokestatic  #107                // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
     381: checkcast     #58                 // class java/lang/Iterable
     384: invokestatic  #296                // Method kotlin/collections/CollectionsKt.toList:(Ljava/lang/Iterable;)Ljava/util/List;
     387: astore_1
     388: aload_1
     389: iconst_0
     390: invokeinterface #178,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     395: checkcast     #97                 // class java/util/List
     398: iconst_0
     399: invokeinterface #178,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     404: checkcast     #187                // class java/lang/Character
     407: invokevirtual #207                // Method java/lang/Character.charValue:()C
     410: istore_2
     411: iload_2
     412: bipush        74
     414: if_icmpne     450
     417: aload_1
     418: invokeinterface #264,  1          // InterfaceMethod java/util/List.size:()I
     423: iconst_1
     424: if_icmple     450
     427: aload_1
     428: iconst_1
     429: invokeinterface #178,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     434: checkcast     #97                 // class java/util/List
     437: iconst_0
     438: invokeinterface #178,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     443: checkcast     #187                // class java/lang/Character
     446: invokevirtual #207                // Method java/lang/Character.charValue:()C
     449: istore_2
     450: aload_0
     451: bipush        74
     453: iload_2
     454: iconst_0
     455: iconst_4
     456: aconst_null
     457: invokestatic  #303                // Method kotlin/text/StringsKt.replace$default:(Ljava/lang/String;CCZILjava/lang/Object;)Ljava/lang/String;
     460: checkcast     #166                // class java/lang/CharSequence
     463: astore        4
     465: iconst_0
     466: istore        5
     468: aload         4
     470: astore        6
     472: new           #60                 // class java/util/ArrayList
     475: dup
     476: aload         4
     478: invokeinterface #181,  1          // InterfaceMethod java/lang/CharSequence.length:()I
     483: invokespecial #69                 // Method java/util/ArrayList."<init>":(I)V
     486: checkcast     #71                 // class java/util/Collection
     489: astore        7
     491: iconst_0
     492: istore        8
     494: iconst_0
     495: istore        9
     497: iload         9
     499: aload         6
     501: invokeinterface #181,  1          // InterfaceMethod java/lang/CharSequence.length:()I
     506: if_icmpge     551
     509: aload         6
     511: iload         9
     513: invokeinterface #185,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     518: istore        10
     520: aload         7
     522: iload         10
     524: istore        11
     526: astore        18
     528: iconst_0
     529: istore        12
     531: iload         11
     533: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     536: aload         18
     538: swap
     539: invokeinterface #95,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     544: pop
     545: iinc          9, 1
     548: goto          497
     551: aload         7
     553: checkcast     #97                 // class java/util/List
     556: nop
     557: checkcast     #58                 // class java/lang/Iterable
     560: astore        4
     562: nop
     563: iconst_0
     564: istore        5
     566: aload         4
     568: astore        6
     570: new           #241                // class java/util/LinkedHashMap
     573: dup
     574: invokespecial #242                // Method java/util/LinkedHashMap."<init>":()V
     577: checkcast     #159                // class java/util/Map
     580: astore        7
     582: iconst_0
     583: istore        8
     585: aload         6
     587: invokeinterface #75,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     592: astore        9
     594: aload         9
     596: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     601: ifeq          709
     604: aload         9
     606: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     611: astore        10
     613: aload         10
     615: checkcast     #187                // class java/lang/Character
     618: invokevirtual #207                // Method java/lang/Character.charValue:()C
     621: istore        11
     623: iconst_0
     624: istore        12
     626: iload         11
     628: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     631: astore        13
     633: aload         7
     635: astore        14
     637: iconst_0
     638: istore        15
     640: aload         14
     642: aload         13
     644: invokeinterface #194,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     649: astore        16
     651: aload         16
     653: ifnonnull     688
     656: iconst_0
     657: istore        17
     659: new           #60                 // class java/util/ArrayList
     662: dup
     663: invokespecial #243                // Method java/util/ArrayList."<init>":()V
     666: checkcast     #97                 // class java/util/List
     669: astore        17
     671: aload         14
     673: aload         13
     675: aload         17
     677: invokeinterface #247,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     682: pop
     683: aload         17
     685: goto          690
     688: aload         16
     690: nop
     691: checkcast     #97                 // class java/util/List
     694: astore        11
     696: aload         11
     698: aload         10
     700: invokeinterface #248,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     705: pop
     706: goto          594
     709: aload         7
     711: nop
     712: astore        4
     714: nop
     715: iconst_0
     716: istore        5
     718: aload         4
     720: astore        6
     722: new           #60                 // class java/util/ArrayList
     725: dup
     726: aload         4
     728: invokeinterface #251,  1          // InterfaceMethod java/util/Map.size:()I
     733: invokespecial #69                 // Method java/util/ArrayList."<init>":(I)V
     736: checkcast     #71                 // class java/util/Collection
     739: astore        7
     741: iconst_0
     742: istore        8
     744: aload         6
     746: invokeinterface #255,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     751: invokeinterface #258,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     756: astore        9
     758: aload         9
     760: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     765: ifeq          821
     768: aload         9
     770: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     775: checkcast     #260                // class java/util/Map$Entry
     778: astore        10
     780: aload         7
     782: aload         10
     784: astore        11
     786: astore        18
     788: iconst_0
     789: istore        12
     791: aload         11
     793: invokeinterface #263,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     798: checkcast     #97                 // class java/util/List
     801: invokeinterface #264,  1          // InterfaceMethod java/util/List.size:()I
     806: invokestatic  #267                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     809: aload         18
     811: swap
     812: invokeinterface #95,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     817: pop
     818: goto          758
     821: aload         7
     823: checkcast     #97                 // class java/util/List
     826: nop
     827: checkcast     #58                 // class java/lang/Iterable
     830: astore        4
     832: nop
     833: iconst_0
     834: istore        5
     836: aload         4
     838: new           #305                // class day07/Day07Kt$part2$$inlined$sortedBy$2
     841: dup
     842: invokespecial #306                // Method day07/Day07Kt$part2$$inlined$sortedBy$2."<init>":()V
     845: checkcast     #103                // class java/util/Comparator
     848: invokestatic  #107                // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
     851: checkcast     #58                 // class java/lang/Iterable
     854: invokestatic  #296                // Method kotlin/collections/CollectionsKt.toList:(Ljava/lang/Iterable;)Ljava/util/List;
     857: astore_3
     858: aload_3
     859: invokestatic  #273                // Method type:(Ljava/util/List;)C
     862: ireturn

  public static final char type(java.util.List<java.lang.Integer>);
    Code:
       0: aload_0
       1: ldc_w         #316                // String sizes
       4: invokestatic  #40                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: iconst_0
       9: invokeinterface #178,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      14: checkcast     #318                // class java/lang/Number
      17: invokevirtual #321                // Method java/lang/Number.intValue:()I
      20: tableswitch   { // 1 to 5
                     1: 56
                     2: 61
                     3: 88
                     4: 115
                     5: 120
               default: 125
          }
      56: bipush        97
      58: goto          127
      61: aload_0
      62: iconst_1
      63: invokeinterface #178,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      68: checkcast     #318                // class java/lang/Number
      71: invokevirtual #321                // Method java/lang/Number.intValue:()I
      74: iconst_1
      75: if_icmpne     83
      78: bipush        98
      80: goto          127
      83: bipush        99
      85: goto          127
      88: aload_0
      89: iconst_1
      90: invokeinterface #178,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      95: checkcast     #318                // class java/lang/Number
      98: invokevirtual #321                // Method java/lang/Number.intValue:()I
     101: iconst_1
     102: if_icmpne     110
     105: bipush        100
     107: goto          127
     110: bipush        101
     112: goto          127
     115: bipush        102
     117: goto          127
     120: bipush        103
     122: goto          127
     125: bipush        120
     127: ireturn

  public static final java.util.Map<java.lang.Character, java.lang.Character> getEncode1();
    Code:
       0: getstatic     #10                 // Field encode1:Ljava/util/Map;
       3: areturn

  public static final java.util.Map<java.lang.Character, java.lang.Character> getEncode2();
    Code:
       0: getstatic     #25                 // Field encode2:Ljava/util/Map;
       3: areturn

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

  static {};
    Code:
       0: bipush        13
       2: anewarray     #333                // class kotlin/Pair
       5: astore_0
       6: aload_0
       7: iconst_0
       8: bipush        50
      10: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      13: bipush        98
      15: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      18: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      21: aastore
      22: aload_0
      23: iconst_1
      24: bipush        51
      26: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      29: bipush        99
      31: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      34: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      37: aastore
      38: aload_0
      39: iconst_2
      40: bipush        52
      42: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      45: bipush        100
      47: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      50: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      53: aastore
      54: aload_0
      55: iconst_3
      56: bipush        53
      58: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      61: bipush        101
      63: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      66: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      69: aastore
      70: aload_0
      71: iconst_4
      72: bipush        54
      74: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      77: bipush        102
      79: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      82: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      85: aastore
      86: aload_0
      87: iconst_5
      88: bipush        55
      90: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      93: bipush        103
      95: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      98: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     101: aastore
     102: aload_0
     103: bipush        6
     105: bipush        56
     107: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     110: bipush        104
     112: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     115: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     118: aastore
     119: aload_0
     120: bipush        7
     122: bipush        57
     124: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     127: bipush        105
     129: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     132: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     135: aastore
     136: aload_0
     137: bipush        8
     139: bipush        84
     141: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     144: bipush        106
     146: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     149: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     152: aastore
     153: aload_0
     154: bipush        9
     156: bipush        74
     158: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     161: bipush        107
     163: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     166: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     169: aastore
     170: aload_0
     171: bipush        10
     173: bipush        81
     175: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     178: bipush        108
     180: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     183: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     186: aastore
     187: aload_0
     188: bipush        11
     190: bipush        75
     192: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     195: bipush        109
     197: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     200: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     203: aastore
     204: aload_0
     205: bipush        12
     207: bipush        65
     209: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     212: bipush        110
     214: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     217: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     220: aastore
     221: aload_0
     222: invokestatic  #345                // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;
     225: putstatic     #10                 // Field encode1:Ljava/util/Map;
     228: bipush        13
     230: anewarray     #333                // class kotlin/Pair
     233: astore_0
     234: aload_0
     235: iconst_0
     236: bipush        74
     238: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     241: bipush        97
     243: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     246: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     249: aastore
     250: aload_0
     251: iconst_1
     252: bipush        50
     254: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     257: bipush        98
     259: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     262: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     265: aastore
     266: aload_0
     267: iconst_2
     268: bipush        51
     270: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     273: bipush        99
     275: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     278: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     281: aastore
     282: aload_0
     283: iconst_3
     284: bipush        52
     286: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     289: bipush        100
     291: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     294: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     297: aastore
     298: aload_0
     299: iconst_4
     300: bipush        53
     302: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     305: bipush        101
     307: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     310: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     313: aastore
     314: aload_0
     315: iconst_5
     316: bipush        54
     318: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     321: bipush        102
     323: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     326: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     329: aastore
     330: aload_0
     331: bipush        6
     333: bipush        55
     335: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     338: bipush        103
     340: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     343: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     346: aastore
     347: aload_0
     348: bipush        7
     350: bipush        56
     352: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     355: bipush        104
     357: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     360: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     363: aastore
     364: aload_0
     365: bipush        8
     367: bipush        57
     369: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     372: bipush        105
     374: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     377: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     380: aastore
     381: aload_0
     382: bipush        9
     384: bipush        84
     386: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     389: bipush        106
     391: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     394: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     397: aastore
     398: aload_0
     399: bipush        10
     401: bipush        81
     403: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     406: bipush        108
     408: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     411: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     414: aastore
     415: aload_0
     416: bipush        11
     418: bipush        75
     420: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     423: bipush        109
     425: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     428: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     431: aastore
     432: aload_0
     433: bipush        12
     435: bipush        65
     437: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     440: bipush        110
     442: invokestatic  #191                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     445: invokestatic  #339                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     448: aastore
     449: aload_0
     450: invokestatic  #345                // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;
     453: putstatic     #25                 // Field encode2:Ljava/util/Map;
     456: return
}

Compiled from "Comparisons.kt"
public final class day07.Day07Kt$run$$inlined$sortedBy$1<T> implements java.util.Comparator {
  public day07.Day07Kt$run$$inlined$sortedBy$1();
    Code:
       0: aload_0
       1: invokespecial #16                 // Method java/lang/Object."<init>":()V
       4: return

  public final int compare(T, T);
    Code:
       0: aload_1
       1: checkcast     #23                 // class day07/Bid
       4: astore_3
       5: iconst_0
       6: istore        4
       8: aload_3
       9: invokevirtual #27                 // Method day07/Bid.getHand:()Ljava/lang/String;
      12: checkcast     #29                 // class java/lang/Comparable
      15: aload_2
      16: checkcast     #23                 // class day07/Bid
      19: astore_3
      20: astore        5
      22: iconst_0
      23: istore        4
      25: aload_3
      26: invokevirtual #27                 // Method day07/Bid.getHand:()Ljava/lang/String;
      29: aload         5
      31: swap
      32: checkcast     #29                 // class java/lang/Comparable
      35: invokestatic  #35                 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I
      38: ireturn
}

Compiled from "day07.kt"
final class day07.Day07Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.lang.String, java.lang.Character> {
  public static final day07.Day07Kt$main$1 INSTANCE;

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

  public final java.lang.Character invoke(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #24                 // String p0
       3: invokestatic  #30                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: invokestatic  #33                 // Method day07/Day07Kt.part1:(Ljava/lang/String;)C
      10: invokestatic  #39                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      13: areturn

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

  static {};
    Code:
       0: new           #2                  // class day07/Day07Kt$main$1
       3: dup
       4: invokespecial #50                 // Method "<init>":()V
       7: putstatic     #53                 // Field INSTANCE:Lday07/Day07Kt$main$1;
      10: return
}

Compiled from "Comparisons.kt"
public final class day07.Day07Kt$part2$$inlined$sortedBy$1<T> implements java.util.Comparator {
  public day07.Day07Kt$part2$$inlined$sortedBy$1();
    Code:
       0: aload_0
       1: invokespecial #16                 // Method java/lang/Object."<init>":()V
       4: return

  public final int compare(T, T);
    Code:
       0: aload_1
       1: checkcast     #23                 // class java/util/List
       4: astore_3
       5: iconst_0
       6: istore        4
       8: aload_3
       9: invokeinterface #27,  1           // InterfaceMethod java/util/List.size:()I
      14: ineg
      15: invokestatic  #33                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      18: checkcast     #35                 // class java/lang/Comparable
      21: aload_2
      22: checkcast     #23                 // class java/util/List
      25: astore_3
      26: astore        5
      28: iconst_0
      29: istore        4
      31: aload_3
      32: invokeinterface #27,  1           // InterfaceMethod java/util/List.size:()I
      37: ineg
      38: invokestatic  #33                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      41: aload         5
      43: swap
      44: checkcast     #35                 // class java/lang/Comparable
      47: invokestatic  #41                 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I
      50: ireturn
}

Compiled from "day07.kt"
final class day07.Day07Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.lang.String, java.lang.Character> {
  public static final day07.Day07Kt$main$2 INSTANCE;

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

  public final java.lang.Character invoke(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #24                 // String p0
       3: invokestatic  #30                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: invokestatic  #33                 // Method day07/Day07Kt.part2:(Ljava/lang/String;)C
      10: invokestatic  #39                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      13: areturn

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

  static {};
    Code:
       0: new           #2                  // class day07/Day07Kt$main$2
       3: dup
       4: invokespecial #50                 // Method "<init>":()V
       7: putstatic     #53                 // Field INSTANCE:Lday07/Day07Kt$main$2;
      10: return
}

Compiled from "Comparisons.kt"
public final class day07.Day07Kt$part2$$inlined$sortedBy$2<T> implements java.util.Comparator {
  public day07.Day07Kt$part2$$inlined$sortedBy$2();
    Code:
       0: aload_0
       1: invokespecial #16                 // Method java/lang/Object."<init>":()V
       4: return

  public final int compare(T, T);
    Code:
       0: aload_1
       1: checkcast     #23                 // class java/lang/Number
       4: invokevirtual #27                 // Method java/lang/Number.intValue:()I
       7: istore_3
       8: iconst_0
       9: istore        4
      11: iload_3
      12: ineg
      13: invokestatic  #33                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      16: checkcast     #35                 // class java/lang/Comparable
      19: aload_2
      20: checkcast     #23                 // class java/lang/Number
      23: invokevirtual #27                 // Method java/lang/Number.intValue:()I
      26: istore_3
      27: astore        5
      29: iconst_0
      30: istore        4
      32: iload_3
      33: ineg
      34: invokestatic  #33                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      37: aload         5
      39: swap
      40: checkcast     #35                 // class java/lang/Comparable
      43: invokestatic  #41                 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I
      46: ireturn
}


package day08

import java.io.File

data class Targets(val left: String, val right: String)

fun main() {
    run(start = { it == "AAA" }, end = { it == "ZZZ" })
    run(start = { it.endsWith('A') }, end = { it.endsWith('Z') })
}

fun run(start: (String) -> Boolean, end: (String) -> Boolean) {
    val lines = File("input.data").readLines()
    val turns = turnSequence(lines[0])
    val instructions = parseInstructions(lines.drop(2))
    var totalSteps = 1L
    for (startPlace in instructions.keys.filter(start)) {
        var place = startPlace
        var steps = 0L
        for (turn in turns) {
            steps++
            val targets = instructions[place]!!
            place = if (turn == 'L') targets.left else targets.right

            if (end(place)) break
        }
        totalSteps = lcm(totalSteps, steps)
    }
    println(totalSteps)
}

fun parseInstructions(lines: List<String>): Map<String, Targets> {
    val result = mutableMapOf<String, Targets>()
    for (line in lines) {
        val parts = line.split(" = (", ", ", ")")
        result[parts[0]] = Targets(left = parts[1], right = parts[2])
    }
    return result
}

fun turnSequence(turns: String) = sequence {
    while (true) {
        for (char in turns) {
            yield(char)
        }
    }
}

fun lcm(first: Long, second: Long): Long = first / gcd(first, second) * second

fun gcd(first: Long, second: Long): Long {
    var a = first
    var b = second
    while (b > 0) {
        val t = b
        b = a % b
        a = t
    }
    return a
}

//          11911
// 10151663816849

Compiled from "day08.kt"
final class day08.Day08Kt$turnSequence$1 extends kotlin.coroutines.jvm.internal.RestrictedSuspendLambda implements kotlin.jvm.functions.Function2<kotlin.sequences.SequenceScope<? super java.lang.Character>, kotlin.coroutines.Continuation<? super kotlin.Unit>, java.lang.Object> {
  java.lang.Object L$1;

  int I$0;

  int I$1;

  int label;

  private java.lang.Object L$0;

  final java.lang.String $turns;

  day08.Day08Kt$turnSequence$1(java.lang.String, kotlin.coroutines.Continuation<? super day08.Day08Kt$turnSequence$1>);
    Code:
       0: aload_0
       1: aload_1
       2: putfield      #14                 // Field $turns:Ljava/lang/String;
       5: aload_0
       6: iconst_2
       7: aload_2
       8: invokespecial #17                 // Method kotlin/coroutines/jvm/internal/RestrictedSuspendLambda."<init>":(ILkotlin/coroutines/Continuation;)V
      11: return

  public final java.lang.Object invokeSuspend(java.lang.Object);
    Code:
       0: invokestatic  #48                 // Method kotlin/coroutines/intrinsics/IntrinsicsKt.getCOROUTINE_SUSPENDED:()Ljava/lang/Object;
       3: astore        7
       5: aload_0
       6: getfield      #51                 // Field label:I
       9: tableswitch   { // 0 to 1
                     0: 32
                     1: 124
               default: 164
          }
      32: aload_1
      33: invokestatic  #57                 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V
      36: aload_0
      37: getfield      #59                 // Field L$0:Ljava/lang/Object;
      40: checkcast     #61                 // class kotlin/sequences/SequenceScope
      43: astore_2
      44: nop
      45: aload_0
      46: getfield      #14                 // Field $turns:Ljava/lang/String;
      49: astore_3
      50: iconst_0
      51: istore        4
      53: aload_3
      54: invokevirtual #67                 // Method java/lang/String.length:()I
      57: istore        5
      59: iload         4
      61: iload         5
      63: if_icmpge     44
      66: aload_3
      67: iload         4
      69: invokevirtual #71                 // Method java/lang/String.charAt:(I)C
      72: istore        6
      74: aload_2
      75: iload         6
      77: i2c
      78: invokestatic  #77                 // Method kotlin/coroutines/jvm/internal/Boxing.boxChar:(C)Ljava/lang/Character;
      81: aload_0
      82: checkcast     #79                 // class kotlin/coroutines/Continuation
      85: aload_0
      86: aload_2
      87: putfield      #59                 // Field L$0:Ljava/lang/Object;
      90: aload_0
      91: aload_3
      92: putfield      #81                 // Field L$1:Ljava/lang/Object;
      95: aload_0
      96: iload         4
      98: putfield      #83                 // Field I$0:I
     101: aload_0
     102: iload         5
     104: putfield      #85                 // Field I$1:I
     107: aload_0
     108: iconst_1
     109: putfield      #51                 // Field label:I
     112: invokevirtual #89                 // Method kotlin/sequences/SequenceScope.yield:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
     115: dup
     116: aload         7
     118: if_acmpne     157
     121: aload         7
     123: areturn
     124: aload_0
     125: getfield      #85                 // Field I$1:I
     128: istore        5
     130: aload_0
     131: getfield      #83                 // Field I$0:I
     134: istore        4
     136: aload_0
     137: getfield      #81                 // Field L$1:Ljava/lang/Object;
     140: checkcast     #63                 // class java/lang/String
     143: astore_3
     144: aload_0
     145: getfield      #59                 // Field L$0:Ljava/lang/Object;
     148: checkcast     #61                 // class kotlin/sequences/SequenceScope
     151: astore_2
     152: aload_1
     153: invokestatic  #57                 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V
     156: aload_1
     157: pop
     158: iinc          4, 1
     161: goto          59
     164: new           #91                 // class java/lang/IllegalStateException
     167: dup
     168: ldc           #93                 // String call to \'resume\' before \'invoke\' with coroutine
     170: invokespecial #96                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     173: athrow

  public final kotlin.coroutines.Continuation<kotlin.Unit> create(java.lang.Object, kotlin.coroutines.Continuation<?>);
    Code:
       0: new           #2                  // class day08/Day08Kt$turnSequence$1
       3: dup
       4: aload_0
       5: getfield      #14                 // Field $turns:Ljava/lang/String;
       8: aload_2
       9: invokespecial #107                // Method "<init>":(Ljava/lang/String;Lkotlin/coroutines/Continuation;)V
      12: astore_3
      13: aload_3
      14: aload_1
      15: putfield      #59                 // Field L$0:Ljava/lang/Object;
      18: aload_3
      19: checkcast     #79                 // class kotlin/coroutines/Continuation
      22: areturn

  public final java.lang.Object invoke(kotlin.sequences.SequenceScope<? super java.lang.Character>, kotlin.coroutines.Continuation<? super kotlin.Unit>);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokevirtual #113                // Method create:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Lkotlin/coroutines/Continuation;
       6: checkcast     #2                  // class day08/Day08Kt$turnSequence$1
       9: getstatic     #119                // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
      12: invokevirtual #121                // Method invokeSuspend:(Ljava/lang/Object;)Ljava/lang/Object;
      15: areturn

  public java.lang.Object invoke(java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #61                 // class kotlin/sequences/SequenceScope
       5: aload_2
       6: checkcast     #79                 // class kotlin/coroutines/Continuation
       9: invokevirtual #126                // Method invoke:(Lkotlin/sequences/SequenceScope;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
      12: areturn
}

Compiled from "day08.kt"
public final class day08.Day08Kt {
  public static final void main();
    Code:
       0: invokedynamic #26,  0             // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
       5: invokedynamic #31,  0             // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function1;
      10: invokestatic  #35                 // Method run:(Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V
      13: invokedynamic #40,  0             // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function1;
      18: invokedynamic #45,  0             // InvokeDynamic #3:invoke:()Lkotlin/jvm/functions/Function1;
      23: invokestatic  #35                 // Method run:(Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V
      26: return

  public static final void run(kotlin.jvm.functions.Function1<? super java.lang.String, java.lang.Boolean>, kotlin.jvm.functions.Function1<? super java.lang.String, java.lang.Boolean>);
    Code:
       0: aload_0
       1: ldc           #49                 // String start
       3: invokestatic  #55                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #57                 // String end
       9: invokestatic  #55                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: new           #59                 // class java/io/File
      15: dup
      16: ldc           #61                 // String input.data
      18: invokespecial #65                 // Method java/io/File."<init>":(Ljava/lang/String;)V
      21: aconst_null
      22: iconst_1
      23: aconst_null
      24: invokestatic  #71                 // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;
      27: astore_2
      28: aload_2
      29: iconst_0
      30: invokeinterface #77,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      35: checkcast     #79                 // class java/lang/String
      38: invokestatic  #83                 // Method turnSequence:(Ljava/lang/String;)Lkotlin/sequences/Sequence;
      41: astore_3
      42: aload_2
      43: checkcast     #85                 // class java/lang/Iterable
      46: iconst_2
      47: invokestatic  #91                 // Method kotlin/collections/CollectionsKt.drop:(Ljava/lang/Iterable;I)Ljava/util/List;
      50: invokestatic  #95                 // Method parseInstructions:(Ljava/util/List;)Ljava/util/Map;
      53: astore        4
      55: lconst_1
      56: lstore        5
      58: aload         4
      60: invokeinterface #101,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
      65: checkcast     #85                 // class java/lang/Iterable
      68: astore        8
      70: iconst_0
      71: istore        9
      73: aload         8
      75: astore        10
      77: new           #103                // class java/util/ArrayList
      80: dup
      81: invokespecial #105                // Method java/util/ArrayList."<init>":()V
      84: checkcast     #107                // class java/util/Collection
      87: astore        11
      89: iconst_0
      90: istore        12
      92: aload         10
      94: invokeinterface #111,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      99: astore        13
     101: aload         13
     103: invokeinterface #117,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     108: ifeq          150
     111: aload         13
     113: invokeinterface #121,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     118: astore        14
     120: aload_0
     121: aload         14
     123: invokeinterface #125,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
     128: checkcast     #127                // class java/lang/Boolean
     131: invokevirtual #130                // Method java/lang/Boolean.booleanValue:()Z
     134: ifeq          101
     137: aload         11
     139: aload         14
     141: invokeinterface #134,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     146: pop
     147: goto          101
     150: aload         11
     152: checkcast     #73                 // class java/util/List
     155: nop
     156: invokeinterface #135,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     161: astore        7
     163: aload         7
     165: invokeinterface #117,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     170: ifeq          307
     173: aload         7
     175: invokeinterface #121,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     180: checkcast     #79                 // class java/lang/String
     183: astore        8
     185: aload         8
     187: astore        9
     189: lconst_0
     190: lstore        10
     192: aload_3
     193: invokeinterface #138,  1          // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
     198: astore        12
     200: aload         12
     202: invokeinterface #117,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     207: ifeq          295
     210: aload         12
     212: invokeinterface #121,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     217: checkcast     #140                // class java/lang/Character
     220: invokevirtual #144                // Method java/lang/Character.charValue:()C
     223: istore        13
     225: lload         10
     227: lstore        14
     229: lload         14
     231: lconst_1
     232: ladd
     233: lstore        10
     235: aload         4
     237: aload         9
     239: invokeinterface #146,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     244: dup
     245: invokestatic  #150                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     248: checkcast     #152                // class day08/Targets
     251: astore        14
     253: iload         13
     255: bipush        76
     257: if_icmpne     268
     260: aload         14
     262: invokevirtual #156                // Method day08/Targets.getLeft:()Ljava/lang/String;
     265: goto          273
     268: aload         14
     270: invokevirtual #159                // Method day08/Targets.getRight:()Ljava/lang/String;
     273: astore        9
     275: aload_1
     276: aload         9
     278: invokeinterface #125,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
     283: checkcast     #127                // class java/lang/Boolean
     286: invokevirtual #130                // Method java/lang/Boolean.booleanValue:()Z
     289: ifeq          200
     292: goto          295
     295: lload         5
     297: lload         10
     299: invokestatic  #163                // Method lcm:(JJ)J
     302: lstore        5
     304: goto          163
     307: getstatic     #169                // Field java/lang/System.out:Ljava/io/PrintStream;
     310: lload         5
     312: invokevirtual #175                // Method java/io/PrintStream.println:(J)V
     315: return

  public static final java.util.Map<java.lang.String, day08.Targets> parseInstructions(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: ldc           #204                // String lines
       3: invokestatic  #55                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #206                // class java/util/LinkedHashMap
       9: dup
      10: invokespecial #207                // Method java/util/LinkedHashMap."<init>":()V
      13: checkcast     #97                 // class java/util/Map
      16: astore_1
      17: aload_0
      18: invokeinterface #135,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
      23: astore_2
      24: aload_2
      25: invokeinterface #117,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      30: ifeq          130
      33: aload_2
      34: invokeinterface #121,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      39: checkcast     #79                 // class java/lang/String
      42: astore_3
      43: aload_3
      44: checkcast     #209                // class java/lang/CharSequence
      47: iconst_3
      48: anewarray     #79                 // class java/lang/String
      51: astore        5
      53: aload         5
      55: iconst_0
      56: ldc           #211                // String  = (
      58: aastore
      59: aload         5
      61: iconst_1
      62: ldc           #213                // String ,
      64: aastore
      65: aload         5
      67: iconst_2
      68: ldc           #215                // String )
      70: aastore
      71: aload         5
      73: iconst_0
      74: iconst_0
      75: bipush        6
      77: aconst_null
      78: invokestatic  #221                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      81: astore        4
      83: aload_1
      84: aload         4
      86: iconst_0
      87: invokeinterface #77,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      92: new           #152                // class day08/Targets
      95: dup
      96: aload         4
      98: iconst_1
      99: invokeinterface #77,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     104: checkcast     #79                 // class java/lang/String
     107: aload         4
     109: iconst_2
     110: invokeinterface #77,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     115: checkcast     #79                 // class java/lang/String
     118: invokespecial #224                // Method day08/Targets."<init>":(Ljava/lang/String;Ljava/lang/String;)V
     121: invokeinterface #228,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     126: pop
     127: goto          24
     130: aload_1
     131: areturn

  public static final kotlin.sequences.Sequence<java.lang.Character> turnSequence(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #233                // String turns
       3: invokestatic  #55                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #235                // class day08/Day08Kt$turnSequence$1
       9: dup
      10: aload_0
      11: aconst_null
      12: invokespecial #238                // Method day08/Day08Kt$turnSequence$1."<init>":(Ljava/lang/String;Lkotlin/coroutines/Continuation;)V
      15: checkcast     #240                // class kotlin/jvm/functions/Function2
      18: invokestatic  #246                // Method kotlin/sequences/SequencesKt.sequence:(Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence;
      21: areturn

  public static final long lcm(long, long);
    Code:
       0: lload_0
       1: lload_0
       2: lload_2
       3: invokestatic  #249                // Method gcd:(JJ)J
       6: ldiv
       7: lload_2
       8: lmul
       9: lreturn

  public static final long gcd(long, long);
    Code:
       0: lload_0
       1: lstore        4
       3: lload_2
       4: lstore        6
       6: lload         6
       8: lconst_0
       9: lcmp
      10: ifle          31
      13: lload         6
      15: lstore        8
      17: lload         4
      19: lload         6
      21: lrem
      22: lstore        6
      24: lload         8
      26: lstore        4
      28: goto          6
      31: lload         4
      33: lreturn

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

  private static final boolean main$lambda$0(java.lang.String);
    Code:
       0: aload_0
       1: ldc_w         #261                // String it
       4: invokestatic  #55                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: ldc_w         #263                // String AAA
      11: invokestatic  #267                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      14: ireturn

  private static final boolean main$lambda$1(java.lang.String);
    Code:
       0: aload_0
       1: ldc_w         #261                // String it
       4: invokestatic  #55                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: ldc_w         #269                // String ZZZ
      11: invokestatic  #267                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      14: ireturn

  private static final boolean main$lambda$2(java.lang.String);
    Code:
       0: aload_0
       1: ldc_w         #261                // String it
       4: invokestatic  #55                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: checkcast     #209                // class java/lang/CharSequence
      11: bipush        65
      13: iconst_0
      14: iconst_2
      15: aconst_null
      16: invokestatic  #273                // Method kotlin/text/StringsKt.endsWith$default:(Ljava/lang/CharSequence;CZILjava/lang/Object;)Z
      19: ireturn

  private static final boolean main$lambda$3(java.lang.String);
    Code:
       0: aload_0
       1: ldc_w         #261                // String it
       4: invokestatic  #55                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: checkcast     #209                // class java/lang/CharSequence
      11: bipush        90
      13: iconst_0
      14: iconst_2
      15: aconst_null
      16: invokestatic  #273                // Method kotlin/text/StringsKt.endsWith$default:(Ljava/lang/CharSequence;CZILjava/lang/Object;)Z
      19: ireturn
}