package com.github.afranken.aoc

import kotlin.math.pow

object Day202103 {

    fun part1(inputs: Array<String>): Int {
        //every input is expected to have the same size. Take inputs[0] to initialize.
        val inputLength = inputs[0].length
        val zeroes = IntArray(inputLength)
        val ones = IntArray(inputLength)

        //count up ones and zeroes
        for (input in inputs) {
            for (i in 0 until inputLength) {
                when (input[i].digitToInt()) {
                    0 -> zeroes[i]++
                    1 -> ones[i]++
                }
            }
        }

        val gammaBinary = Array(inputLength) { "" }
        val epsilonBinary = Array(inputLength) { "" }

        //construct gamma and epsilon binary numbers
        for (i in 0 until inputLength) {
            if (zeroes[i] > ones[i]) {
                gammaBinary[i] = "0"
                epsilonBinary[i] = "1"
            } else {
                gammaBinary[i] = "1"
                epsilonBinary[i] = "0"
            }
        }

        //convert to String representing binary code, then to decimal
        val gamma = toDecimal(gammaBinary.joinToString(""))
        val epsilon = toDecimal(epsilonBinary.joinToString(""))

        return gamma * epsilon
    }

    fun part2(inputs: Array<String>): Int {
        //all inputs are expected to have the same length
        val inputLength = inputs[0].length

        //iterate over initial list

        //split list into 1s and 0s for the first bit position
        val splitted = splitListByBit(inputs, 0)
        var oxygenBinary = if (splitted[1].size >= splitted[0].size) splitted[1] else splitted[0]
        var co2Binary = if (splitted[0].size <= splitted[1].size) splitted[0] else splitted[1]

        //process both lists: larger list for oxygen, smaller list for co2. Given equal size,
        // process 1s for oxygen.
        for (i in 1 until inputLength) {
            if (oxygenBinary.size > 1) {
                //oxygen: go through list for every bit position in 1 until length, always keep the larger list
                val oxygenSplit = splitListByBit(oxygenBinary, i)
                oxygenBinary = findNext(oxygenSplit[1], oxygenSplit[0], true)
            }
            if (co2Binary.size > 1) {
                //co2: go through list for every bit position in 1 until length, always keep smaller list.
                val co2Split = splitListByBit(co2Binary, i)
                co2Binary = findNext(co2Split[1], co2Split[0], false)
            }
        }

        //convert to String representing binary code, then to decimal
        val oxygen = toDecimal(oxygenBinary.joinToString(""))
        val co2 = toDecimal(co2Binary.joinToString(""))

        return oxygen * co2
    }

    private fun findNext(ones: Array<String>, zeroes: Array<String>, oxygen: Boolean): Array<String> {
        return if (oxygen) {
            if (ones.size >= zeroes.size) { //oxygen prefers 1s over 0s when sizes are equal
                ones
            } else {
                zeroes
            }
        } else {
            if (zeroes.size <= ones.size) { //co2 prefers 0s over 1s when sizes are equal
                zeroes
            } else {
                ones
            }
        }
    }

    private fun splitListByBit(inputs: Array<String>, position: Int): Array<Array<String>> {
        val ones = arrayListOf<String>()
        val zeroes = arrayListOf<String>()

        for (input in inputs) {
            val c = input[position].toString()
            when (c) {
                "0" -> zeroes.add(input)
                "1" -> ones.add(input)
            }
        }

        //returns zeroes array with index 0 and ones array with index 1.
        return arrayOf(zeroes.toTypedArray(), ones.toTypedArray())
    }

    private fun toDecimal(binaryNumber: String): Int {
        var sum = 0
        binaryNumber.reversed().forEachIndexed { k, v ->
            sum += v.toString().toInt() * 2.0.pow(k.toDouble()).toInt()
        }
        return sum
    }
}

Compiled from "Day202103.kt"
public final class com.github.afranken.aoc.Day202103 {
  public static final com.github.afranken.aoc.Day202103 INSTANCE;

  private com.github.afranken.aoc.Day202103();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final int part1(java.lang.String[]);
    Code:
       0: aload_1
       1: ldc           #15                 // String inputs
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: iconst_0
       8: aaload
       9: invokevirtual #27                 // Method java/lang/String.length:()I
      12: istore_2
      13: iload_2
      14: newarray       int
      16: astore_3
      17: iload_2
      18: newarray       int
      20: astore        4
      22: iconst_0
      23: istore        5
      25: aload_1
      26: arraylength
      27: istore        6
      29: iload         5
      31: iload         6
      33: if_icmpge     137
      36: aload_1
      37: iload         5
      39: aaload
      40: astore        7
      42: iconst_0
      43: istore        8
      45: iload         8
      47: iload_2
      48: if_icmpge     131
      51: aload         7
      53: iload         8
      55: invokevirtual #31                 // Method java/lang/String.charAt:(I)C
      58: invokestatic  #37                 // Method kotlin/text/CharsKt.digitToInt:(C)I
      61: tableswitch   { // 0 to 1
                     0: 84
                     1: 105
               default: 125
          }
      84: iload         8
      86: istore        10
      88: aload_3
      89: iload         10
      91: iaload
      92: istore        11
      94: aload_3
      95: iload         10
      97: iload         11
      99: iconst_1
     100: iadd
     101: iastore
     102: goto          125
     105: iload         8
     107: istore        10
     109: aload         4
     111: iload         10
     113: iaload
     114: istore        11
     116: aload         4
     118: iload         10
     120: iload         11
     122: iconst_1
     123: iadd
     124: iastore
     125: iinc          8, 1
     128: goto          45
     131: iinc          5, 1
     134: goto          29
     137: iconst_0
     138: istore        6
     140: iload_2
     141: anewarray     #23                 // class java/lang/String
     144: astore        7
     146: iload         6
     148: iload_2
     149: if_icmpge     169
     152: iload         6
     154: istore        8
     156: aload         7
     158: iload         8
     160: ldc           #39                 // String
     162: aastore
     163: iinc          6, 1
     166: goto          146
     169: aload         7
     171: astore        5
     173: iconst_0
     174: istore        7
     176: iload_2
     177: anewarray     #23                 // class java/lang/String
     180: astore        8
     182: iload         7
     184: iload_2
     185: if_icmpge     205
     188: iload         7
     190: istore        9
     192: aload         8
     194: iload         9
     196: ldc           #39                 // String
     198: aastore
     199: iinc          7, 1
     202: goto          182
     205: aload         8
     207: astore        6
     209: iconst_0
     210: istore        7
     212: iload         7
     214: iload_2
     215: if_icmpge     267
     218: aload_3
     219: iload         7
     221: iaload
     222: aload         4
     224: iload         7
     226: iaload
     227: if_icmple     247
     230: aload         5
     232: iload         7
     234: ldc           #41                 // String 0
     236: aastore
     237: aload         6
     239: iload         7
     241: ldc           #43                 // String 1
     243: aastore
     244: goto          261
     247: aload         5
     249: iload         7
     251: ldc           #43                 // String 1
     253: aastore
     254: aload         6
     256: iload         7
     258: ldc           #41                 // String 0
     260: aastore
     261: iinc          7, 1
     264: goto          212
     267: aload_0
     268: aload         5
     270: ldc           #39                 // String
     272: checkcast     #45                 // class java/lang/CharSequence
     275: aconst_null
     276: aconst_null
     277: iconst_0
     278: aconst_null
     279: aconst_null
     280: bipush        62
     282: aconst_null
     283: invokestatic  #51                 // Method kotlin/collections/ArraysKt.joinToString$default:([Ljava/lang/Object;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
     286: invokespecial #55                 // Method toDecimal:(Ljava/lang/String;)I
     289: istore        7
     291: aload_0
     292: aload         6
     294: ldc           #39                 // String
     296: checkcast     #45                 // class java/lang/CharSequence
     299: aconst_null
     300: aconst_null
     301: iconst_0
     302: aconst_null
     303: aconst_null
     304: bipush        62
     306: aconst_null
     307: invokestatic  #51                 // Method kotlin/collections/ArraysKt.joinToString$default:([Ljava/lang/Object;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
     310: invokespecial #55                 // Method toDecimal:(Ljava/lang/String;)I
     313: istore        8
     315: iload         7
     317: iload         8
     319: imul
     320: ireturn

