import kotlin.math.absoluteValue

private const val TEST_LINE = 10
private const val LINE = 2_000_000

private const val TEST_SIZE = 20
private const val SIZE = 4_000_000

private val template = "Sensor at x=(-?\\d+), y=(-?\\d+): closest beacon is at x=(-?\\d+), y=(-?\\d+)".toRegex()

private fun getCoordinates(input: List<String>) = input.map { template.matchEntire(it)!!.destructured }
    .map { (x, y, bx, by) -> (x.toInt() to y.toInt()) to (bx.toInt() to by.toInt()) }

private fun MutableSet<Pair<Int, Int>>.addRange(other: Pair<Int, Int>) {
    for (pair in this) {
        if (pair.include(other)) {
            if (other.diff() > pair.diff()) {
                remove(pair)
                addRange(other)
            }

            return
        }
    }

    for (pair in this) {
        if (pair.intersect(other)) {
            remove(pair)
            addRange(
                pair.first.coerceAtMost(other.first)
                    to pair.second.coerceAtLeast(other.second)
            )
            return
        }
    }

    add(other)
}

private fun Set<Pair<Int, Int>>.amount() = sumOf { it.diff() + 1 }

private fun fillLine(
    coordinates: List<Pair<Pair<Int, Int>, Pair<Int, Int>>>,
    line: Int,
    leastX: Int = Int.MIN_VALUE,
    mostX: Int = Int.MAX_VALUE,
): Set<Pair<Int, Int>> {
    val xs = mutableSetOf<Pair<Int, Int>>()
    for ((sensor, beacon) in coordinates) {
        val beaconDistance = sensor.manhattan(beacon)
        val lineDistance = (line - sensor.second).absoluteValue
        val rangeWidth = beaconDistance - lineDistance

        if (rangeWidth < 0) continue

        xs.addRange(
            (sensor.first - rangeWidth).coerceAtLeast(leastX)
                to (sensor.first + rangeWidth).coerceAtMost(mostX)
        )
    }

    return xs
}

private fun frequency(x: Int, y: Int) = 1L * SIZE * x + y

fun main() {
    fun part1(input: List<String>, line: Int) = fillLine(getCoordinates(input), line).amount() - 1

    fun part2(input: List<String>, size: Int): Long? {
        val coordinates = getCoordinates(input)
        for (line in 0..size) {
            val xs = fillLine(coordinates, line, 0, size)

            if (xs.amount() != size + 1) {
                if (xs.size == 2) {
                    assert(xs.first().second + 1 == xs.last().first - 1)

                    return frequency(xs.first().second + 1, line)
                }
                assert(xs.size == 1)

                return frequency(if (xs.first().first == 0) size else 0, line)
            }
        }

        return null
    }

    // test if implementation meets criteria from the description, like:
    val testInput = readInput("Day15_test")
    check(part1(testInput, TEST_LINE) == 26)
    check(part2(testInput, TEST_SIZE) == 56_000_011L)

    val input = readInput("Day15")
    println(part1(input, LINE))
    println(part2(input, SIZE))
}

Compiled from "Day15.kt"
public final class Day15Kt {
  private static final int TEST_LINE;

  private static final int LINE;

  private static final int TEST_SIZE;

  private static final int SIZE;

  private static final kotlin.text.Regex template;

  private static final java.util.List<kotlin.Pair<kotlin.Pair<java.lang.Integer, java.lang.Integer>, kotlin.Pair<java.lang.Integer, java.lang.Integer>>> getCoordinates(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #9                  // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: astore_3
       9: new           #11                 // class java/util/ArrayList
      12: dup
      13: aload_1
      14: bipush        10
      16: invokestatic  #17                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      19: invokespecial #21                 // Method java/util/ArrayList."<init>":(I)V
      22: checkcast     #23                 // class java/util/Collection
      25: astore        4
      27: iconst_0
      28: istore        5
      30: aload_3
      31: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      36: astore        6
      38: aload         6
      40: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      45: ifeq          103
      48: aload         6
      50: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      55: astore        7
      57: aload         4
      59: aload         7
      61: checkcast     #39                 // class java/lang/String
      64: astore        8
      66: astore        14
      68: iconst_0
      69: istore        9
      71: getstatic     #43                 // Field template:Lkotlin/text/Regex;
      74: aload         8
      76: checkcast     #45                 // class java/lang/CharSequence
      79: invokevirtual #51                 // Method kotlin/text/Regex.matchEntire:(Ljava/lang/CharSequence;)Lkotlin/text/MatchResult;
      82: dup
      83: invokestatic  #57                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      86: invokeinterface #63,  1           // InterfaceMethod kotlin/text/MatchResult.getDestructured:()Lkotlin/text/MatchResult$Destructured;
      91: aload         14
      93: swap
      94: invokeinterface #67,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      99: pop
     100: goto          38
     103: aload         4
     105: checkcast     #69                 // class java/util/List
     108: nop
     109: checkcast     #9                  // class java/lang/Iterable
     112: astore_1
     113: nop
     114: iconst_0
     115: istore_2
     116: aload_1
     117: astore_3
     118: new           #11                 // class java/util/ArrayList
     121: dup
     122: aload_1
     123: bipush        10
     125: invokestatic  #17                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     128: invokespecial #21                 // Method java/util/ArrayList."<init>":(I)V
     131: checkcast     #23                 // class java/util/Collection
     134: astore        4
     136: iconst_0
     137: istore        5
     139: aload_3
     140: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     145: astore        6
     147: aload         6
     149: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     154: ifeq          317
     157: aload         6
     159: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     164: astore        7
     166: aload         4
     168: aload         7
     170: checkcast     #71                 // class kotlin/text/MatchResult$Destructured
     173: astore        8
     175: astore        14
     177: iconst_0
     178: istore        9
     180: aload         8
     182: invokevirtual #75                 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     185: invokeinterface #79,  1           // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     190: iconst_1
     191: invokeinterface #83,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     196: checkcast     #39                 // class java/lang/String
     199: astore        10
     201: aload         8
     203: invokevirtual #75                 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     206: invokeinterface #79,  1           // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     211: iconst_2
     212: invokeinterface #83,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     217: checkcast     #39                 // class java/lang/String
     220: astore        11
     222: aload         8
     224: invokevirtual #75                 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     227: invokeinterface #79,  1           // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     232: iconst_3
     233: invokeinterface #83,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     238: checkcast     #39                 // class java/lang/String
     241: astore        12
     243: aload         8
     245: invokevirtual #75                 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     248: invokeinterface #79,  1           // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     253: iconst_4
     254: invokeinterface #83,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     259: checkcast     #39                 // class java/lang/String
     262: astore        13
     264: aload         10
     266: invokestatic  #89                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     269: invokestatic  #93                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     272: aload         11
     274: invokestatic  #89                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     277: invokestatic  #93                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     280: invokestatic  #99                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     283: aload         12
     285: invokestatic  #89                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     288: invokestatic  #93                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     291: aload         13
     293: invokestatic  #89                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     296: invokestatic  #93                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     299: invokestatic  #99                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     302: invokestatic  #99                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     305: aload         14
     307: swap
     308: invokeinterface #67,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     313: pop
     314: goto          147
     317: aload         4
     319: checkcast     #69                 // class java/util/List
     322: nop
     323: areturn

  private static final void addRange(java.util.Set<kotlin.Pair<java.lang.Integer, java.lang.Integer>>, kotlin.Pair<java.lang.Integer, java.lang.Integer>);
    Code:
       0: aload_0
       1: invokeinterface #125,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
       6: astore_2
       7: aload_2
       8: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      13: ifeq          59
      16: aload_2
      17: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      22: checkcast     #127                // class kotlin/Pair
      25: astore_3
      26: aload_3
      27: aload_1
      28: invokestatic  #133                // Method UtilsKt.include:(Lkotlin/Pair;Lkotlin/Pair;)Z
      31: ifeq          7
      34: aload_1
      35: invokestatic  #137                // Method UtilsKt.diff:(Lkotlin/Pair;)I
      38: aload_3
      39: invokestatic  #137                // Method UtilsKt.diff:(Lkotlin/Pair;)I
      42: if_icmple     58
      45: aload_0
      46: aload_3
      47: invokeinterface #140,  2          // InterfaceMethod java/util/Set.remove:(Ljava/lang/Object;)Z
      52: pop
      53: aload_0
      54: aload_1
      55: invokestatic  #142                // Method addRange:(Ljava/util/Set;Lkotlin/Pair;)V
      58: return
      59: aload_0
      60: invokeinterface #125,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
      65: astore_2
      66: aload_2
      67: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      72: ifeq          161
      75: aload_2
      76: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      81: checkcast     #127                // class kotlin/Pair
      84: astore_3
      85: aload_3
      86: aload_1
      87: invokestatic  #145                // Method UtilsKt.intersect:(Lkotlin/Pair;Lkotlin/Pair;)Z
      90: ifeq          66
      93: aload_0
      94: aload_3
      95: invokeinterface #140,  2          // InterfaceMethod java/util/Set.remove:(Ljava/lang/Object;)Z
     100: pop
     101: aload_0
     102: aload_3
     103: invokevirtual #148                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     106: checkcast     #150                // class java/lang/Number
     109: invokevirtual #154                // Method java/lang/Number.intValue:()I
     112: aload_1
     113: invokevirtual #148                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     116: checkcast     #150                // class java/lang/Number
     119: invokevirtual #154                // Method java/lang/Number.intValue:()I
     122: invokestatic  #160                // Method kotlin/ranges/RangesKt.coerceAtMost:(II)I
     125: invokestatic  #93                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     128: aload_3
     129: invokevirtual #163                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     132: checkcast     #150                // class java/lang/Number
     135: invokevirtual #154                // Method java/lang/Number.intValue:()I
     138: aload_1
     139: invokevirtual #163                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     142: checkcast     #150                // class java/lang/Number
     145: invokevirtual #154                // Method java/lang/Number.intValue:()I
     148: invokestatic  #166                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
     151: invokestatic  #93                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     154: invokestatic  #99                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     157: invokestatic  #142                // Method addRange:(Ljava/util/Set;Lkotlin/Pair;)V
     160: return
     161: aload_0
     162: aload_1
     163: invokeinterface #167,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
     168: pop
     169: return

  private static final int amount(java.util.Set<kotlin.Pair<java.lang.Integer, java.lang.Integer>>);
    Code:
       0: aload_0
       1: checkcast     #9                  // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      13: astore_3
      14: aload_3
      15: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      20: ifeq          62
      23: aload_3
      24: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      29: astore        4
      31: iload_2
      32: aload         4
      34: checkcast     #127                // class kotlin/Pair
      37: astore        5
      39: istore        7
      41: iconst_0
      42: istore        6
      44: aload         5
      46: invokestatic  #137                // Method UtilsKt.diff:(Lkotlin/Pair;)I
      49: iconst_1
      50: iadd
      51: istore        8
      53: iload         7
      55: iload         8
      57: iadd
      58: istore_2
      59: goto          14
      62: iload_2
      63: ireturn

  private static final java.util.Set<kotlin.Pair<java.lang.Integer, java.lang.Integer>> fillLine(java.util.List<kotlin.Pair<kotlin.Pair<java.lang.Integer, java.lang.Integer>, kotlin.Pair<java.lang.Integer, java.lang.Integer>>>, int, int, int);
    Code:
       0: new           #182                // class java/util/LinkedHashSet
       3: dup
       4: invokespecial #185                // Method java/util/LinkedHashSet."<init>":()V
       7: checkcast     #124                // class java/util/Set
      10: astore        4
      12: aload_0
      13: invokeinterface #186,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
      18: astore        5
      20: aload         5
      22: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      27: ifeq          154
      30: aload         5
      32: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      37: checkcast     #127                // class kotlin/Pair
      40: astore        6
      42: aload         6
      44: invokevirtual #189                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      47: checkcast     #127                // class kotlin/Pair
      50: astore        7
      52: aload         6
      54: invokevirtual #192                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      57: checkcast     #127                // class kotlin/Pair
      60: astore        8
      62: aload         7
      64: aload         8
      66: invokestatic  #196                // Method UtilsKt.manhattan:(Lkotlin/Pair;Lkotlin/Pair;)I
      69: istore        9
      71: iload_1
      72: aload         7
      74: invokevirtual #163                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      77: checkcast     #150                // class java/lang/Number
      80: invokevirtual #154                // Method java/lang/Number.intValue:()I
      83: isub
      84: invokestatic  #202                // Method java/lang/Math.abs:(I)I
      87: istore        10
      89: iload         9
      91: iload         10
      93: isub
      94: istore        11
      96: iload         11
      98: iflt          20
     101: aload         4
     103: aload         7
     105: invokevirtual #148                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     108: checkcast     #150                // class java/lang/Number
     111: invokevirtual #154                // Method java/lang/Number.intValue:()I
     114: iload         11
     116: isub
     117: iload_2
     118: invokestatic  #166                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
     121: invokestatic  #93                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     124: aload         7
     126: invokevirtual #148                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     129: checkcast     #150                // class java/lang/Number
     132: invokevirtual #154                // Method java/lang/Number.intValue:()I
     135: iload         11
     137: iadd
     138: iload_3
     139: invokestatic  #160                // Method kotlin/ranges/RangesKt.coerceAtMost:(II)I
     142: invokestatic  #93                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     145: invokestatic  #99                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     148: invokestatic  #142                // Method addRange:(Ljava/util/Set;Lkotlin/Pair;)V
     151: goto          20
     154: aload         4
     156: areturn

  static java.util.Set fillLine$default(java.util.List, int, int, int, int, java.lang.Object);
    Code:
       0: iload         4
       2: iconst_4
       3: iand
       4: ifeq          10
       7: ldc           #215                // int -2147483648
       9: istore_2
      10: iload         4
      12: bipush        8
      14: iand
      15: ifeq          21
      18: ldc           #216                // int 2147483647
      20: istore_3
      21: aload_0
      22: iload_1
      23: iload_2
      24: iload_3
      25: invokestatic  #218                // Method fillLine:(Ljava/util/List;III)Ljava/util/Set;
      28: areturn

  private static final long frequency(int, int);
    Code:
       0: ldc2_w        #221                // long 4000000l
       3: iload_0
       4: i2l
       5: lmul
       6: iload_1
       7: i2l
       8: ladd
       9: lreturn

  public static final void main();
    Code:
       0: ldc           #225                // String Day15_test
       2: invokestatic  #229                // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: aload_0
       7: bipush        10
       9: invokestatic  #233                // Method main$part1:(Ljava/util/List;I)I
      12: bipush        26
      14: if_icmpne     21
      17: iconst_1
      18: goto          22
      21: iconst_0
      22: ifne          35
      25: new           #235                // class java/lang/IllegalStateException
      28: dup
      29: ldc           #237                // String Check failed.
      31: invokespecial #240                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      34: athrow
      35: aload_0
      36: bipush        20
      38: invokestatic  #244                // Method main$part2:(Ljava/util/List;I)Ljava/lang/Long;
      41: ldc2_w        #245                // long 56000011l
      44: lstore_1
      45: dup
      46: ifnonnull     53
      49: pop
      50: goto          65
      53: invokevirtual #252                // Method java/lang/Long.longValue:()J
      56: lload_1
      57: lcmp
      58: ifne          65
      61: iconst_1
      62: goto          66
      65: iconst_0
      66: ifne          79
      69: new           #235                // class java/lang/IllegalStateException
      72: dup
      73: ldc           #237                // String Check failed.
      75: invokespecial #240                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      78: athrow
      79: ldc           #254                // String Day15
      81: invokestatic  #229                // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
      84: astore_1
      85: aload_1
      86: ldc           #255                // int 2000000
      88: invokestatic  #233                // Method main$part1:(Ljava/util/List;I)I
      91: istore_2
      92: getstatic     #261                // Field java/lang/System.out:Ljava/io/PrintStream;
      95: iload_2
      96: invokevirtual #266                // Method java/io/PrintStream.println:(I)V
      99: aload_1
     100: ldc_w         #267                // int 4000000
     103: invokestatic  #244                // Method main$part2:(Ljava/util/List;I)Ljava/lang/Long;
     106: getstatic     #261                // Field java/lang/System.out:Ljava/io/PrintStream;
     109: swap
     110: invokevirtual #269                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     113: return

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

  private static final int main$part1(java.util.List<java.lang.String>, int);
    Code:
       0: aload_0
       1: invokestatic  #278                // Method getCoordinates:(Ljava/util/List;)Ljava/util/List;
       4: iload_1
       5: iconst_0
       6: iconst_0
       7: bipush        12
       9: aconst_null
      10: invokestatic  #280                // Method fillLine$default:(Ljava/util/List;IIIILjava/lang/Object;)Ljava/util/Set;
      13: invokestatic  #282                // Method amount:(Ljava/util/Set;)I
      16: iconst_1
      17: isub
      18: ireturn

  private static final java.lang.Long main$part2(java.util.List<java.lang.String>, int);
    Code:
       0: aload_0
       1: invokestatic  #278                // Method getCoordinates:(Ljava/util/List;)Ljava/util/List;
       4: astore_2
       5: iconst_0
       6: istore_3
       7: iload_3
       8: iload_1
       9: if_icmpgt     244
      12: aload_2
      13: iload_3
      14: iconst_0
      15: iload_1
      16: invokestatic  #218                // Method fillLine:(Ljava/util/List;III)Ljava/util/Set;
      19: astore        4
      21: aload         4
      23: invokestatic  #282                // Method amount:(Ljava/util/Set;)I
      26: iload_1
      27: iconst_1
      28: iadd
      29: if_icmpeq     233
      32: aload         4
      34: invokeinterface #286,  1          // InterfaceMethod java/util/Set.size:()I
      39: iconst_2
      40: if_icmpne     153
      43: aload         4
      45: checkcast     #9                  // class java/lang/Iterable
      48: invokestatic  #290                // Method kotlin/collections/CollectionsKt.first:(Ljava/lang/Iterable;)Ljava/lang/Object;
      51: checkcast     #127                // class kotlin/Pair
      54: invokevirtual #163                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      57: checkcast     #150                // class java/lang/Number
      60: invokevirtual #154                // Method java/lang/Number.intValue:()I
      63: iconst_1
      64: iadd
      65: aload         4
      67: checkcast     #9                  // class java/lang/Iterable
      70: invokestatic  #293                // Method kotlin/collections/CollectionsKt.last:(Ljava/lang/Iterable;)Ljava/lang/Object;
      73: checkcast     #127                // class kotlin/Pair
      76: invokevirtual #148                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      79: checkcast     #150                // class java/lang/Number
      82: invokevirtual #154                // Method java/lang/Number.intValue:()I
      85: iconst_1
      86: isub
      87: if_icmpne     94
      90: iconst_1
      91: goto          95
      94: iconst_0
      95: istore        5
      97: getstatic     #299                // Field kotlin/_Assertions.ENABLED:Z
     100: ifeq          123
     103: iload         5
     105: ifne          123
     108: ldc_w         #301                // String Assertion failed
     111: astore        6
     113: new           #303                // class java/lang/AssertionError
     116: dup
     117: aload         6
     119: invokespecial #305                // Method java/lang/AssertionError."<init>":(Ljava/lang/Object;)V
     122: athrow
     123: aload         4
     125: checkcast     #9                  // class java/lang/Iterable
     128: invokestatic  #290                // Method kotlin/collections/CollectionsKt.first:(Ljava/lang/Iterable;)Ljava/lang/Object;
     131: checkcast     #127                // class kotlin/Pair
     134: invokevirtual #163                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     137: checkcast     #150                // class java/lang/Number
     140: invokevirtual #154                // Method java/lang/Number.intValue:()I
     143: iconst_1
     144: iadd
     145: iload_3
     146: invokestatic  #307                // Method frequency:(II)J
     149: invokestatic  #310                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     152: areturn
     153: aload         4
     155: invokeinterface #286,  1          // InterfaceMethod java/util/Set.size:()I
     160: iconst_1
     161: if_icmpne     168
     164: iconst_1
     165: goto          169
     168: iconst_0
     169: istore        5
     171: getstatic     #299                // Field kotlin/_Assertions.ENABLED:Z
     174: ifeq          197
     177: iload         5
     179: ifne          197
     182: ldc_w         #301                // String Assertion failed
     185: astore        6
     187: new           #303                // class java/lang/AssertionError
     190: dup
     191: aload         6
     193: invokespecial #305                // Method java/lang/AssertionError."<init>":(Ljava/lang/Object;)V
     196: athrow
     197: aload         4
     199: checkcast     #9                  // class java/lang/Iterable
     202: invokestatic  #290                // Method kotlin/collections/CollectionsKt.first:(Ljava/lang/Iterable;)Ljava/lang/Object;
     205: checkcast     #127                // class kotlin/Pair
     208: invokevirtual #148                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     211: checkcast     #150                // class java/lang/Number
     214: invokevirtual #154                // Method java/lang/Number.intValue:()I
     217: ifne          224
     220: iload_1
     221: goto          225
     224: iconst_0
     225: iload_3
     226: invokestatic  #307                // Method frequency:(II)J
     229: invokestatic  #310                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     232: areturn
     233: iload_3
     234: iload_1
     235: if_icmpeq     244
     238: iinc          3, 1
     241: goto          12
     244: aconst_null
     245: areturn

  static {};
    Code:
       0: new           #47                 // class kotlin/text/Regex
       3: dup
       4: ldc_w         #313                // String Sensor at x=(-?\\d+), y=(-?\\d+): closest beacon is at x=(-?\\d+), y=(-?\\d+)
       7: invokespecial #314                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      10: putstatic     #43                 // Field template:Lkotlin/text/Regex;
      13: return
}


private const val MAX_DIR_SIZE = 100_000
private const val DISK_SPACE = 70_000_000
private const val UPDATE_SIZE = 30_000_000

private data class FS(
    val name: String,
    val parent: FS?, // null for root dir only.
) {
    val files: MutableList<Int> = mutableListOf()
    val folders: MutableList<FS> = mutableListOf()
    var size: Int = 0
        get() {
            if (field == 0) field = files.sum() + folders.sumOf { it.size }
            return field
        }

    fun fill(instructions: List<String>): FS {
        var curDir = this

        for (instruction in instructions) {
            when {
                instruction.startsWith("cd ") -> curDir = curDir.handleCd(instruction)
                instruction.startsWith("ls ") -> curDir.handleLs(instruction)
                else -> error("Incorrect input")
            }
        }

        return this
    }

    private fun handleCd(instruction: String): FS {
        val dir = instruction.split(" ").last()
        if (dir == "/") return this

        return if (dir == "..") this.parent!! else this.cd(dir)
    }

    private fun cd(name: String) = this.folders.first { it.name == name } // presuming absolute paths unique.

    private fun handleLs(instruction: String): FS {
        val content = instruction.split(" ").drop(1).chunked(2).map { it.first() to it.last() }

        for ((first, second) in content) {
            when {
                first == "dir" -> this.folders.add(FS(second, this))
                first.toIntOrNull() != null -> this.files.add(first.toInt()) // presuming file names unique.
                else -> error("Incorrect input")
            }
        }

        return this
    }

    fun <T> map(f: (FS) -> T): List<T> {
        val res = mutableListOf(f(this))
        res.addAll(folders.flatMap { it.map(f) })
        return res
    }

    fun print(indent: Int = 0) {
        repeat(indent) { print("  - ") }
        println(this)
        folders.map { it.print(indent + 1) }
    }

    override fun toString() = "FS($name, $files, $size)"
}

fun getInstructions(input: List<String>) = input.joinToString(" ").split("$ ").drop(1).map(String::trim)

fun main() {
    fun part1(input: List<String>) =
        FS("/", null).fill(getInstructions(input)).map { it.size }.filter { it <= MAX_DIR_SIZE }.sum()

    fun part2(input: List<String>): Int {
        val root = FS("/", null)
        root.fill(getInstructions(input))

        val sizes = root.map { it.size }
        val required = UPDATE_SIZE - (DISK_SPACE - sizes.first())

        return sizes.filter { it >= required }.min()
    }

    // test if implementation meets criteria from the description, like:
    val testInput = readBlocks("Day07_test").first()
    check(part1(testInput) == 95_437)
    check(part2(testInput) == 24_933_642)

    val input = readBlocks("Day07").first()
    println(part1(input))
    println(part2(input))
}

Compiled from "Day07.kt"
public final class Day07Kt {
  private static final int MAX_DIR_SIZE;