  public final int part2(java.lang.String[]);
    Code:
       0: aload_1
       1: ldc           #15                 // String inputs
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: iconst_0
       8: aaload
       9: invokevirtual #27                 // Method java/lang/String.length:()I
      12: istore_2
      13: aload_0
      14: aload_1
      15: iconst_0
      16: invokespecial #75                 // Method splitListByBit:([Ljava/lang/String;I)[[Ljava/lang/String;
      19: astore_3
      20: aload_3
      21: iconst_1
      22: aaload
      23: arraylength
      24: aload_3
      25: iconst_0
      26: aaload
      27: arraylength
      28: if_icmplt     37
      31: aload_3
      32: iconst_1
      33: aaload
      34: goto          40
      37: aload_3
      38: iconst_0
      39: aaload
      40: astore        4
      42: aload_3
      43: iconst_0
      44: aaload
      45: arraylength
      46: aload_3
      47: iconst_1
      48: aaload
      49: arraylength
      50: if_icmpgt     59
      53: aload_3
      54: iconst_0
      55: aaload
      56: goto          62
      59: aload_3
      60: iconst_1
      61: aaload
      62: astore        5
      64: iconst_1
      65: istore        6
      67: iload         6
      69: iload_2
      70: if_icmpge     143
      73: aload         4
      75: arraylength
      76: iconst_1
      77: if_icmple     105
      80: aload_0
      81: aload         4
      83: iload         6
      85: invokespecial #75                 // Method splitListByBit:([Ljava/lang/String;I)[[Ljava/lang/String;
      88: astore        7
      90: aload_0
      91: aload         7
      93: iconst_1
      94: aaload
      95: aload         7
      97: iconst_0
      98: aaload
      99: iconst_1
     100: invokespecial #79                 // Method findNext:([Ljava/lang/String;[Ljava/lang/String;Z)[Ljava/lang/String;
     103: astore        4
     105: aload         5
     107: arraylength
     108: iconst_1
     109: if_icmple     137
     112: aload_0
     113: aload         5
     115: iload         6
     117: invokespecial #75                 // Method splitListByBit:([Ljava/lang/String;I)[[Ljava/lang/String;
     120: astore        7
     122: aload_0
     123: aload         7
     125: iconst_1
     126: aaload
     127: aload         7
     129: iconst_0
     130: aaload
     131: iconst_0
     132: invokespecial #79                 // Method findNext:([Ljava/lang/String;[Ljava/lang/String;Z)[Ljava/lang/String;
     135: astore        5
     137: iinc          6, 1
     140: goto          67
     143: aload_0
     144: aload         4
     146: ldc           #39                 // String
     148: checkcast     #45                 // class java/lang/CharSequence
     151: aconst_null
     152: aconst_null
     153: iconst_0
     154: aconst_null
     155: aconst_null
     156: bipush        62
     158: aconst_null
     159: invokestatic  #51                 // Method kotlin/collections/ArraysKt.joinToString$default:([Ljava/lang/Object;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
     162: invokespecial #55                 // Method toDecimal:(Ljava/lang/String;)I
     165: istore        6
     167: aload_0
     168: aload         5
     170: ldc           #39                 // String
     172: checkcast     #45                 // class java/lang/CharSequence
     175: aconst_null
     176: aconst_null
     177: iconst_0
     178: aconst_null
     179: aconst_null
     180: bipush        62
     182: aconst_null
     183: invokestatic  #51                 // Method kotlin/collections/ArraysKt.joinToString$default:([Ljava/lang/Object;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
     186: invokespecial #55                 // Method toDecimal:(Ljava/lang/String;)I
     189: istore        7
     191: iload         6
     193: iload         7
     195: imul
     196: ireturn

  private final java.lang.String[] findNext(java.lang.String[], java.lang.String[], boolean);
    Code:
       0: iload_3
       1: ifeq          19
       4: aload_1
       5: arraylength
       6: aload_2
       7: arraylength
       8: if_icmplt     15
      11: aload_1
      12: goto          31
      15: aload_2
      16: goto          31
      19: aload_2
      20: arraylength
      21: aload_1
      22: arraylength
      23: if_icmpgt     30
      26: aload_2
      27: goto          31
      30: aload_1
      31: areturn

  private final java.lang.String[][] splitListByBit(java.lang.String[], int);
    Code:
       0: new           #91                 // class java/util/ArrayList
       3: dup
       4: invokespecial #92                 // Method java/util/ArrayList."<init>":()V
       7: astore_3
       8: new           #91                 // class java/util/ArrayList
      11: dup
      12: invokespecial #92                 // Method java/util/ArrayList."<init>":()V
      15: astore        4
      17: iconst_0
      18: istore        5
      20: aload_1
      21: arraylength
      22: istore        6
      24: iload         5
      26: iload         6
      28: if_icmpge     96
      31: aload_1
      32: iload         5
      34: aaload
      35: astore        7
      37: aload         7
      39: iload_2
      40: invokevirtual #31                 // Method java/lang/String.charAt:(I)C
      43: invokestatic  #96                 // Method java/lang/String.valueOf:(C)Ljava/lang/String;
      46: astore        8
      48: aload         8
      50: astore        9
      52: aload         9
      54: ldc           #41                 // String 0
      56: invokestatic  #100                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      59: ifeq          73
      62: aload         4
      64: aload         7
      66: invokevirtual #104                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      69: pop
      70: goto          90
      73: aload         9
      75: ldc           #43                 // String 1
      77: invokestatic  #100                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      80: ifeq          90
      83: aload_3
      84: aload         7
      86: invokevirtual #104                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      89: pop
      90: iinc          5, 1
      93: goto          24
      96: iconst_2
      97: anewarray     #69                 // class "[Ljava/lang/String;"
     100: astore        5
     102: aload         5
     104: iconst_0
     105: aload         4
     107: checkcast     #106                // class java/util/Collection
     110: astore        6
     112: iconst_0
     113: istore        7
     115: aload         6
     117: astore        8
     119: aload         8
     121: iconst_0
     122: anewarray     #23                 // class java/lang/String
     125: invokeinterface #110,  2          // InterfaceMethod java/util/Collection.toArray:([Ljava/lang/Object;)[Ljava/lang/Object;
     130: aastore
     131: aload         5
     133: iconst_1
     134: aload_3
     135: checkcast     #106                // class java/util/Collection
     138: astore        6
     140: iconst_0
     141: istore        7
     143: aload         6
     145: astore        8
     147: aload         8
     149: iconst_0
     150: anewarray     #23                 // class java/lang/String
     153: invokeinterface #110,  2          // InterfaceMethod java/util/Collection.toArray:([Ljava/lang/Object;)[Ljava/lang/Object;
     158: aastore
     159: aload         5
     161: areturn

  private final int toDecimal(java.lang.String);
    Code:
       0: iconst_0
       1: istore_2
       2: aload_1
       3: checkcast     #45                 // class java/lang/CharSequence
       6: invokestatic  #123                // Method kotlin/text/StringsKt.reversed:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
       9: invokevirtual #127                // Method java/lang/Object.toString:()Ljava/lang/String;
      12: checkcast     #45                 // class java/lang/CharSequence
      15: astore_3
      16: nop
      17: iconst_0
      18: istore        4
      20: iconst_0
      21: istore        5
      23: iconst_0
      24: istore        6
      26: iload         6
      28: aload_3
      29: invokeinterface #128,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      34: if_icmpge     91
      37: aload_3
      38: iload         6
      40: invokeinterface #129,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
      45: istore        7
      47: iload         5
      49: iinc          5, 1
      52: iload         7
      54: istore        8
      56: istore        9
      58: iconst_0
      59: istore        10
      61: iload_2
      62: iload         8
      64: invokestatic  #96                 // Method java/lang/String.valueOf:(C)Ljava/lang/String;
      67: invokestatic  #134                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      70: ldc2_w        #135                // double 2.0d
      73: iload         9
      75: i2d
      76: invokestatic  #142                // Method java/lang/Math.pow:(DD)D
      79: d2i
      80: imul
      81: iadd
      82: istore_2
      83: nop
      84: nop
      85: iinc          6, 1
      88: goto          26
      91: nop
      92: iload_2
      93: ireturn

  static {};
    Code:
       0: new           #2                  // class com/github/afranken/aoc/Day202103
       3: dup
       4: invokespecial #155                // Method "<init>":()V
       7: putstatic     #158                // Field INSTANCE:Lcom/github/afranken/aoc/Day202103;
      10: return
}


package com.github.afranken.aoc

object Day202105 {