  private static final int DISK_SPACE;

  private static final int UPDATE_SIZE;

  public static final java.util.List<java.lang.String> getInstructions(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: ldc           #10                 // String input
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #18                 // class java/lang/Iterable
      10: ldc           #20                 // String
      12: checkcast     #22                 // class java/lang/CharSequence
      15: aconst_null
      16: aconst_null
      17: iconst_0
      18: aconst_null
      19: aconst_null
      20: bipush        62
      22: aconst_null
      23: invokestatic  #28                 // 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;
      26: checkcast     #22                 // class java/lang/CharSequence
      29: iconst_1
      30: anewarray     #30                 // class java/lang/String
      33: astore_1
      34: aload_1
      35: iconst_0
      36: ldc           #32                 // String $
      38: aastore
      39: aload_1
      40: iconst_0
      41: iconst_0
      42: bipush        6
      44: aconst_null
      45: invokestatic  #38                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      48: checkcast     #18                 // class java/lang/Iterable
      51: iconst_1
      52: invokestatic  #42                 // Method kotlin/collections/CollectionsKt.drop:(Ljava/lang/Iterable;I)Ljava/util/List;
      55: checkcast     #18                 // class java/lang/Iterable
      58: astore_1
      59: iconst_0
      60: istore_2
      61: aload_1
      62: astore_3
      63: new           #44                 // class java/util/ArrayList
      66: dup
      67: aload_1
      68: bipush        10
      70: invokestatic  #48                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      73: invokespecial #52                 // Method java/util/ArrayList."<init>":(I)V
      76: checkcast     #54                 // class java/util/Collection
      79: astore        4
      81: iconst_0
      82: istore        5
      84: aload_3
      85: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      90: astore        6
      92: aload         6
      94: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      99: ifeq          149
     102: aload         6
     104: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     109: astore        7
     111: aload         4
     113: aload         7
     115: checkcast     #30                 // class java/lang/String
     118: astore        8
     120: astore        10
     122: iconst_0
     123: istore        9
     125: aload         8
     127: checkcast     #22                 // class java/lang/CharSequence
     130: invokestatic  #72                 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     133: invokevirtual #76                 // Method java/lang/Object.toString:()Ljava/lang/String;
     136: nop
     137: aload         10
     139: swap
     140: invokeinterface #80,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     145: pop
     146: goto          92
     149: aload         4
     151: checkcast     #82                 // class java/util/List
     154: nop
     155: areturn

  public static final void main();
    Code:
       0: ldc           #100                // String Day07_test
       2: invokestatic  #106                // Method UtilsKt.readBlocks:(Ljava/lang/String;)Ljava/util/List;
       5: invokestatic  #110                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
       8: checkcast     #82                 // class java/util/List
      11: astore_0
      12: aload_0
      13: invokestatic  #114                // Method main$part1:(Ljava/util/List;)I
      16: ldc           #115                // int 95437
      18: if_icmpne     25
      21: iconst_1
      22: goto          26
      25: iconst_0
      26: ifne          39
      29: new           #117                // class java/lang/IllegalStateException
      32: dup
      33: ldc           #119                // String Check failed.
      35: invokespecial #122                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      38: athrow
      39: aload_0
      40: invokestatic  #125                // Method main$part2:(Ljava/util/List;)I
      43: ldc           #126                // int 24933642
      45: if_icmpne     52
      48: iconst_1
      49: goto          53
      52: iconst_0
      53: ifne          66
      56: new           #117                // class java/lang/IllegalStateException
      59: dup
      60: ldc           #119                // String Check failed.
      62: invokespecial #122                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      65: athrow
      66: ldc           #128                // String Day07
      68: invokestatic  #106                // Method UtilsKt.readBlocks:(Ljava/lang/String;)Ljava/util/List;
      71: invokestatic  #110                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
      74: checkcast     #82                 // class java/util/List
      77: astore_1
      78: aload_1
      79: invokestatic  #114                // Method main$part1:(Ljava/util/List;)I
      82: istore_2
      83: getstatic     #134                // Field java/lang/System.out:Ljava/io/PrintStream;
      86: iload_2
      87: invokevirtual #139                // Method java/io/PrintStream.println:(I)V
      90: aload_1
      91: invokestatic  #125                // Method main$part2:(Ljava/util/List;)I
      94: istore_2
      95: getstatic     #134                // Field java/lang/System.out:Ljava/io/PrintStream;
      98: iload_2
      99: invokevirtual #139                // Method java/io/PrintStream.println:(I)V
     102: return

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

  private static final int main$part1$lambda$0(FS);
    Code:
       0: aload_0
       1: ldc           #149                // String it
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokevirtual #155                // Method FS.getSize:()I
      10: ireturn

  private static final int main$part1(java.util.List<java.lang.String>);
    Code:
       0: new           #151                // class FS
       3: dup
       4: ldc           #159                // String /
       6: aconst_null
       7: invokespecial #162                // Method FS."<init>":(Ljava/lang/String;LFS;)V
      10: aload_0
      11: invokestatic  #164                // Method getInstructions:(Ljava/util/List;)Ljava/util/List;
      14: invokevirtual #168                // Method FS.fill:(Ljava/util/List;)LFS;
      17: invokedynamic #186,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      22: invokevirtual #190                // Method FS.map:(Lkotlin/jvm/functions/Function1;)Ljava/util/List;
      25: checkcast     #18                 // class java/lang/Iterable
      28: astore_1
      29: iconst_0
      30: istore_2
      31: aload_1
      32: astore_3
      33: new           #44                 // class java/util/ArrayList
      36: dup
      37: invokespecial #192                // Method java/util/ArrayList."<init>":()V
      40: checkcast     #54                 // class java/util/Collection
      43: astore        4
      45: iconst_0
      46: istore        5
      48: aload_3
      49: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      54: astore        6
      56: aload         6
      58: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      63: ifeq          116
      66: aload         6
      68: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      73: astore        7
      75: aload         7
      77: checkcast     #194                // class java/lang/Number
      80: invokevirtual #197                // Method java/lang/Number.intValue:()I
      83: istore        8
      85: iconst_0
      86: istore        9
      88: iload         8
      90: ldc           #198                // int 100000
      92: if_icmpgt     99
      95: iconst_1
      96: goto          100
      99: iconst_0
     100: ifeq          56
     103: aload         4
     105: aload         7
     107: invokeinterface #80,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     112: pop
     113: goto          56
     116: aload         4
     118: checkcast     #82                 // class java/util/List
     121: nop
     122: checkcast     #18                 // class java/lang/Iterable
     125: invokestatic  #202                // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
     128: ireturn

  private static final int main$part2$lambda$2(FS);
    Code:
       0: aload_0
       1: ldc           #149                // String it
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokevirtual #155                // Method FS.getSize:()I
      10: ireturn

  private static final int main$part2(java.util.List<java.lang.String>);
    Code:
       0: new           #151                // class FS
       3: dup
       4: ldc           #159                // String /
       6: aconst_null
       7: invokespecial #162                // Method FS."<init>":(Ljava/lang/String;LFS;)V
      10: astore_1
      11: aload_1
      12: aload_0
      13: invokestatic  #164                // Method getInstructions:(Ljava/util/List;)Ljava/util/List;
      16: invokevirtual #168                // Method FS.fill:(Ljava/util/List;)LFS;
      19: pop
      20: aload_1
      21: invokedynamic #213,  0            // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function1;
      26: invokevirtual #190                // Method FS.map:(Lkotlin/jvm/functions/Function1;)Ljava/util/List;
      29: astore_2
      30: ldc           #214                // int 30000000
      32: ldc           #215                // int 70000000
      34: aload_2
      35: invokestatic  #110                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
      38: checkcast     #194                // class java/lang/Number
      41: invokevirtual #197                // Method java/lang/Number.intValue:()I
      44: isub
      45: isub
      46: istore_3
      47: aload_2
      48: checkcast     #18                 // class java/lang/Iterable
      51: astore        4
      53: iconst_0
      54: istore        5
      56: aload         4
      58: astore        6
      60: new           #44                 // class java/util/ArrayList
      63: dup
      64: invokespecial #192                // Method java/util/ArrayList."<init>":()V
      67: checkcast     #54                 // class java/util/Collection
      70: astore        7
      72: iconst_0
      73: istore        8
      75: aload         6
      77: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      82: astore        9
      84: aload         9
      86: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      91: ifeq          143
      94: aload         9
      96: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     101: astore        10
     103: aload         10
     105: checkcast     #194                // class java/lang/Number
     108: invokevirtual #197                // Method java/lang/Number.intValue:()I
     111: istore        11
     113: iconst_0
     114: istore        12
     116: iload         11
     118: iload_3
     119: if_icmplt     126
     122: iconst_1
     123: goto          127
     126: iconst_0
     127: ifeq          84
     130: aload         7
     132: aload         10
     134: invokeinterface #80,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     139: pop
     140: goto          84
     143: aload         7
     145: checkcast     #82                 // class java/util/List
     148: nop
     149: checkcast     #18                 // class java/lang/Iterable
     152: invokestatic  #219                // Method kotlin/collections/CollectionsKt.minOrThrow:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     155: checkcast     #194                // class java/lang/Number
     158: invokevirtual #197                // Method java/lang/Number.intValue:()I
     161: ireturn
}


private val DIVIDER_PACKETS = listOf("[[2]]", "[[6]]")

private sealed interface Signal : Comparable<Signal?> {
    override operator fun compareTo(signal: Signal?): Int
}

private data class SingleSignal(val element: Int) : Signal {
    fun toMultiSignal() = MultiSignal(listOf(this))

    override fun compareTo(signal: Signal?) = when (signal) {
        null -> 1
        is SingleSignal -> element.compareTo(signal.element)
        is MultiSignal -> toMultiSignal().compareTo(signal)
    }
}

private data class MultiSignal(val items: List<Signal>) : Signal {
    override fun compareTo(signal: Signal?): Int = when (signal) {
        null -> 1
        is SingleSignal -> compareTo(signal.toMultiSignal())
        is MultiSignal -> items.mapIndexed { i, e -> e.compareTo(signal.items.getOrNull(i)) }.firstOrNull { it != 0 }
            ?: items.size.compareTo(signal.items.size)
    }
}

private fun parseSignal(input: String): Signal {
    val res = mutableListOf<Signal>()

    var values = input.substring(1, input.length - 1)
    while (values.contains(',')) {
        val number = values.substringBefore(',').toIntOrNull()

        res += if (number != null) {
            SingleSignal(number)
        } else {
            val list = values.firstInnerList()
            parseSignal(list).also { values = values.substringAfter(list) }
        }

        values = values.substringAfter(',')
    }

    if (values.contains('[')) {
        res += parseSignal(values)
    } else if (values.isNotEmpty()) {
        res += SingleSignal(values.toInt())
    }

    return MultiSignal(res)
}

private fun String.firstInnerList(): String {
    var balance = 0
    for (i in indices) {
        when (get(i)) {
            '[' -> balance++
            ']' -> balance--
        }

        if (balance == 0) return substring(0, i + 1) // assuming given string starts with '['.
    }

    return this
}

fun main() {
    fun part1(input: List<List<String>>) =
        input.map { (first, second) -> parseSignal(first) to parseSignal(second) }.withIndex()
            .filter { (_, value) -> value.first < value.second }.sumOf { (i) -> i + 1 }

    fun part2(input: List<List<String>>): Int {
        val signals = input.flatten().toMutableList()
        signals.addAll(DIVIDER_PACKETS)

        val sortedSignals = signals.map(::parseSignal).sorted()

        return DIVIDER_PACKETS.map { sortedSignals.indexOf(parseSignal(it)) + 1 }.reduce(Int::times)
    }

    // test if implementation meets criteria from the description, like:
    val testInput = readBlocks("Day13_test")
    check(part1(testInput) == 13)
    check(part2(testInput) == 140)

    val input = readBlocks("Day13")
    println(part1(input))
    println(part2(input))
}

Compiled from "Day13.kt"
public final class Day13Kt {
  private static final java.util.List<java.lang.String> DIVIDER_PACKETS;