    fun part1(inputs: Array<String>): Int {
        val coordinates = getCoordinates(inputs)
        val matrix = createMatrix(coordinates)

        coordinates.forEach {
            val from = Pair(it[0], it[1])
            val to = Pair(it[2], it[3])
            mark(matrix, from, to)
        }

        var count = 0
        matrix.forEach { it.forEach { if (it >= 2) count++ } }

        return count
    }

    fun part2(inputs: Array<String>): Int {
        val coordinates = getCoordinates(inputs)
        val matrix = createMatrix(coordinates)

        coordinates.forEach {
            val from = Pair(it[0], it[1])
            val to = Pair(it[2], it[3])
            mark(matrix, from, to, true)
        }

        var count = 0
        matrix.forEach { it.forEach { if (it >= 2) count++ } }

        return count
    }

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

    private fun createMatrix(coordinates: List<List<Int>>): Array<IntArray> {
        val size = coordinates[0][0].toString().length
        var maxSizeString = ""
        for (i in 0 until size) {
            maxSizeString += "9"
        }
        val maxSize = Integer.valueOf(maxSizeString) + 1 //9->10, 99->100, 999->1000
        return Array(maxSize) { IntArray(maxSize) { 0 } } //maxSize*maxSize array with '0's
    }

    private fun sort(from: Pair, to: Pair): List<Pair> {
        return if (from.x < to.x || from.x == to.x && from.y < to.y) {
            listOf(from, to)
        } else {
            listOf(to, from)
        }
    }

    private fun mark(
        matrix: Array<IntArray>,
        from: Pair, to: Pair,
        diagonals: Boolean = false
    ) {
        val (lower, higher) = sort(from, to)

        if (lower.x == higher.x) {
            //vertical line.
            (lower.y..higher.y).forEach {
                matrix[it][lower.x]++
            }
        } else if (lower.y == higher.y) {
            //horizontal line.
            (lower.x..higher.x).forEach {
                matrix[lower.y][it]++
            }
        } else if (diagonals) {
            //diagonal line
            val deltaX = higher.x - lower.x
            val deltaY = higher.y - lower.y
            val direction = when {
                deltaY > 0 -> 1
                deltaY < 0 -> -1
                else -> 0
            }
            (0..deltaX).forEach { delta ->
                matrix[lower.y + direction * delta][lower.x + delta]++
            }
        }
    }

    private fun getCoordinates(inputs: Array<String>): List<List<Int>> {
        return inputs.map { it.split(",", " -> ") }.map { it.map { Integer.valueOf(it) } }
    }
}

Compiled from "Day202105.kt"
public final class com.github.afranken.aoc.Day202105 {
  public static final com.github.afranken.aoc.Day202105 INSTANCE;

  private com.github.afranken.aoc.Day202105();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final int part1(java.lang.String[]);
    Code:
       0: aload_1
       1: ldc           #15                 // String inputs
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: invokespecial #25                 // Method getCoordinates:([Ljava/lang/String;)Ljava/util/List;
      11: astore_2
      12: aload_0
      13: aload_2
      14: invokespecial #29                 // Method createMatrix:(Ljava/util/List;)[[I
      17: astore_3
      18: aload_2
      19: checkcast     #31                 // class java/lang/Iterable
      22: astore        4
      24: iconst_0
      25: istore        5
      27: aload         4
      29: invokeinterface #35,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      34: astore        6
      36: aload         6
      38: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      43: ifeq          159
      46: aload         6
      48: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      53: astore        7
      55: aload         7
      57: checkcast     #47                 // class java/util/List
      60: astore        8
      62: iconst_0
      63: istore        9
      65: new           #49                 // class com/github/afranken/aoc/Day202105$Pair
      68: dup
      69: aload         8
      71: iconst_0
      72: invokeinterface #53,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      77: checkcast     #55                 // class java/lang/Number
      80: invokevirtual #59                 // Method java/lang/Number.intValue:()I
      83: aload         8
      85: iconst_1
      86: invokeinterface #53,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      91: checkcast     #55                 // class java/lang/Number
      94: invokevirtual #59                 // Method java/lang/Number.intValue:()I
      97: invokespecial #62                 // Method com/github/afranken/aoc/Day202105$Pair."<init>":(II)V
     100: astore        10
     102: new           #49                 // class com/github/afranken/aoc/Day202105$Pair
     105: dup
     106: aload         8
     108: iconst_2
     109: invokeinterface #53,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     114: checkcast     #55                 // class java/lang/Number
     117: invokevirtual #59                 // Method java/lang/Number.intValue:()I
     120: aload         8
     122: iconst_3
     123: invokeinterface #53,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     128: checkcast     #55                 // class java/lang/Number
     131: invokevirtual #59                 // Method java/lang/Number.intValue:()I
     134: invokespecial #62                 // Method com/github/afranken/aoc/Day202105$Pair."<init>":(II)V
     137: astore        11
     139: getstatic     #65                 // Field INSTANCE:Lcom/github/afranken/aoc/Day202105;
     142: aload_3
     143: aload         10
     145: aload         11
     147: iconst_0
     148: bipush        8
     150: aconst_null
     151: invokestatic  #69                 // Method mark$default:(Lcom/github/afranken/aoc/Day202105;[[ILcom/github/afranken/aoc/Day202105$Pair;Lcom/github/afranken/aoc/Day202105$Pair;ZILjava/lang/Object;)V
     154: nop
     155: nop
     156: goto          36
     159: nop
     160: iconst_0
     161: istore        4
     163: aload_3
     164: checkcast     #71                 // class "[Ljava/lang/Object;"
     167: astore        5
     169: iconst_0
     170: istore        6
     172: iconst_0
     173: istore        7
     175: aload         5
     177: arraylength
     178: istore        8
     180: iload         7
     182: iload         8
     184: if_icmpge     268
     187: aload         5
     189: iload         7
     191: aaload
     192: astore        9
     194: aload         9
     196: checkcast     #73                 // class "[I"
     199: astore        10
     201: iconst_0
     202: istore        11
     204: aload         10
     206: astore        12
     208: iconst_0
     209: istore        13
     211: iconst_0
     212: istore        14
     214: aload         12
     216: arraylength
     217: istore        15
     219: iload         14
     221: iload         15
     223: if_icmpge     259
     226: aload         12
     228: iload         14
     230: iaload
     231: istore        16
     233: iload         16
     235: istore        17
     237: iconst_0
     238: istore        18
     240: iload         17
     242: iconst_2
     243: if_icmplt     252
     246: iload         4
     248: iconst_1
     249: iadd
     250: istore        4
     252: nop
     253: iinc          14, 1
     256: goto          219
     259: nop
     260: nop
     261: nop
     262: iinc          7, 1
     265: goto          180
     268: nop
     269: iload         4
     271: ireturn