  private static final Signal parseSignal(java.lang.String);
    Code:
       0: new           #8                  // class java/util/ArrayList
       3: dup
       4: invokespecial #12                 // Method java/util/ArrayList."<init>":()V
       7: checkcast     #14                 // class java/util/List
      10: astore_1
      11: aconst_null
      12: astore_2
      13: aload_0
      14: iconst_1
      15: aload_0
      16: invokevirtual #20                 // Method java/lang/String.length:()I
      19: iconst_1
      20: isub
      21: invokevirtual #24                 // Method java/lang/String.substring:(II)Ljava/lang/String;
      24: dup
      25: ldc           #26                 // String substring(...)
      27: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      30: astore_2
      31: aload_2
      32: checkcast     #34                 // class java/lang/CharSequence
      35: bipush        44
      37: iconst_0
      38: iconst_2
      39: aconst_null
      40: invokestatic  #40                 // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;CZILjava/lang/Object;)Z
      43: ifeq          143
      46: aload_2
      47: bipush        44
      49: aconst_null
      50: iconst_2
      51: aconst_null
      52: invokestatic  #44                 // Method kotlin/text/StringsKt.substringBefore$default:(Ljava/lang/String;CLjava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
      55: invokestatic  #48                 // Method kotlin/text/StringsKt.toIntOrNull:(Ljava/lang/String;)Ljava/lang/Integer;
      58: astore_3
      59: aload_1
      60: checkcast     #50                 // class java/util/Collection
      63: astore        4
      65: aload_3
      66: ifnull        86
      69: new           #52                 // class SingleSignal
      72: dup
      73: aload_3
      74: invokevirtual #57                 // Method java/lang/Integer.intValue:()I
      77: invokespecial #60                 // Method SingleSignal."<init>":(I)V
      80: checkcast     #62                 // class Signal
      83: goto          118
      86: aload_2
      87: invokestatic  #66                 // Method firstInnerList:(Ljava/lang/String;)Ljava/lang/String;
      90: astore        5
      92: aload         5
      94: invokestatic  #68                 // Method parseSignal:(Ljava/lang/String;)LSignal;
      97: astore        6
      99: aload         6
     101: astore        7
     103: iconst_0
     104: istore        8
     106: aload_2
     107: aload         5
     109: aconst_null
     110: iconst_2
     111: aconst_null
     112: invokestatic  #72                 // Method kotlin/text/StringsKt.substringAfter$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
     115: astore_2
     116: aload         6
     118: astore        5
     120: aload         4
     122: aload         5
     124: invokeinterface #76,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     129: pop
     130: aload_2
     131: bipush        44
     133: aconst_null
     134: iconst_2
     135: aconst_null
     136: invokestatic  #78                 // Method kotlin/text/StringsKt.substringAfter$default:(Ljava/lang/String;CLjava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
     139: astore_2
     140: goto          31
     143: aload_2
     144: checkcast     #34                 // class java/lang/CharSequence
     147: bipush        91
     149: iconst_0
     150: iconst_2
     151: aconst_null
     152: invokestatic  #40                 // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;CZILjava/lang/Object;)Z
     155: ifeq          175
     158: aload_1
     159: checkcast     #50                 // class java/util/Collection
     162: aload_2
     163: invokestatic  #68                 // Method parseSignal:(Ljava/lang/String;)LSignal;
     166: invokeinterface #76,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     171: pop
     172: goto          216
     175: aload_2
     176: checkcast     #34                 // class java/lang/CharSequence
     179: invokeinterface #79,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     184: ifle          191
     187: iconst_1
     188: goto          192
     191: iconst_0
     192: ifeq          216
     195: aload_1
     196: checkcast     #50                 // class java/util/Collection
     199: new           #52                 // class SingleSignal
     202: dup
     203: aload_2
     204: invokestatic  #83                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     207: invokespecial #60                 // Method SingleSignal."<init>":(I)V
     210: invokeinterface #76,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     215: pop
     216: new           #85                 // class MultiSignal
     219: dup
     220: aload_1
     221: invokespecial #88                 // Method MultiSignal."<init>":(Ljava/util/List;)V
     224: checkcast     #62                 // class Signal
     227: areturn

  private static final java.lang.String firstInnerList(java.lang.String);
    Code:
       0: iconst_0
       1: istore_1
       2: iconst_0
       3: istore_2
       4: aload_0
       5: checkcast     #34                 // class java/lang/CharSequence
       8: invokeinterface #79,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      13: istore_3
      14: iload_2
      15: iload_3
      16: if_icmpge     86
      19: aload_0
      20: iload_2
      21: invokevirtual #105                // Method java/lang/String.charAt:(I)C
      24: tableswitch   { // 91 to 93
                    91: 52
                    92: 61
                    93: 58
               default: 61
          }
      52: iinc          1, 1
      55: goto          61
      58: iinc          1, -1
      61: iload_1
      62: ifne          80
      65: aload_0
      66: iconst_0
      67: iload_2
      68: iconst_1
      69: iadd
      70: invokevirtual #24                 // Method java/lang/String.substring:(II)Ljava/lang/String;
      73: dup
      74: ldc           #26                 // String substring(...)
      76: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      79: areturn
      80: iinc          2, 1
      83: goto          14
      86: aload_0
      87: areturn

  public static final void main();
    Code:
       0: ldc           #111                // String Day13_test
       2: invokestatic  #117                // Method UtilsKt.readBlocks:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: aload_0
       7: invokestatic  #121                // Method main$part1:(Ljava/util/List;)I
      10: bipush        13
      12: if_icmpne     19
      15: iconst_1
      16: goto          20
      19: iconst_0
      20: ifne          33
      23: new           #123                // class java/lang/IllegalStateException
      26: dup
      27: ldc           #125                // String Check failed.
      29: invokespecial #128                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      32: athrow
      33: aload_0
      34: invokestatic  #131                // Method main$part2:(Ljava/util/List;)I
      37: sipush        140
      40: if_icmpne     47
      43: iconst_1
      44: goto          48
      47: iconst_0
      48: ifne          61
      51: new           #123                // class java/lang/IllegalStateException
      54: dup
      55: ldc           #125                // String Check failed.
      57: invokespecial #128                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      60: athrow
      61: ldc           #133                // String Day13
      63: invokestatic  #117                // Method UtilsKt.readBlocks:(Ljava/lang/String;)Ljava/util/List;
      66: astore_1
      67: aload_1
      68: invokestatic  #121                // Method main$part1:(Ljava/util/List;)I
      71: istore_2
      72: getstatic     #139                // Field java/lang/System.out:Ljava/io/PrintStream;
      75: iload_2
      76: invokevirtual #144                // Method java/io/PrintStream.println:(I)V
      79: aload_1
      80: invokestatic  #131                // Method main$part2:(Ljava/util/List;)I
      83: istore_2
      84: getstatic     #139                // Field java/lang/System.out:Ljava/io/PrintStream;
      87: iload_2
      88: invokevirtual #144                // Method java/io/PrintStream.println:(I)V
      91: return

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

  private static final int main$part1(java.util.List<? extends java.util.List<java.lang.String>>);
    Code:
       0: aload_0
       1: checkcast     #153                // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: astore_3
       9: new           #8                  // class java/util/ArrayList
      12: dup
      13: aload_1
      14: bipush        10
      16: invokestatic  #159                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      19: invokespecial #160                // Method java/util/ArrayList."<init>":(I)V
      22: checkcast     #50                 // class java/util/Collection
      25: astore        4
      27: iconst_0
      28: istore        5
      30: aload_3
      31: invokeinterface #164,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      36: astore        6
      38: aload         6
      40: invokeinterface #170,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      45: ifeq          122
      48: aload         6
      50: invokeinterface #174,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      55: astore        7
      57: aload         4
      59: aload         7
      61: checkcast     #14                 // class java/util/List
      64: astore        8
      66: astore        12
      68: iconst_0
      69: istore        9
      71: aload         8
      73: iconst_0
      74: invokeinterface #178,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      79: checkcast     #16                 // class java/lang/String
      82: astore        10
      84: aload         8
      86: iconst_1
      87: invokeinterface #178,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      92: checkcast     #16                 // class java/lang/String
      95: astore        11
      97: aload         10
      99: invokestatic  #68                 // Method parseSignal:(Ljava/lang/String;)LSignal;
     102: aload         11
     104: invokestatic  #68                 // Method parseSignal:(Ljava/lang/String;)LSignal;
     107: invokestatic  #184                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     110: aload         12
     112: swap
     113: invokeinterface #76,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     118: pop
     119: goto          38
     122: aload         4
     124: checkcast     #14                 // class java/util/List
     127: nop
     128: checkcast     #153                // class java/lang/Iterable
     131: invokestatic  #188                // Method kotlin/collections/CollectionsKt.withIndex:(Ljava/lang/Iterable;)Ljava/lang/Iterable;
     134: astore_1
     135: nop
     136: iconst_0
     137: istore_2
     138: aload_1
     139: astore_3
     140: new           #8                  // class java/util/ArrayList
     143: dup
     144: invokespecial #12                 // Method java/util/ArrayList."<init>":()V
     147: checkcast     #50                 // class java/util/Collection
     150: astore        4
     152: iconst_0
     153: istore        5
     155: aload_3
     156: invokeinterface #164,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     161: astore        6
     163: aload         6
     165: invokeinterface #170,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     170: ifeq          247
     173: aload         6
     175: invokeinterface #174,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     180: astore        7
     182: aload         7
     184: checkcast     #190                // class kotlin/collections/IndexedValue
     187: astore        8
     189: iconst_0
     190: istore        9
     192: aload         8
     194: invokevirtual #193                // Method kotlin/collections/IndexedValue.component2:()Ljava/lang/Object;
     197: checkcast     #195                // class kotlin/Pair
     200: astore        10
     202: aload         10
     204: invokevirtual #198                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     207: checkcast     #62                 // class Signal
     210: aload         10
     212: invokevirtual #201                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     215: checkcast     #62                 // class Signal
     218: invokeinterface #205,  2          // InterfaceMethod Signal.compareTo:(LSignal;)I
     223: ifge          230
     226: iconst_1
     227: goto          231
     230: iconst_0
     231: ifeq          163
     234: aload         4
     236: aload         7
     238: invokeinterface #76,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     243: pop
     244: goto          163
     247: aload         4
     249: checkcast     #14                 // class java/util/List
     252: nop
     253: checkcast     #153                // class java/lang/Iterable
     256: astore_1
     257: iconst_0
     258: istore_2
     259: aload_1
     260: invokeinterface #164,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     265: astore_3
     266: aload_3
     267: invokeinterface #170,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     272: ifeq          318
     275: aload_3
     276: invokeinterface #174,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     281: astore        4
     283: iload_2
     284: aload         4
     286: checkcast     #190                // class kotlin/collections/IndexedValue
     289: astore        5
     291: istore        12
     293: iconst_0
     294: istore        6
     296: aload         5
     298: invokevirtual #208                // Method kotlin/collections/IndexedValue.component1:()I
     301: istore        7
     303: iload         7
     305: iconst_1
     306: iadd
     307: istore        13
     309: iload         12
     311: iload         13
     313: iadd
     314: istore_2
     315: goto          266
     318: iload_2
     319: ireturn