  public final int part2(java.lang.String[]);
    Code:
       0: aload_1
       1: ldc           #15                 // String inputs
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: invokespecial #25                 // Method getCoordinates:([Ljava/lang/String;)Ljava/util/List;
      11: astore_2
      12: aload_0
      13: aload_2
      14: invokespecial #29                 // Method createMatrix:(Ljava/util/List;)[[I
      17: astore_3
      18: aload_2
      19: checkcast     #31                 // class java/lang/Iterable
      22: astore        4
      24: iconst_0
      25: istore        5
      27: aload         4
      29: invokeinterface #35,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      34: astore        6
      36: aload         6
      38: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      43: ifeq          156
      46: aload         6
      48: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      53: astore        7
      55: aload         7
      57: checkcast     #47                 // class java/util/List
      60: astore        8
      62: iconst_0
      63: istore        9
      65: new           #49                 // class com/github/afranken/aoc/Day202105$Pair
      68: dup
      69: aload         8
      71: iconst_0
      72: invokeinterface #53,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      77: checkcast     #55                 // class java/lang/Number
      80: invokevirtual #59                 // Method java/lang/Number.intValue:()I
      83: aload         8
      85: iconst_1
      86: invokeinterface #53,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      91: checkcast     #55                 // class java/lang/Number
      94: invokevirtual #59                 // Method java/lang/Number.intValue:()I
      97: invokespecial #62                 // Method com/github/afranken/aoc/Day202105$Pair."<init>":(II)V
     100: astore        10
     102: new           #49                 // class com/github/afranken/aoc/Day202105$Pair
     105: dup
     106: aload         8
     108: iconst_2
     109: invokeinterface #53,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     114: checkcast     #55                 // class java/lang/Number
     117: invokevirtual #59                 // Method java/lang/Number.intValue:()I
     120: aload         8
     122: iconst_3
     123: invokeinterface #53,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     128: checkcast     #55                 // class java/lang/Number
     131: invokevirtual #59                 // Method java/lang/Number.intValue:()I
     134: invokespecial #62                 // Method com/github/afranken/aoc/Day202105$Pair."<init>":(II)V
     137: astore        11
     139: getstatic     #65                 // Field INSTANCE:Lcom/github/afranken/aoc/Day202105;
     142: aload_3
     143: aload         10
     145: aload         11
     147: iconst_1
     148: invokespecial #99                 // Method mark:([[ILcom/github/afranken/aoc/Day202105$Pair;Lcom/github/afranken/aoc/Day202105$Pair;Z)V
     151: nop
     152: nop
     153: goto          36
     156: nop
     157: iconst_0
     158: istore        4
     160: aload_3
     161: checkcast     #71                 // class "[Ljava/lang/Object;"
     164: astore        5
     166: iconst_0
     167: istore        6
     169: iconst_0
     170: istore        7
     172: aload         5
     174: arraylength
     175: istore        8
     177: iload         7
     179: iload         8
     181: if_icmpge     265
     184: aload         5
     186: iload         7
     188: aaload
     189: astore        9
     191: aload         9
     193: checkcast     #73                 // class "[I"
     196: astore        10
     198: iconst_0
     199: istore        11
     201: aload         10
     203: astore        12
     205: iconst_0
     206: istore        13
     208: iconst_0
     209: istore        14
     211: aload         12
     213: arraylength
     214: istore        15
     216: iload         14
     218: iload         15
     220: if_icmpge     256
     223: aload         12
     225: iload         14
     227: iaload
     228: istore        16
     230: iload         16
     232: istore        17
     234: iconst_0
     235: istore        18
     237: iload         17
     239: iconst_2
     240: if_icmplt     249
     243: iload         4
     245: iconst_1
     246: iadd
     247: istore        4
     249: nop
     250: iinc          14, 1
     253: goto          216
     256: nop
     257: nop
     258: nop
     259: iinc          7, 1
     262: goto          177
     265: nop
     266: iload         4
     268: ireturn

  private final int[][] createMatrix(java.util.List<? extends java.util.List<java.lang.Integer>>);
    Code:
       0: aload_1
       1: iconst_0
       2: invokeinterface #53,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
       7: checkcast     #47                 // class java/util/List
      10: iconst_0
      11: invokeinterface #53,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      16: checkcast     #55                 // class java/lang/Number
      19: invokevirtual #59                 // Method java/lang/Number.intValue:()I
      22: invokestatic  #109                // Method java/lang/String.valueOf:(I)Ljava/lang/String;
      25: invokevirtual #112                // Method java/lang/String.length:()I
      28: istore_2
      29: ldc           #114                // String
      31: astore_3
      32: iconst_0
      33: istore        4
      35: iload         4
      37: iload_2
      38: if_icmpge     67
      41: new           #116                // class java/lang/StringBuilder
      44: dup
      45: invokespecial #117                // Method java/lang/StringBuilder."<init>":()V
      48: aload_3
      49: invokevirtual #121                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      52: bipush        57
      54: invokevirtual #124                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      57: invokevirtual #128                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      60: astore_3
      61: iinc          4, 1
      64: goto          35
      67: aload_3
      68: invokestatic  #133                // Method java/lang/Integer.valueOf:(Ljava/lang/String;)Ljava/lang/Integer;
      71: invokevirtual #134                // Method java/lang/Integer.intValue:()I
      74: iconst_1
      75: iadd
      76: istore        4
      78: iconst_0
      79: istore        5
      81: iload         4
      83: anewarray     #73                 // class "[I"
      86: astore        6
      88: iload         5
      90: iload         4
      92: if_icmpge     152
      95: iload         5
      97: istore        7
      99: aload         6
     101: iload         7
     103: iconst_0
     104: istore        8
     106: iload         4
     108: newarray       int
     110: astore        9
     112: istore        12
     114: astore        11
     116: iload         8
     118: iload         4
     120: if_icmpge     139
     123: iload         8
     125: istore        10
     127: aload         9
     129: iload         10
     131: iconst_0
     132: iastore
     133: iinc          8, 1
     136: goto          116
     139: aload         11
     141: iload         12
     143: aload         9
     145: aastore
     146: iinc          5, 1
     149: goto          88
     152: aload         6
     154: areturn

  private final java.util.List<com.github.afranken.aoc.Day202105$Pair> sort(com.github.afranken.aoc.Day202105$Pair, com.github.afranken.aoc.Day202105$Pair);
    Code:
       0: aload_1
       1: invokevirtual #145                // Method com/github/afranken/aoc/Day202105$Pair.getX:()I
       4: aload_2
       5: invokevirtual #145                // Method com/github/afranken/aoc/Day202105$Pair.getX:()I
       8: if_icmplt     33
      11: aload_1
      12: invokevirtual #145                // Method com/github/afranken/aoc/Day202105$Pair.getX:()I
      15: aload_2
      16: invokevirtual #145                // Method com/github/afranken/aoc/Day202105$Pair.getX:()I
      19: if_icmpne     53
      22: aload_1
      23: invokevirtual #148                // Method com/github/afranken/aoc/Day202105$Pair.getY:()I
      26: aload_2
      27: invokevirtual #148                // Method com/github/afranken/aoc/Day202105$Pair.getY:()I
      30: if_icmpge     53
      33: iconst_2
      34: anewarray     #49                 // class com/github/afranken/aoc/Day202105$Pair
      37: astore_3
      38: aload_3
      39: iconst_0
      40: aload_1
      41: aastore
      42: aload_3
      43: iconst_1
      44: aload_2
      45: aastore
      46: aload_3
      47: invokestatic  #154                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      50: goto          70
      53: iconst_2
      54: anewarray     #49                 // class com/github/afranken/aoc/Day202105$Pair
      57: astore_3
      58: aload_3
      59: iconst_0
      60: aload_2
      61: aastore
      62: aload_3
      63: iconst_1
      64: aload_1
      65: aastore
      66: aload_3
      67: invokestatic  #154                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      70: areturn

  private final void mark(int[][], com.github.afranken.aoc.Day202105$Pair, com.github.afranken.aoc.Day202105$Pair, boolean);
    Code:
       0: aload_0
       1: aload_2
       2: aload_3
       3: invokespecial #158                // Method sort:(Lcom/github/afranken/aoc/Day202105$Pair;Lcom/github/afranken/aoc/Day202105$Pair;)Ljava/util/List;
       6: astore        5
       8: aload         5
      10: iconst_0
      11: invokeinterface #53,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      16: checkcast     #49                 // class com/github/afranken/aoc/Day202105$Pair
      19: astore        6
      21: aload         5
      23: iconst_1
      24: invokeinterface #53,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      29: checkcast     #49                 // class com/github/afranken/aoc/Day202105$Pair
      32: astore        7
      34: aload         6
      36: invokevirtual #145                // Method com/github/afranken/aoc/Day202105$Pair.getX:()I
      39: aload         7
      41: invokevirtual #145                // Method com/github/afranken/aoc/Day202105$Pair.getX:()I
      44: if_icmpne     146
      47: new           #160                // class kotlin/ranges/IntRange
      50: dup
      51: aload         6
      53: invokevirtual #148                // Method com/github/afranken/aoc/Day202105$Pair.getY:()I
      56: aload         7
      58: invokevirtual #148                // Method com/github/afranken/aoc/Day202105$Pair.getY:()I
      61: invokespecial #161                // Method kotlin/ranges/IntRange."<init>":(II)V
      64: checkcast     #31                 // class java/lang/Iterable
      67: astore        8
      69: iconst_0
      70: istore        9
      72: aload         8
      74: invokeinterface #35,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      79: astore        10
      81: aload         10
      83: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      88: ifeq          142
      91: aload         10
      93: checkcast     #163                // class kotlin/collections/IntIterator
      96: invokevirtual #166                // Method kotlin/collections/IntIterator.nextInt:()I
      99: istore        11
     101: iload         11
     103: istore        12
     105: iconst_0
     106: istore        13
     108: aload_1
     109: iload         12
     111: aaload
     112: astore        14
     114: aload         6
     116: invokevirtual #145                // Method com/github/afranken/aoc/Day202105$Pair.getX:()I
     119: istore        15
     121: aload         14
     123: iload         15
     125: iaload
     126: istore        16
     128: aload         14
     130: iload         15
     132: iload         16
     134: iconst_1
     135: iadd
     136: iastore
     137: nop
     138: nop
     139: goto          81
     142: nop
     143: goto          408
     146: aload         6
     148: invokevirtual #148                // Method com/github/afranken/aoc/Day202105$Pair.getY:()I
     151: aload         7
     153: invokevirtual #148                // Method com/github/afranken/aoc/Day202105$Pair.getY:()I
     156: if_icmpne     254
     159: new           #160                // class kotlin/ranges/IntRange
     162: dup
     163: aload         6
     165: invokevirtual #145                // Method com/github/afranken/aoc/Day202105$Pair.getX:()I
     168: aload         7
     170: invokevirtual #145                // Method com/github/afranken/aoc/Day202105$Pair.getX:()I
     173: invokespecial #161                // Method kotlin/ranges/IntRange."<init>":(II)V
     176: checkcast     #31                 // class java/lang/Iterable
     179: astore        8
     181: iconst_0
     182: istore        9
     184: aload         8
     186: invokeinterface #35,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     191: astore        10
     193: aload         10
     195: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     200: ifeq          250
     203: aload         10
     205: checkcast     #163                // class kotlin/collections/IntIterator
     208: invokevirtual #166                // Method kotlin/collections/IntIterator.nextInt:()I
     211: istore        11
     213: iload         11
     215: istore        12
     217: iconst_0
     218: istore        13
     220: aload_1
     221: aload         6
     223: invokevirtual #148                // Method com/github/afranken/aoc/Day202105$Pair.getY:()I
     226: aaload
     227: astore        14
     229: aload         14
     231: iload         12
     233: iaload
     234: istore        15
     236: aload         14
     238: iload         12
     240: iload         15
     242: iconst_1
     243: iadd
     244: iastore
     245: nop
     246: nop
     247: goto          193
     250: nop
     251: goto          408
     254: iload         4
     256: ifeq          408
     259: aload         7
     261: invokevirtual #145                // Method com/github/afranken/aoc/Day202105$Pair.getX:()I
     264: aload         6
     266: invokevirtual #145                // Method com/github/afranken/aoc/Day202105$Pair.getX:()I
     269: isub
     270: istore        8
     272: aload         7
     274: invokevirtual #148                // Method com/github/afranken/aoc/Day202105$Pair.getY:()I
     277: aload         6
     279: invokevirtual #148                // Method com/github/afranken/aoc/Day202105$Pair.getY:()I
     282: isub
     283: istore        9
     285: nop
     286: iload         9
     288: ifle          295
     291: iconst_1
     292: goto          305
     295: iload         9
     297: ifge          304
     300: iconst_m1
     301: goto          305
     304: iconst_0
     305: istore        10
     307: new           #160                // class kotlin/ranges/IntRange
     310: dup
     311: iconst_0
     312: iload         8
     314: invokespecial #161                // Method kotlin/ranges/IntRange."<init>":(II)V
     317: checkcast     #31                 // class java/lang/Iterable
     320: astore        11
     322: iconst_0
     323: istore        12
     325: aload         11
     327: invokeinterface #35,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     332: astore        13
     334: aload         13
     336: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     341: ifeq          407
     344: aload         13
     346: checkcast     #163                // class kotlin/collections/IntIterator
     349: invokevirtual #166                // Method kotlin/collections/IntIterator.nextInt:()I
     352: istore        14
     354: iload         14
     356: istore        15
     358: iconst_0
     359: istore        16
     361: aload_1
     362: aload         6
     364: invokevirtual #148                // Method com/github/afranken/aoc/Day202105$Pair.getY:()I
     367: iload         10
     369: iload         15
     371: imul
     372: iadd
     373: aaload
     374: astore        17
     376: aload         6
     378: invokevirtual #145                // Method com/github/afranken/aoc/Day202105$Pair.getX:()I
     381: iload         15
     383: iadd
     384: istore        18
     386: aload         17
     388: iload         18
     390: iaload
     391: istore        19
     393: aload         17
     395: iload         18
     397: iload         19
     399: iconst_1
     400: iadd
     401: iastore
     402: nop
     403: nop
     404: goto          334
     407: nop
     408: return

  static void mark$default(com.github.afranken.aoc.Day202105, int[][], com.github.afranken.aoc.Day202105$Pair, com.github.afranken.aoc.Day202105$Pair, boolean, int, java.lang.Object);
    Code:
       0: iload         5
       2: bipush        8
       4: iand
       5: ifeq          11
       8: iconst_0
       9: istore        4
      11: aload_0
      12: aload_1
      13: aload_2
      14: aload_3
      15: iload         4
      17: invokespecial #99                 // Method mark:([[ILcom/github/afranken/aoc/Day202105$Pair;Lcom/github/afranken/aoc/Day202105$Pair;Z)V
      20: return

  private final java.util.List<java.util.List<java.lang.Integer>> getCoordinates(java.lang.String[]);
    Code:
       0: aload_1
       1: astore_2
       2: iconst_0
       3: istore_3
       4: aload_2
       5: astore        4
       7: new           #180                // class java/util/ArrayList
      10: dup
      11: aload_2
      12: arraylength
      13: invokespecial #183                // Method java/util/ArrayList."<init>":(I)V
      16: checkcast     #185                // class java/util/Collection
      19: astore        5
      21: iconst_0
      22: istore        6
      24: iconst_0
      25: istore        7
      27: aload         4
      29: arraylength
      30: istore        8
      32: iload         7
      34: iload         8
      36: if_icmpge     105
      39: aload         4
      41: iload         7
      43: aaload
      44: astore        9
      46: aload         5
      48: aload         9
      50: astore        10
      52: astore        21
      54: iconst_0
      55: istore        11
      57: aload         10
      59: checkcast     #187                // class java/lang/CharSequence
      62: iconst_2
      63: anewarray     #105                // class java/lang/String
      66: astore        12
      68: aload         12
      70: iconst_0
      71: ldc           #189                // String ,
      73: aastore
      74: aload         12
      76: iconst_1
      77: ldc           #191                // String  ->
      79: aastore
      80: aload         12
      82: iconst_0
      83: iconst_0
      84: bipush        6
      86: aconst_null
      87: invokestatic  #197                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      90: aload         21
      92: swap
      93: invokeinterface #201,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      98: pop
      99: iinc          7, 1
     102: goto          32
     105: aload         5
     107: checkcast     #47                 // class java/util/List
     110: nop
     111: checkcast     #31                 // class java/lang/Iterable
     114: astore_2
     115: nop
     116: iconst_0
     117: istore_3
     118: aload_2
     119: astore        4
     121: new           #180                // class java/util/ArrayList
     124: dup
     125: aload_2
     126: bipush        10
     128: invokestatic  #205                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     131: invokespecial #183                // Method java/util/ArrayList."<init>":(I)V
     134: checkcast     #185                // class java/util/Collection
     137: astore        5
     139: iconst_0
     140: istore        6
     142: aload         4
     144: invokeinterface #35,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     149: astore        7
     151: aload         7
     153: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     158: ifeq          298
     161: aload         7
     163: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     168: astore        8
     170: aload         5
     172: aload         8
     174: checkcast     #47                 // class java/util/List
     177: astore        9
     179: astore        21
     181: iconst_0
     182: istore        10
     184: aload         9
     186: checkcast     #31                 // class java/lang/Iterable
     189: astore        11
     191: iconst_0
     192: istore        12
     194: aload         11
     196: astore        13
     198: new           #180                // class java/util/ArrayList
     201: dup
     202: aload         11
     204: bipush        10
     206: invokestatic  #205                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     209: invokespecial #183                // Method java/util/ArrayList."<init>":(I)V
     212: checkcast     #185                // class java/util/Collection
     215: astore        14
     217: iconst_0
     218: istore        15
     220: aload         13
     222: invokeinterface #35,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     227: astore        16
     229: aload         16
     231: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     236: ifeq          279
     239: aload         16
     241: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     246: astore        17
     248: aload         14
     250: aload         17
     252: checkcast     #105                // class java/lang/String
     255: astore        18
     257: astore        19
     259: iconst_0
     260: istore        20
     262: aload         18
     264: invokestatic  #133                // Method java/lang/Integer.valueOf:(Ljava/lang/String;)Ljava/lang/Integer;
     267: aload         19
     269: swap
     270: invokeinterface #201,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     275: pop
     276: goto          229
     279: aload         14
     281: checkcast     #47                 // class java/util/List
     284: nop
     285: nop
     286: aload         21
     288: swap
     289: invokeinterface #201,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     294: pop
     295: goto          151
     298: aload         5
     300: checkcast     #47                 // class java/util/List
     303: nop
     304: areturn