  private static final int main$part2(java.util.List<? extends java.util.List<java.lang.String>>);
    Code:
       0: aload_0
       1: checkcast     #153                // class java/lang/Iterable
       4: invokestatic  #232                // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;
       7: checkcast     #50                 // class java/util/Collection
      10: invokestatic  #236                // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;
      13: astore_1
      14: aload_1
      15: getstatic     #239                // Field DIVIDER_PACKETS:Ljava/util/List;
      18: checkcast     #50                 // class java/util/Collection
      21: invokeinterface #243,  2          // InterfaceMethod java/util/List.addAll:(Ljava/util/Collection;)Z
      26: pop
      27: aload_1
      28: checkcast     #153                // class java/lang/Iterable
      31: astore_3
      32: iconst_0
      33: istore        4
      35: aload_3
      36: astore        5
      38: new           #8                  // class java/util/ArrayList
      41: dup
      42: aload_3
      43: bipush        10
      45: invokestatic  #159                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      48: invokespecial #160                // Method java/util/ArrayList."<init>":(I)V
      51: checkcast     #50                 // class java/util/Collection
      54: astore        6
      56: iconst_0
      57: istore        7
      59: aload         5
      61: invokeinterface #164,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      66: astore        8
      68: aload         8
      70: invokeinterface #170,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      75: ifeq          118
      78: aload         8
      80: invokeinterface #174,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      85: astore        9
      87: aload         6
      89: aload         9
      91: checkcast     #16                 // class java/lang/String
      94: astore        10
      96: astore        12
      98: iconst_0
      99: istore        11
     101: aload         10
     103: invokestatic  #68                 // Method parseSignal:(Ljava/lang/String;)LSignal;
     106: aload         12
     108: swap
     109: invokeinterface #76,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     114: pop
     115: goto          68
     118: aload         6
     120: checkcast     #14                 // class java/util/List
     123: nop
     124: checkcast     #153                // class java/lang/Iterable
     127: invokestatic  #246                // Method kotlin/collections/CollectionsKt.sorted:(Ljava/lang/Iterable;)Ljava/util/List;
     130: astore_2
     131: getstatic     #239                // Field DIVIDER_PACKETS:Ljava/util/List;
     134: checkcast     #153                // class java/lang/Iterable
     137: astore_3
     138: iconst_0
     139: istore        4
     141: aload_3
     142: astore        5
     144: new           #8                  // class java/util/ArrayList
     147: dup
     148: aload_3
     149: bipush        10
     151: invokestatic  #159                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     154: invokespecial #160                // Method java/util/ArrayList."<init>":(I)V
     157: checkcast     #50                 // class java/util/Collection
     160: astore        6
     162: iconst_0
     163: istore        7
     165: aload         5
     167: invokeinterface #164,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     172: astore        8
     174: aload         8
     176: invokeinterface #170,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     181: ifeq          235
     184: aload         8
     186: invokeinterface #174,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     191: astore        9
     193: aload         6
     195: aload         9
     197: checkcast     #16                 // class java/lang/String
     200: astore        10
     202: astore        12
     204: iconst_0
     205: istore        11
     207: aload_2
     208: aload         10
     210: invokestatic  #68                 // Method parseSignal:(Ljava/lang/String;)LSignal;
     213: invokeinterface #250,  2          // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I
     218: iconst_1
     219: iadd
     220: invokestatic  #254                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     223: aload         12
     225: swap
     226: invokeinterface #76,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     231: pop
     232: goto          174
     235: aload         6
     237: checkcast     #14                 // class java/util/List
     240: nop
     241: checkcast     #153                // class java/lang/Iterable
     244: astore_3
     245: nop
     246: iconst_0
     247: istore        4
     249: aload_3
     250: invokeinterface #164,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     255: astore        5
     257: aload         5
     259: invokeinterface #170,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     264: ifne          278
     267: new           #256                // class java/lang/UnsupportedOperationException
     270: dup
     271: ldc_w         #258                // String Empty collection can\'t be reduced.
     274: invokespecial #259                // Method java/lang/UnsupportedOperationException."<init>":(Ljava/lang/String;)V
     277: athrow
     278: aload         5
     280: invokeinterface #174,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     285: astore        6
     287: aload         5
     289: invokeinterface #170,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     294: ifeq          338
     297: aload         6
     299: aload         5
     301: invokeinterface #174,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     306: checkcast     #261                // class java/lang/Number
     309: invokevirtual #262                // Method java/lang/Number.intValue:()I
     312: istore        7
     314: checkcast     #261                // class java/lang/Number
     317: invokevirtual #262                // Method java/lang/Number.intValue:()I
     320: istore        8
     322: iconst_0
     323: istore        9
     325: iload         8
     327: iload         7
     329: imul
     330: invokestatic  #254                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     333: astore        6
     335: goto          287
     338: aload         6
     340: checkcast     #261                // class java/lang/Number
     343: invokevirtual #262                // Method java/lang/Number.intValue:()I
     346: ireturn