  static {};
    Code:
       0: new           #2                  // class com/github/afranken/aoc/Day202105
       3: dup
       4: invokespecial #217                // Method "<init>":()V
       7: putstatic     #65                 // Field INSTANCE:Lcom/github/afranken/aoc/Day202105;
      10: return
}

Compiled from "Day202105.kt"
public final class com.github.afranken.aoc.Day202105$Pair {
  private final int x;

  private final int y;

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

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

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

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

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

  public final com.github.afranken.aoc.Day202105$Pair copy(int, int);
    Code:
       0: new           #2                  // class com/github/afranken/aoc/Day202105$Pair
       3: dup
       4: iload_1
       5: iload_2
       6: invokespecial #28                 // Method "<init>":(II)V
       9: areturn

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

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

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

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


package com.github.afranken.aoc

object Day202108 {

    fun part1(inputs: Array<String>): Int {
        val input = convert(inputs)
        var count = 0

        input.forEach {
            it.second.forEach {
                when (it.length) {
                    2 -> count++ // 1
                    4 -> count++ // 4
                    3 -> count++ // 7
                    7 -> count++ // 8
                }
            }
        }

        return count
    }

    fun part2(inputs: Array<String>): Int {
        val input = convert(inputs)

        return input.sumOf {  (input, output) ->
            randomConfig(input, output)
         }
    }

    /**
     * Took this from Sebastian's solution after many tries of implementing this myself.
     * Kudos!
     *
     * https://github.com/SebastianAigner
     */
    private val segmentsToDigits = mapOf(
        setOf(0, 1, 2, 4, 5, 6) to 0,
        setOf(2, 5) to 1,
        setOf(0, 2, 3, 4, 6) to 2,
        setOf(0, 2, 3, 5, 6) to 3,
        setOf(1, 2, 3, 5) to 4,
        setOf(0, 1, 3, 5, 6) to 5,
        setOf(0, 1, 3, 4, 5, 6) to 6,
        setOf(0, 2, 5) to 7,
        setOf(0, 1, 2, 3, 4, 5, 6) to 8,
        setOf(0, 1, 2, 3, 5, 6) to 9
    )

    private fun randomConfig(words: List<String>, expectedNumbers: List<String>): Int {
        val inputCables = 0..6
        val inputChars = 'a'..'g'
        fun getMapping(): Map<Char, Int> {
            permute@ while (true) {
                val perm = inputChars.zip(inputCables.shuffled()).toMap()
                for (word in words) {
                    val mapped = word.map { perm[it]!! }.toSet()
                    val isValidDigit = segmentsToDigits.containsKey(mapped)
                    if (!isValidDigit) continue@permute
                }
                return perm
            }
        }

        val mapping = getMapping()
        val num = expectedNumbers.joinToString("") { digit ->
            val segments = digit.map { mapping[it]!! }.toSet()
            val dig = segmentsToDigits[segments]!!
            "$dig"
        }
        return num.toInt()
    }

    private fun convert(inputs: Array<String>): List<Pair<List<String>, List<String>>> {
        return inputs.map{
            val (part1, part2) = it.split(" | ")
            val signals = part1.split(" ")
            val digits = part2.split(" ")
            Pair(signals, digits)
        }
    }
}

Compiled from "Day202108.kt"
public final class com.github.afranken.aoc.Day202108 {
  public static final com.github.afranken.aoc.Day202108 INSTANCE;

  private static final java.util.Map<java.util.Set<java.lang.Integer>, java.lang.Integer> segmentsToDigits;

  private com.github.afranken.aoc.Day202108();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final int part1(java.lang.String[]);
    Code:
       0: aload_1
       1: ldc           #15                 // String inputs
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: invokespecial #25                 // Method convert:([Ljava/lang/String;)Ljava/util/List;
      11: astore_2
      12: iconst_0
      13: istore_3
      14: aload_2
      15: checkcast     #27                 // class java/lang/Iterable
      18: astore        4
      20: iconst_0
      21: istore        5
      23: aload         4
      25: invokeinterface #31,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      30: astore        6
      32: aload         6
      34: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      39: ifeq          192
      42: aload         6
      44: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      49: astore        7
      51: aload         7
      53: checkcast     #43                 // class kotlin/Pair
      56: astore        8
      58: iconst_0
      59: istore        9
      61: aload         8
      63: invokevirtual #46                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      66: checkcast     #27                 // class java/lang/Iterable
      69: astore        10
      71: iconst_0
      72: istore        11
      74: aload         10
      76: invokeinterface #31,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      81: astore        12
      83: aload         12
      85: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      90: ifeq          186
      93: aload         12
      95: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     100: astore        13
     102: aload         13
     104: checkcast     #48                 // class java/lang/String
     107: astore        14
     109: iconst_0
     110: istore        15
     112: aload         14
     114: invokevirtual #52                 // Method java/lang/String.length:()I
     117: tableswitch   { // 2 to 7
                     2: 156
                     3: 170
                     4: 163
                     5: 181
                     6: 181
                     7: 177
               default: 181
          }
     156: iload_3
     157: iconst_1
     158: iadd
     159: istore_3
     160: goto          181
     163: iload_3
     164: iconst_1
     165: iadd
     166: istore_3
     167: goto          181
     170: iload_3
     171: iconst_1
     172: iadd
     173: istore_3
     174: goto          181
     177: iload_3
     178: iconst_1
     179: iadd
     180: istore_3
     181: nop
     182: nop
     183: goto          83
     186: nop
     187: nop
     188: nop
     189: goto          32
     192: nop
     193: iload_3
     194: ireturn

  public final int part2(java.lang.String[]);
    Code:
       0: aload_1
       1: ldc           #15                 // String inputs
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: invokespecial #25                 // Method convert:([Ljava/lang/String;)Ljava/util/List;
      11: astore_2
      12: aload_2
      13: checkcast     #27                 // class java/lang/Iterable
      16: astore_3
      17: iconst_0
      18: istore        4
      20: aload_3
      21: invokeinterface #31,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      26: astore        5
      28: aload         5
      30: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      35: ifeq          103
      38: aload         5
      40: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      45: astore        6
      47: iload         4
      49: aload         6
      51: checkcast     #43                 // class kotlin/Pair
      54: astore        7
      56: istore        11
      58: iconst_0
      59: istore        8
      61: aload         7
      63: invokevirtual #74                 // Method kotlin/Pair.component1:()Ljava/lang/Object;
      66: checkcast     #70                 // class java/util/List
      69: astore        9
      71: aload         7
      73: invokevirtual #77                 // Method kotlin/Pair.component2:()Ljava/lang/Object;
      76: checkcast     #70                 // class java/util/List
      79: astore        10
      81: getstatic     #80                 // Field INSTANCE:Lcom/github/afranken/aoc/Day202108;
      84: aload         9
      86: aload         10
      88: invokespecial #84                 // Method randomConfig:(Ljava/util/List;Ljava/util/List;)I
      91: istore        12
      93: iload         11
      95: iload         12
      97: iadd
      98: istore        4
     100: goto          28
     103: iload         4
     105: ireturn

  private final int randomConfig(java.util.List<java.lang.String>, java.util.List<java.lang.String>);
    Code:
       0: new           #89                 // class kotlin/ranges/IntRange
       3: dup
       4: iconst_0
       5: bipush        6
       7: invokespecial #92                 // Method kotlin/ranges/IntRange."<init>":(II)V
      10: astore_3
      11: new           #94                 // class kotlin/ranges/CharRange
      14: dup
      15: bipush        97
      17: bipush        103
      19: invokespecial #97                 // Method kotlin/ranges/CharRange."<init>":(CC)V
      22: astore        4
      24: aload         4
      26: aload_3
      27: aload_1
      28: invokestatic  #101                // Method randomConfig$getMapping:(Lkotlin/ranges/CharRange;Lkotlin/ranges/IntRange;Ljava/util/List;)Ljava/util/Map;
      31: astore        5
      33: aload_2
      34: checkcast     #27                 // class java/lang/Iterable
      37: ldc           #103                // String
      39: checkcast     #105                // class java/lang/CharSequence
      42: aconst_null
      43: aconst_null
      44: iconst_0
      45: aconst_null
      46: aload         5
      48: invokedynamic #125,  0            // InvokeDynamic #0:invoke:(Ljava/util/Map;)Lkotlin/jvm/functions/Function1;
      53: bipush        30
      55: aconst_null
      56: invokestatic  #131                // 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;
      59: astore        6
      61: aload         6
      63: invokestatic  #137                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      66: ireturn

  private final java.util.List<kotlin.Pair<java.util.List<java.lang.String>, java.util.List<java.lang.String>>> convert(java.lang.String[]);
    Code:
       0: aload_1
       1: astore_2
       2: iconst_0
       3: istore_3
       4: aload_2
       5: astore        4
       7: new           #149                // class java/util/ArrayList
      10: dup
      11: aload_2
      12: arraylength
      13: invokespecial #152                // Method java/util/ArrayList."<init>":(I)V
      16: checkcast     #154                // class java/util/Collection
      19: astore        5
      21: iconst_0
      22: istore        6
      24: iconst_0
      25: istore        7
      27: aload         4
      29: arraylength
      30: istore        8
      32: iload         7
      34: iload         8
      36: if_icmpge     196
      39: aload         4
      41: iload         7
      43: aaload
      44: astore        9
      46: aload         5
      48: aload         9
      50: astore        10
      52: astore        18
      54: iconst_0
      55: istore        11
      57: aload         10
      59: checkcast     #105                // class java/lang/CharSequence
      62: iconst_1
      63: anewarray     #48                 // class java/lang/String
      66: astore        12
      68: aload         12
      70: iconst_0
      71: ldc           #156                // String  |
      73: aastore
      74: aload         12
      76: iconst_0
      77: iconst_0
      78: bipush        6
      80: aconst_null
      81: invokestatic  #162                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      84: astore        13
      86: aload         13
      88: iconst_0
      89: invokeinterface #166,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      94: checkcast     #48                 // class java/lang/String
      97: astore        12
      99: aload         13
     101: iconst_1
     102: invokeinterface #166,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     107: checkcast     #48                 // class java/lang/String
     110: astore        14
     112: aload         12
     114: checkcast     #105                // class java/lang/CharSequence
     117: iconst_1
     118: anewarray     #48                 // class java/lang/String
     121: astore        15
     123: aload         15
     125: iconst_0
     126: ldc           #168                // String
     128: aastore
     129: aload         15
     131: iconst_0
     132: iconst_0
     133: bipush        6
     135: aconst_null
     136: invokestatic  #162                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     139: astore        16
     141: aload         14
     143: checkcast     #105                // class java/lang/CharSequence
     146: iconst_1
     147: anewarray     #48                 // class java/lang/String
     150: astore        17
     152: aload         17
     154: iconst_0
     155: ldc           #168                // String
     157: aastore
     158: aload         17
     160: iconst_0
     161: iconst_0
     162: bipush        6
     164: aconst_null
     165: invokestatic  #162                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     168: astore        15
     170: new           #43                 // class kotlin/Pair
     173: dup
     174: aload         16
     176: aload         15
     178: invokespecial #171                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     181: aload         18
     183: swap
     184: invokeinterface #175,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     189: pop
     190: iinc          7, 1
     193: goto          32
     196: aload         5
     198: checkcast     #70                 // class java/util/List
     201: nop
     202: areturn

  private static final java.util.Map<java.lang.Character, java.lang.Integer> randomConfig$getMapping(kotlin.ranges.CharRange, kotlin.ranges.IntRange, java.util.List<java.lang.String>);
    Code:
       0: nop
       1: aload_0
       2: checkcast     #27                 // class java/lang/Iterable
       5: aload_1
       6: checkcast     #27                 // class java/lang/Iterable
       9: invokestatic  #191                // Method kotlin/collections/CollectionsKt.shuffled:(Ljava/lang/Iterable;)Ljava/util/List;
      12: checkcast     #27                 // class java/lang/Iterable
      15: invokestatic  #195                // Method kotlin/collections/CollectionsKt.zip:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/List;
      18: checkcast     #27                 // class java/lang/Iterable
      21: invokestatic  #201                // Method kotlin/collections/MapsKt.toMap:(Ljava/lang/Iterable;)Ljava/util/Map;
      24: astore_3
      25: aload_2
      26: invokeinterface #202,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
      31: astore        4
      33: aload         4
      35: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      40: ifeq          201
      43: aload         4
      45: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      50: checkcast     #48                 // class java/lang/String
      53: astore        5
      55: aload         5
      57: checkcast     #105                // class java/lang/CharSequence
      60: astore        7
      62: iconst_0
      63: istore        8
      65: aload         7
      67: astore        9
      69: new           #149                // class java/util/ArrayList
      72: dup
      73: aload         7
      75: invokeinterface #203,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      80: invokespecial #152                // Method java/util/ArrayList."<init>":(I)V
      83: checkcast     #154                // class java/util/Collection
      86: astore        10
      88: iconst_0
      89: istore        11
      91: iconst_0
      92: istore        12
      94: iload         12
      96: aload         9
      98: invokeinterface #203,  1          // InterfaceMethod java/lang/CharSequence.length:()I
     103: if_icmpge     167
     106: aload         9
     108: iload         12
     110: invokeinterface #207,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     115: istore        13
     117: aload         10
     119: iload         13
     121: istore        14
     123: astore        16
     125: iconst_0
     126: istore        15
     128: aload_3
     129: iload         14
     131: invokestatic  #213                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     134: invokeinterface #217,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     139: dup
     140: invokestatic  #221                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     143: checkcast     #223                // class java/lang/Number
     146: invokevirtual #226                // Method java/lang/Number.intValue:()I
     149: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     152: aload         16
     154: swap
     155: invokeinterface #175,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     160: pop
     161: iinc          12, 1
     164: goto          94
     167: aload         10
     169: checkcast     #70                 // class java/util/List
     172: nop
     173: checkcast     #27                 // class java/lang/Iterable
     176: invokestatic  #233                // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;
     179: astore        6
     181: getstatic     #236                // Field segmentsToDigits:Ljava/util/Map;
     184: aload         6
     186: invokeinterface #239,  2          // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z
     191: istore        7
     193: iload         7
     195: ifne          33
     198: goto          0
     201: aload_3
     202: areturn

  private static final java.lang.CharSequence randomConfig$lambda$5(java.util.Map, java.lang.String);
    Code:
       0: aload_1
       1: ldc           #251                // String digit
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #105                // class java/lang/CharSequence
      10: astore_3
      11: iconst_0
      12: istore        4
      14: aload_3
      15: astore        5
      17: new           #149                // class java/util/ArrayList
      20: dup
      21: aload_3
      22: invokeinterface #203,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      27: invokespecial #152                // Method java/util/ArrayList."<init>":(I)V
      30: checkcast     #154                // class java/util/Collection
      33: astore        6
      35: iconst_0
      36: istore        7
      38: iconst_0
      39: istore        8
      41: iload         8
      43: aload         5
      45: invokeinterface #203,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      50: if_icmpge     114
      53: aload         5
      55: iload         8
      57: invokeinterface #207,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
      62: istore        9
      64: aload         6
      66: iload         9
      68: istore        10
      70: astore        12
      72: iconst_0
      73: istore        11
      75: aload_0
      76: iload         10
      78: invokestatic  #213                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      81: invokeinterface #217,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      86: dup
      87: invokestatic  #221                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      90: checkcast     #223                // class java/lang/Number
      93: invokevirtual #226                // Method java/lang/Number.intValue:()I
      96: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      99: aload         12
     101: swap
     102: invokeinterface #175,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     107: pop
     108: iinc          8, 1
     111: goto          41
     114: aload         6
     116: checkcast     #70                 // class java/util/List
     119: nop
     120: checkcast     #27                 // class java/lang/Iterable
     123: invokestatic  #233                // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;
     126: astore_2
     127: getstatic     #236                // Field segmentsToDigits:Ljava/util/Map;
     130: aload_2
     131: invokeinterface #217,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     136: dup
     137: invokestatic  #221                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     140: checkcast     #223                // class java/lang/Number
     143: invokevirtual #226                // Method java/lang/Number.intValue:()I
     146: istore_3
     147: iload_3
     148: invokestatic  #254                // Method java/lang/String.valueOf:(I)Ljava/lang/String;
     151: checkcast     #105                // class java/lang/CharSequence
     154: areturn