  static {};
    Code:
       0: iconst_2
       1: anewarray     #16                 // class java/lang/String
       4: astore_0
       5: aload_0
       6: iconst_0
       7: ldc_w         #277                // String [[2]]
      10: aastore
      11: aload_0
      12: iconst_1
      13: ldc_w         #279                // String [[6]]
      16: aastore
      17: aload_0
      18: invokestatic  #283                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      21: putstatic     #239                // Field DIVIDER_PACKETS:Ljava/util/List;
      24: return
}


private fun compartments(input: List<String>) = input.map { it.trim().chunked(it.length / 2) }
private fun groups(input: List<String>) = input.windowed(3, 3)

private fun List<List<String>>.intersect() = flatMap { it.map(String::toSet).reduce(Set<Char>::intersect) }
private fun Char.toPriority() = if (isLowerCase()) this - 'a' + 1 else this - 'A' + 27

fun main() {
    fun part1(input: List<String>) = compartments(input).intersect().sumOf { it.toPriority() }

    fun part2(input: List<String>) = groups(input).intersect().sumOf { it.toPriority() }

    // test if implementation meets criteria from the description, like:
    val testInput = readInput("Day03_test")
    check(part1(testInput) == 157)
    check(part2(testInput) == 70)

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

Compiled from "Day03.kt"
public final class Day03Kt {
  private static final java.util.List<java.util.List<java.lang.String>> compartments(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #9                  // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: astore_3
       9: new           #11                 // class java/util/ArrayList
      12: dup
      13: aload_1
      14: bipush        10
      16: invokestatic  #17                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      19: invokespecial #21                 // Method java/util/ArrayList."<init>":(I)V
      22: checkcast     #23                 // class java/util/Collection
      25: astore        4
      27: iconst_0
      28: istore        5
      30: aload_3
      31: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      36: astore        6
      38: aload         6
      40: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      45: ifeq          107
      48: aload         6
      50: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      55: astore        7
      57: aload         4
      59: aload         7
      61: checkcast     #39                 // class java/lang/String
      64: astore        8
      66: astore        10
      68: iconst_0
      69: istore        9
      71: aload         8
      73: checkcast     #41                 // class java/lang/CharSequence
      76: invokestatic  #47                 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
      79: invokevirtual #51                 // Method java/lang/Object.toString:()Ljava/lang/String;
      82: checkcast     #41                 // class java/lang/CharSequence
      85: aload         8
      87: invokevirtual #55                 // Method java/lang/String.length:()I
      90: iconst_2
      91: idiv
      92: invokestatic  #59                 // Method kotlin/text/StringsKt.chunked:(Ljava/lang/CharSequence;I)Ljava/util/List;
      95: aload         10
      97: swap
      98: invokeinterface #63,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     103: pop
     104: goto          38
     107: aload         4
     109: checkcast     #65                 // class java/util/List
     112: nop
     113: areturn

  private static final java.util.List<java.util.List<java.lang.String>> groups(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #9                  // class java/lang/Iterable
       4: iconst_3
       5: iconst_3
       6: iconst_0
       7: iconst_4
       8: aconst_null
       9: invokestatic  #85                 // Method kotlin/collections/CollectionsKt.windowed$default:(Ljava/lang/Iterable;IIZILjava/lang/Object;)Ljava/util/List;
      12: areturn

  private static final java.util.List<java.lang.Character> intersect(java.util.List<? extends java.util.List<java.lang.String>>);
    Code:
       0: aload_0
       1: checkcast     #9                  // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: astore_3
       9: new           #11                 // class java/util/ArrayList
      12: dup
      13: invokespecial #90                 // Method java/util/ArrayList."<init>":()V
      16: checkcast     #23                 // class java/util/Collection
      19: astore        4
      21: iconst_0
      22: istore        5
      24: aload_3
      25: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      30: astore        6
      32: aload         6
      34: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      39: ifeq          278
      42: aload         6
      44: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      49: astore        7
      51: aload         7
      53: checkcast     #65                 // class java/util/List
      56: astore        8
      58: iconst_0
      59: istore        9
      61: aload         8
      63: checkcast     #9                  // class java/lang/Iterable
      66: astore        10
      68: iconst_0
      69: istore        11
      71: aload         10
      73: astore        12
      75: new           #11                 // class java/util/ArrayList
      78: dup
      79: aload         10
      81: bipush        10
      83: invokestatic  #17                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      86: invokespecial #21                 // Method java/util/ArrayList."<init>":(I)V
      89: checkcast     #23                 // class java/util/Collection
      92: astore        13
      94: iconst_0
      95: istore        14
      97: aload         12
      99: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     104: astore        15
     106: aload         15
     108: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     113: ifeq          159
     116: aload         15
     118: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     123: astore        16
     125: aload         13
     127: aload         16
     129: checkcast     #39                 // class java/lang/String
     132: astore        17
     134: astore        18
     136: iconst_0
     137: istore        19
     139: aload         17
     141: checkcast     #41                 // class java/lang/CharSequence
     144: invokestatic  #94                 // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;
     147: aload         18
     149: swap
     150: invokeinterface #63,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     155: pop
     156: goto          106
     159: aload         13
     161: checkcast     #65                 // class java/util/List
     164: nop
     165: checkcast     #9                  // class java/lang/Iterable
     168: astore        10
     170: nop
     171: iconst_0
     172: istore        11
     174: aload         10
     176: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     181: astore        12
     183: aload         12
     185: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     190: ifne          203
     193: new           #96                 // class java/lang/UnsupportedOperationException
     196: dup
     197: ldc           #98                 // String Empty collection can\'t be reduced.
     199: invokespecial #101                // Method java/lang/UnsupportedOperationException."<init>":(Ljava/lang/String;)V
     202: athrow
     203: aload         12
     205: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     210: astore        13
     212: aload         12
     214: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     219: ifeq          259
     222: aload         13
     224: aload         12
     226: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     231: checkcast     #9                  // class java/lang/Iterable
     234: astore        14
     236: checkcast     #103                // class java/util/Set
     239: astore        15
     241: iconst_0
     242: istore        16
     244: aload         15
     246: checkcast     #9                  // class java/lang/Iterable
     249: aload         14
     251: invokestatic  #106                // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
     254: astore        13
     256: goto          212
     259: aload         13
     261: checkcast     #9                  // class java/lang/Iterable
     264: nop
     265: astore        8
     267: aload         4
     269: aload         8
     271: invokestatic  #110                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     274: pop
     275: goto          32
     278: aload         4
     280: checkcast     #65                 // class java/util/List
     283: nop
     284: areturn

  private static final int toPriority(char);
    Code:
       0: iload_0
       1: invokestatic  #136                // Method java/lang/Character.isLowerCase:(C)Z
       4: ifeq          16
       7: iload_0
       8: bipush        97
      10: isub
      11: iconst_1
      12: iadd
      13: goto          23
      16: iload_0
      17: bipush        65
      19: isub
      20: bipush        27
      22: iadd
      23: ireturn

  public static final void main();
    Code:
       0: ldc           #141                // String Day03_test
       2: invokestatic  #147                // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: aload_0
       7: invokestatic  #151                // Method main$part1:(Ljava/util/List;)I
      10: sipush        157
      13: if_icmpne     20
      16: iconst_1
      17: goto          21
      20: iconst_0
      21: ifne          34
      24: new           #153                // class java/lang/IllegalStateException
      27: dup
      28: ldc           #155                // String Check failed.
      30: invokespecial #156                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      33: athrow
      34: aload_0
      35: invokestatic  #159                // Method main$part2:(Ljava/util/List;)I
      38: bipush        70
      40: if_icmpne     47
      43: iconst_1
      44: goto          48
      47: iconst_0
      48: ifne          61
      51: new           #153                // class java/lang/IllegalStateException
      54: dup
      55: ldc           #155                // String Check failed.
      57: invokespecial #156                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      60: athrow
      61: ldc           #161                // String Day03
      63: invokestatic  #147                // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
      66: astore_1
      67: aload_1
      68: invokestatic  #151                // Method main$part1:(Ljava/util/List;)I
      71: istore_2
      72: getstatic     #167                // Field java/lang/System.out:Ljava/io/PrintStream;
      75: iload_2
      76: invokevirtual #172                // Method java/io/PrintStream.println:(I)V
      79: aload_1
      80: invokestatic  #159                // Method main$part2:(Ljava/util/List;)I
      83: istore_2
      84: getstatic     #167                // Field java/lang/System.out:Ljava/io/PrintStream;
      87: iload_2
      88: invokevirtual #172                // Method java/io/PrintStream.println:(I)V
      91: return

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

  private static final int main$part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #181                // Method compartments:(Ljava/util/List;)Ljava/util/List;
       4: invokestatic  #183                // Method intersect:(Ljava/util/List;)Ljava/util/List;
       7: checkcast     #9                  // class java/lang/Iterable
      10: astore_1
      11: iconst_0
      12: istore_2
      13: aload_1
      14: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      19: astore_3
      20: aload_3
      21: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      26: ifeq          69
      29: aload_3
      30: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      35: astore        4
      37: iload_2
      38: aload         4
      40: checkcast     #132                // class java/lang/Character
      43: invokevirtual #187                // Method java/lang/Character.charValue:()C
      46: istore        5
      48: istore        7
      50: iconst_0
      51: istore        6
      53: iload         5
      55: invokestatic  #189                // Method toPriority:(C)I
      58: istore        8
      60: iload         7
      62: iload         8
      64: iadd
      65: istore_2
      66: goto          20
      69: iload_2
      70: ireturn

  private static final int main$part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #192                // Method groups:(Ljava/util/List;)Ljava/util/List;
       4: invokestatic  #183                // Method intersect:(Ljava/util/List;)Ljava/util/List;
       7: checkcast     #9                  // class java/lang/Iterable
      10: astore_1
      11: iconst_0
      12: istore_2
      13: aload_1
      14: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      19: astore_3
      20: aload_3
      21: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      26: ifeq          69
      29: aload_3
      30: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      35: astore        4
      37: iload_2
      38: aload         4
      40: checkcast     #132                // class java/lang/Character
      43: invokevirtual #187                // Method java/lang/Character.charValue:()C
      46: istore        5
      48: istore        7
      50: iconst_0
      51: istore        6
      53: iload         5
      55: invokestatic  #189                // Method toPriority:(C)I
      58: istore        8
      60: iload         7
      62: iload         8
      64: iadd
      65: istore_2
      66: goto          20
      69: iload_2
      70: ireturn
}