  static {};
    Code:
       0: new           #2                  // class com/github/afranken/aoc/Day202108
       3: dup
       4: invokespecial #260                // Method "<init>":()V
       7: putstatic     #80                 // Field INSTANCE:Lcom/github/afranken/aoc/Day202108;
      10: bipush        10
      12: anewarray     #43                 // class kotlin/Pair
      15: astore_0
      16: aload_0
      17: iconst_0
      18: bipush        6
      20: anewarray     #133                // class java/lang/Integer
      23: astore_1
      24: aload_1
      25: iconst_0
      26: iconst_0
      27: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      30: aastore
      31: aload_1
      32: iconst_1
      33: iconst_1
      34: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      37: aastore
      38: aload_1
      39: iconst_2
      40: iconst_2
      41: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      44: aastore
      45: aload_1
      46: iconst_3
      47: iconst_4
      48: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      51: aastore
      52: aload_1
      53: iconst_4
      54: iconst_5
      55: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      58: aastore
      59: aload_1
      60: iconst_5
      61: bipush        6
      63: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      66: aastore
      67: aload_1
      68: invokestatic  #266                // Method kotlin/collections/SetsKt.setOf:([Ljava/lang/Object;)Ljava/util/Set;
      71: iconst_0
      72: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      75: invokestatic  #272                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      78: aastore
      79: aload_0
      80: iconst_1
      81: iconst_2
      82: anewarray     #133                // class java/lang/Integer
      85: astore_1
      86: aload_1
      87: iconst_0
      88: iconst_2
      89: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      92: aastore
      93: aload_1
      94: iconst_1
      95: iconst_5
      96: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      99: aastore
     100: aload_1
     101: invokestatic  #266                // Method kotlin/collections/SetsKt.setOf:([Ljava/lang/Object;)Ljava/util/Set;
     104: iconst_1
     105: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     108: invokestatic  #272                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     111: aastore
     112: aload_0
     113: iconst_2
     114: iconst_5
     115: anewarray     #133                // class java/lang/Integer
     118: astore_1
     119: aload_1
     120: iconst_0
     121: iconst_0
     122: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     125: aastore
     126: aload_1
     127: iconst_1
     128: iconst_2
     129: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     132: aastore
     133: aload_1
     134: iconst_2
     135: iconst_3
     136: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     139: aastore
     140: aload_1
     141: iconst_3
     142: iconst_4
     143: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     146: aastore
     147: aload_1
     148: iconst_4
     149: bipush        6
     151: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     154: aastore
     155: aload_1
     156: invokestatic  #266                // Method kotlin/collections/SetsKt.setOf:([Ljava/lang/Object;)Ljava/util/Set;
     159: iconst_2
     160: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     163: invokestatic  #272                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     166: aastore
     167: aload_0
     168: iconst_3
     169: iconst_5
     170: anewarray     #133                // class java/lang/Integer
     173: astore_1
     174: aload_1
     175: iconst_0
     176: iconst_0
     177: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     180: aastore
     181: aload_1
     182: iconst_1
     183: iconst_2
     184: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     187: aastore
     188: aload_1
     189: iconst_2
     190: iconst_3
     191: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     194: aastore
     195: aload_1
     196: iconst_3
     197: iconst_5
     198: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     201: aastore
     202: aload_1
     203: iconst_4
     204: bipush        6
     206: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     209: aastore
     210: aload_1
     211: invokestatic  #266                // Method kotlin/collections/SetsKt.setOf:([Ljava/lang/Object;)Ljava/util/Set;
     214: iconst_3
     215: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     218: invokestatic  #272                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     221: aastore
     222: aload_0
     223: iconst_4
     224: iconst_4
     225: anewarray     #133                // class java/lang/Integer
     228: astore_1
     229: aload_1
     230: iconst_0
     231: iconst_1
     232: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     235: aastore
     236: aload_1
     237: iconst_1
     238: iconst_2
     239: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     242: aastore
     243: aload_1
     244: iconst_2
     245: iconst_3
     246: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     249: aastore
     250: aload_1
     251: iconst_3
     252: iconst_5
     253: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     256: aastore
     257: aload_1
     258: invokestatic  #266                // Method kotlin/collections/SetsKt.setOf:([Ljava/lang/Object;)Ljava/util/Set;
     261: iconst_4
     262: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     265: invokestatic  #272                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     268: aastore
     269: aload_0
     270: iconst_5
     271: iconst_5
     272: anewarray     #133                // class java/lang/Integer
     275: astore_1
     276: aload_1
     277: iconst_0
     278: iconst_0
     279: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     282: aastore
     283: aload_1
     284: iconst_1
     285: iconst_1
     286: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     289: aastore
     290: aload_1
     291: iconst_2
     292: iconst_3
     293: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     296: aastore
     297: aload_1
     298: iconst_3
     299: iconst_5
     300: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     303: aastore
     304: aload_1
     305: iconst_4
     306: bipush        6
     308: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     311: aastore
     312: aload_1
     313: invokestatic  #266                // Method kotlin/collections/SetsKt.setOf:([Ljava/lang/Object;)Ljava/util/Set;
     316: iconst_5
     317: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     320: invokestatic  #272                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     323: aastore
     324: aload_0
     325: bipush        6
     327: bipush        6
     329: anewarray     #133                // class java/lang/Integer
     332: astore_1
     333: aload_1
     334: iconst_0
     335: iconst_0
     336: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     339: aastore
     340: aload_1
     341: iconst_1
     342: iconst_1
     343: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     346: aastore
     347: aload_1
     348: iconst_2
     349: iconst_3
     350: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     353: aastore
     354: aload_1
     355: iconst_3
     356: iconst_4
     357: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     360: aastore
     361: aload_1
     362: iconst_4
     363: iconst_5
     364: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     367: aastore
     368: aload_1
     369: iconst_5
     370: bipush        6
     372: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     375: aastore
     376: aload_1
     377: invokestatic  #266                // Method kotlin/collections/SetsKt.setOf:([Ljava/lang/Object;)Ljava/util/Set;
     380: bipush        6
     382: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     385: invokestatic  #272                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     388: aastore
     389: aload_0
     390: bipush        7
     392: iconst_3
     393: anewarray     #133                // class java/lang/Integer
     396: astore_1
     397: aload_1
     398: iconst_0
     399: iconst_0
     400: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     403: aastore
     404: aload_1
     405: iconst_1
     406: iconst_2
     407: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     410: aastore
     411: aload_1
     412: iconst_2
     413: iconst_5
     414: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     417: aastore
     418: aload_1
     419: invokestatic  #266                // Method kotlin/collections/SetsKt.setOf:([Ljava/lang/Object;)Ljava/util/Set;
     422: bipush        7
     424: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     427: invokestatic  #272                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     430: aastore
     431: aload_0
     432: bipush        8
     434: bipush        7
     436: anewarray     #133                // class java/lang/Integer
     439: astore_1
     440: aload_1
     441: iconst_0
     442: iconst_0
     443: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     446: aastore
     447: aload_1
     448: iconst_1
     449: iconst_1
     450: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     453: aastore
     454: aload_1
     455: iconst_2
     456: iconst_2
     457: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     460: aastore
     461: aload_1
     462: iconst_3
     463: iconst_3
     464: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     467: aastore
     468: aload_1
     469: iconst_4
     470: iconst_4
     471: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     474: aastore
     475: aload_1
     476: iconst_5
     477: iconst_5
     478: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     481: aastore
     482: aload_1
     483: bipush        6
     485: bipush        6
     487: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     490: aastore
     491: aload_1
     492: invokestatic  #266                // Method kotlin/collections/SetsKt.setOf:([Ljava/lang/Object;)Ljava/util/Set;
     495: bipush        8
     497: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     500: invokestatic  #272                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     503: aastore
     504: aload_0
     505: bipush        9
     507: bipush        6
     509: anewarray     #133                // class java/lang/Integer
     512: astore_1
     513: aload_1
     514: iconst_0
     515: iconst_0
     516: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     519: aastore
     520: aload_1
     521: iconst_1
     522: iconst_1
     523: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     526: aastore
     527: aload_1
     528: iconst_2
     529: iconst_2
     530: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     533: aastore
     534: aload_1
     535: iconst_3
     536: iconst_3
     537: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     540: aastore
     541: aload_1
     542: iconst_4
     543: iconst_5
     544: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     547: aastore
     548: aload_1
     549: iconst_5
     550: bipush        6
     552: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     555: aastore
     556: aload_1
     557: invokestatic  #266                // Method kotlin/collections/SetsKt.setOf:([Ljava/lang/Object;)Ljava/util/Set;
     560: bipush        9
     562: invokestatic  #229                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     565: invokestatic  #272                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     568: aastore
     569: aload_0
     570: invokestatic  #276                // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;
     573: putstatic     #236                // Field segmentsToDigits:Ljava/util/Map;
     576: return
}