/*
 * Copyright 2023 <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

private const val INPUT =
    """
    """

private data class Card(
    val id: Int,
    val winning: List<Int>,
    val given: List<Int>
)

private val lines =
    INPUT.lines()
        .map { it.trim() }
        .filter { it.isNotEmpty() }

fun day4() {
    println("Running AoC Day 4 (1st part)...")
    firstPart()

    println()

    println("Running AoC Day 4 (2nd part)...")
    secondPart()
}

private fun firstPart() {
    val res = lines.parseCards()
        .sumOf {
            it.points()
        }

    println("res: $res")
}

private fun secondPart() {
    val res = lines
        .parseCards()
        .populate()
        .count()

    println("res: $res")
}

private fun List<String>.parseCards() =
    map {
        it.parseCard()
    }

private fun String.parseCard(): Card {
    val cardId = extractCardId()
    val winning = extractWinningNumbers()
    val given = extractGivenNumbers()

    return Card(cardId, winning, given)
}

private fun Card.points(): Int {
    var points = 0

    given.forEach {
        if (it in winning) {
            if (points == 0) {
                points = 1
            } else {
                points *= 2
            }
        }
    }

    return points
}

private fun List<Card>.populate(): List<Card> {
    val copies = associate {
        it to mutableListOf<Card>()
    }.toMutableMap()

    forEachIndexed { index, card ->
        val count = card.count()

        (1..count).forEach { currentCount ->
            val cardToCopy = getOrNull(index + currentCount) ?: return@forEach
            val currentCardCopies = copies[card] ?: return@forEach

            repeat(currentCardCopies.size + 1) {
                copies[cardToCopy]?.add(cardToCopy)
            }
        }
    }

    val cards =
        copies.flatMap { (card, copies) ->
            listOf(card, *copies.toTypedArray())
        }

    return cards
}

private fun Card.count() =
    given.count {
        it in winning
    }

private fun String.extractCardId() =
    removePrefix(
        find("Card\\s+".toRegex())
    ).removeSuffix(
        find(":.*".toRegex())
    ).toInt()

private fun String.extractWinningNumbers() =
    extractNumbers().first

private fun String.extractGivenNumbers() =
    extractNumbers().second

private fun String.extractNumbers(): Pair<List<Int>, List<Int>> =
    extractNumbersString().let { numbersString ->
        "[\\d\\s]+".toRegex().findAll(numbersString).map { part ->
            part.value.trim().split("\\s+".toRegex()).map {
                it.toInt()
            }
        }.let {
            it.first() to it.last()
        }
    }

private fun String.extractNumbersString() =
    removePrefix(
        find("Card\\s+\\d+:\\s+".toRegex())
    )

private fun String.find(regex: Regex) =
    requireNotNull(
        regex.find(this)?.value
    )

Compiled from "Day4.kt"
public final class Day4Kt {
  private static final java.lang.String INPUT;

  private static final java.util.List<java.lang.String> lines;

  public static final void day4();
    Code:
       0: ldc           #8                  // String Running AoC Day 4 (1st part)...
       2: getstatic     #14                 // Field java/lang/System.out:Ljava/io/PrintStream;
       5: swap
       6: invokevirtual #20                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
       9: invokestatic  #23                 // Method firstPart:()V
      12: getstatic     #14                 // Field java/lang/System.out:Ljava/io/PrintStream;
      15: invokevirtual #25                 // Method java/io/PrintStream.println:()V
      18: ldc           #27                 // String Running AoC Day 4 (2nd part)...
      20: getstatic     #14                 // Field java/lang/System.out:Ljava/io/PrintStream;
      23: swap
      24: invokevirtual #20                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      27: invokestatic  #30                 // Method secondPart:()V
      30: return

  private static final void firstPart();
    Code:
       0: getstatic     #34                 // Field lines:Ljava/util/List;
       3: invokestatic  #38                 // Method parseCards:(Ljava/util/List;)Ljava/util/List;
       6: checkcast     #40                 // class java/lang/Iterable
       9: astore_1
      10: iconst_0
      11: istore_2
      12: aload_1
      13: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      18: astore_3
      19: aload_3
      20: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      25: ifeq          65
      28: aload_3
      29: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      34: astore        4
      36: iload_2
      37: aload         4
      39: checkcast     #56                 // class Card
      42: astore        5
      44: istore        7
      46: iconst_0
      47: istore        6
      49: aload         5
      51: invokestatic  #60                 // Method points:(LCard;)I
      54: istore        8
      56: iload         7
      58: iload         8
      60: iadd
      61: istore_2
      62: goto          19
      65: iload_2
      66: istore_0
      67: new           #62                 // class java/lang/StringBuilder
      70: dup
      71: invokespecial #65                 // Method java/lang/StringBuilder."<init>":()V
      74: ldc           #67                 // String res:
      76: invokevirtual #71                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      79: iload_0
      80: invokevirtual #74                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      83: invokevirtual #78                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      86: getstatic     #14                 // Field java/lang/System.out:Ljava/io/PrintStream;
      89: swap
      90: invokevirtual #20                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      93: return

  private static final void secondPart();
    Code:
       0: nop
       1: getstatic     #34                 // Field lines:Ljava/util/List;
       4: invokestatic  #38                 // Method parseCards:(Ljava/util/List;)Ljava/util/List;
       7: invokestatic  #86                 // Method populate:(Ljava/util/List;)Ljava/util/List;
      10: checkcast     #88                 // class java/util/Collection
      13: invokeinterface #92,  1           // InterfaceMethod java/util/Collection.size:()I
      18: istore_0
      19: new           #62                 // class java/lang/StringBuilder
      22: dup
      23: invokespecial #65                 // Method java/lang/StringBuilder."<init>":()V
      26: ldc           #67                 // String res:
      28: invokevirtual #71                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      31: iload_0
      32: invokevirtual #74                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      35: invokevirtual #78                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      38: getstatic     #14                 // Field java/lang/System.out:Ljava/io/PrintStream;
      41: swap
      42: invokevirtual #20                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      45: return

  private static final java.util.List<Card> parseCards(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #40                 // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: astore_3
       9: new           #95                 // class java/util/ArrayList
      12: dup
      13: aload_1
      14: bipush        10
      16: invokestatic  #101                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      19: invokespecial #104                // Method java/util/ArrayList."<init>":(I)V
      22: checkcast     #88                 // class java/util/Collection
      25: astore        4
      27: iconst_0
      28: istore        5
      30: aload_3
      31: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      36: astore        6
      38: aload         6
      40: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      45: ifeq          88
      48: aload         6
      50: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      55: astore        7
      57: aload         4
      59: aload         7
      61: checkcast     #106                // class java/lang/String
      64: astore        8
      66: astore        10
      68: iconst_0
      69: istore        9
      71: aload         8
      73: invokestatic  #110                // Method parseCard:(Ljava/lang/String;)LCard;
      76: aload         10
      78: swap
      79: invokeinterface #114,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      84: pop
      85: goto          38
      88: aload         4
      90: checkcast     #116                // class java/util/List
      93: nop
      94: areturn

  private static final Card parseCard(java.lang.String);
    Code:
       0: aload_0
       1: invokestatic  #132                // Method extractCardId:(Ljava/lang/String;)I
       4: istore_1
       5: aload_0
       6: invokestatic  #136                // Method extractWinningNumbers:(Ljava/lang/String;)Ljava/util/List;
       9: astore_2
      10: aload_0
      11: invokestatic  #139                // Method extractGivenNumbers:(Ljava/lang/String;)Ljava/util/List;
      14: astore_3
      15: new           #56                 // class Card
      18: dup
      19: iload_1
      20: aload_2
      21: aload_3
      22: invokespecial #142                // Method Card."<init>":(ILjava/util/List;Ljava/util/List;)V
      25: areturn

  private static final int points(Card);
    Code:
       0: iconst_0
       1: istore_1
       2: aload_0
       3: invokevirtual #150                // Method Card.getGiven:()Ljava/util/List;
       6: checkcast     #40                 // class java/lang/Iterable
       9: astore_2
      10: iconst_0
      11: istore_3
      12: aload_2
      13: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      18: astore        4
      20: aload         4
      22: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      27: ifeq          87
      30: aload         4
      32: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      37: astore        5
      39: aload         5
      41: checkcast     #152                // class java/lang/Number
      44: invokevirtual #155                // Method java/lang/Number.intValue:()I
      47: istore        6
      49: iconst_0
      50: istore        7
      52: aload_0
      53: invokevirtual #158                // Method Card.getWinning:()Ljava/util/List;
      56: iload         6
      58: invokestatic  #164                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      61: invokeinterface #167,  2          // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
      66: ifeq          82
      69: iload_1
      70: ifne          78
      73: iconst_1
      74: istore_1
      75: goto          82
      78: iload_1
      79: iconst_2
      80: imul
      81: istore_1
      82: nop
      83: nop
      84: goto          20
      87: nop
      88: iload_1
      89: ireturn

  private static final java.util.List<Card> populate(java.util.List<Card>);
    Code:
       0: aload_0
       1: checkcast     #40                 // class java/lang/Iterable
       4: astore_2
       5: iconst_0
       6: istore_3
       7: aload_2
       8: bipush        10
      10: invokestatic  #101                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      13: invokestatic  #179                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
      16: bipush        16
      18: invokestatic  #185                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
      21: istore        4
      23: aload_2
      24: astore        5
      26: new           #187                // class java/util/LinkedHashMap
      29: dup
      30: iload         4
      32: invokespecial #188                // Method java/util/LinkedHashMap."<init>":(I)V
      35: checkcast     #190                // class java/util/Map
      38: astore        6
      40: iconst_0
      41: istore        7
      43: aload         5
      45: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      50: astore        8
      52: aload         8
      54: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      59: ifeq          123
      62: aload         8
      64: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      69: astore        9
      71: aload         6
      73: astore        10
      75: aload         9
      77: checkcast     #56                 // class Card
      80: astore        11
      82: iconst_0
      83: istore        12
      85: aload         11
      87: new           #95                 // class java/util/ArrayList
      90: dup
      91: invokespecial #191                // Method java/util/ArrayList."<init>":()V
      94: checkcast     #116                // class java/util/List
      97: invokestatic  #197                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     100: astore        11
     102: aload         10
     104: aload         11
     106: invokevirtual #202                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     109: aload         11
     111: invokevirtual #205                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     114: invokeinterface #209,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     119: pop
     120: goto          52
     123: aload         6
     125: nop
     126: invokestatic  #213                // Method kotlin/collections/MapsKt.toMutableMap:(Ljava/util/Map;)Ljava/util/Map;
     129: astore_1
     130: aload_0
     131: checkcast     #40                 // class java/lang/Iterable
     134: astore_2
     135: iconst_0
     136: istore_3
     137: iconst_0
     138: istore        4
     140: aload_2
     141: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     146: astore        5
     148: aload         5
     150: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     155: ifeq          373
     158: aload         5
     160: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     165: astore        6
     167: iload         4
     169: iinc          4, 1
     172: istore        7
     174: iload         7
     176: ifge          182
     179: invokestatic  #216                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     182: iload         7
     184: aload         6
     186: checkcast     #56                 // class Card
     189: astore        8
     191: istore        9
     193: iconst_0
     194: istore        10
     196: aload         8
     198: invokestatic  #219                // Method count:(LCard;)I
     201: istore        11
     203: new           #221                // class kotlin/ranges/IntRange
     206: dup
     207: iconst_1
     208: iload         11
     210: invokespecial #224                // Method kotlin/ranges/IntRange."<init>":(II)V
     213: checkcast     #40                 // class java/lang/Iterable
     216: astore        12
     218: iconst_0
     219: istore        13
     221: aload         12
     223: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     228: astore        14
     230: aload         14
     232: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     237: ifeq          367
     240: aload         14
     242: checkcast     #226                // class kotlin/collections/IntIterator
     245: invokevirtual #229                // Method kotlin/collections/IntIterator.nextInt:()I
     248: istore        15
     250: iload         15
     252: istore        16
     254: iconst_0
     255: istore        17
     257: aload_0
     258: iload         9
     260: iload         16
     262: iadd
     263: invokestatic  #233                // Method kotlin/collections/CollectionsKt.getOrNull:(Ljava/util/List;I)Ljava/lang/Object;
     266: checkcast     #56                 // class Card
     269: dup
     270: ifnonnull     277
     273: pop
     274: goto          363
     277: astore        18
     279: aload_1
     280: aload         8
     282: invokeinterface #237,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     287: checkcast     #116                // class java/util/List
     290: dup
     291: ifnonnull     298
     294: pop
     295: goto          363
     298: astore        19
     300: aload         19
     302: invokeinterface #238,  1          // InterfaceMethod java/util/List.size:()I
     307: iconst_1
     308: iadd
     309: istore        20
     311: iconst_0
     312: istore        21
     314: iload         21
     316: iload         20
     318: if_icmpge     362
     321: iload         21
     323: istore        22
     325: iconst_0
     326: istore        23
     328: aload_1
     329: aload         18
     331: invokeinterface #237,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     336: checkcast     #116                // class java/util/List
     339: dup
     340: ifnull        354
     343: aload         18
     345: invokeinterface #239,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     350: pop
     351: goto          355
     354: pop
     355: nop
     356: iinc          21, 1
     359: goto          314
     362: nop
     363: nop
     364: goto          230
     367: nop
     368: nop
     369: nop
     370: goto          148
     373: nop
     374: aload_1
     375: astore_3
     376: iconst_0
     377: istore        4
     379: aload_3
     380: astore        5
     382: new           #95                 // class java/util/ArrayList
     385: dup
     386: invokespecial #191                // Method java/util/ArrayList."<init>":()V
     389: checkcast     #88                 // class java/util/Collection
     392: astore        6
     394: iconst_0
     395: istore        7
     397: aload         5
     399: invokeinterface #243,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     404: invokeinterface #246,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     409: astore        8
     411: aload         8
     413: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     418: ifeq          543
     421: aload         8
     423: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     428: checkcast     #248                // class java/util/Map$Entry
     431: astore        9
     433: aload         9
     435: astore        10
     437: iconst_0
     438: istore        11
     440: aload         10
     442: invokeinterface #251,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     447: checkcast     #56                 // class Card
     450: astore        12
     452: aload         10
     454: invokeinterface #254,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     459: checkcast     #116                // class java/util/List
     462: astore        13
     464: new           #256                // class kotlin/jvm/internal/SpreadBuilder
     467: dup
     468: iconst_2
     469: invokespecial #257                // Method kotlin/jvm/internal/SpreadBuilder."<init>":(I)V
     472: astore        14
     474: aload         14
     476: aload         12
     478: invokevirtual #259                // Method kotlin/jvm/internal/SpreadBuilder.add:(Ljava/lang/Object;)V
     481: aload         14
     483: aload         13
     485: checkcast     #88                 // class java/util/Collection
     488: astore        15
     490: iconst_0
     491: istore        16
     493: aload         15
     495: astore        17
     497: aload         17
     499: iconst_0
     500: anewarray     #56                 // class Card
     503: invokeinterface #263,  2          // InterfaceMethod java/util/Collection.toArray:([Ljava/lang/Object;)[Ljava/lang/Object;
     508: invokevirtual #266                // Method kotlin/jvm/internal/SpreadBuilder.addSpread:(Ljava/lang/Object;)V
     511: aload         14
     513: aload         14
     515: invokevirtual #267                // Method kotlin/jvm/internal/SpreadBuilder.size:()I
     518: anewarray     #56                 // class Card
     521: invokevirtual #268                // Method kotlin/jvm/internal/SpreadBuilder.toArray:([Ljava/lang/Object;)[Ljava/lang/Object;
     524: invokestatic  #272                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     527: checkcast     #40                 // class java/lang/Iterable
     530: astore        10
     532: aload         6
     534: aload         10
     536: invokestatic  #276                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     539: pop
     540: goto          411
     543: aload         6
     545: checkcast     #116                // class java/util/List
     548: nop
     549: astore_2
     550: aload_2
     551: areturn

  private static final int count(Card);
    Code:
       0: aload_0
       1: invokevirtual #150                // Method Card.getGiven:()Ljava/util/List;
       4: checkcast     #40                 // class java/lang/Iterable
       7: astore_1
       8: iconst_0
       9: istore_2
      10: aload_1
      11: instanceof    #88                 // class java/util/Collection
      14: ifeq          33
      17: aload_1
      18: checkcast     #88                 // class java/util/Collection
      21: invokeinterface #312,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      26: ifeq          33
      29: iconst_0
      30: goto          106
      33: iconst_0
      34: istore_3
      35: aload_1
      36: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      41: astore        4
      43: aload         4
      45: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      50: ifeq          105
      53: aload         4
      55: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      60: astore        5
      62: aload         5
      64: checkcast     #152                // class java/lang/Number
      67: invokevirtual #155                // Method java/lang/Number.intValue:()I
      70: istore        6
      72: iconst_0
      73: istore        7
      75: aload_0
      76: invokevirtual #158                // Method Card.getWinning:()Ljava/util/List;
      79: iload         6
      81: invokestatic  #164                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      84: invokeinterface #167,  2          // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
      89: ifeq          43
      92: iinc          3, 1
      95: iload_3
      96: ifge          43
      99: invokestatic  #315                // Method kotlin/collections/CollectionsKt.throwCountOverflow:()V
     102: goto          43
     105: iload_3
     106: ireturn

  private static final int extractCardId(java.lang.String);
    Code:
       0: nop
       1: aload_0
       2: aload_0
       3: new           #322                // class kotlin/text/Regex
       6: dup
       7: ldc_w         #324                // String Card\\s+
      10: invokespecial #327                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      13: invokestatic  #331                // Method find:(Ljava/lang/String;Lkotlin/text/Regex;)Ljava/lang/String;
      16: checkcast     #333                // class java/lang/CharSequence
      19: invokestatic  #339                // Method kotlin/text/StringsKt.removePrefix:(Ljava/lang/String;Ljava/lang/CharSequence;)Ljava/lang/String;
      22: aload_0
      23: new           #322                // class kotlin/text/Regex
      26: dup
      27: ldc_w         #341                // String :.*
      30: invokespecial #327                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      33: invokestatic  #331                // Method find:(Ljava/lang/String;Lkotlin/text/Regex;)Ljava/lang/String;
      36: checkcast     #333                // class java/lang/CharSequence
      39: invokestatic  #344                // Method kotlin/text/StringsKt.removeSuffix:(Ljava/lang/String;Ljava/lang/CharSequence;)Ljava/lang/String;
      42: invokestatic  #347                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      45: ireturn

  private static final java.util.List<java.lang.Integer> extractWinningNumbers(java.lang.String);
    Code:
       0: aload_0
       1: invokestatic  #353                // Method extractNumbers:(Ljava/lang/String;)Lkotlin/Pair;
       4: invokevirtual #202                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
       7: checkcast     #116                // class java/util/List
      10: areturn

  private static final java.util.List<java.lang.Integer> extractGivenNumbers(java.lang.String);
    Code:
       0: aload_0
       1: invokestatic  #353                // Method extractNumbers:(Ljava/lang/String;)Lkotlin/Pair;
       4: invokevirtual #205                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
       7: checkcast     #116                // class java/util/List
      10: areturn

  private static final kotlin.Pair<java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>> extractNumbers(java.lang.String);
    Code:
       0: aload_0
       1: invokestatic  #360                // Method extractNumbersString:(Ljava/lang/String;)Ljava/lang/String;
       4: astore_1
       5: iconst_0
       6: istore_2
       7: new           #322                // class kotlin/text/Regex
      10: dup
      11: ldc_w         #362                // String [\\d\\s]+
      14: invokespecial #327                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      17: aload_1
      18: checkcast     #333                // class java/lang/CharSequence
      21: iconst_0
      22: iconst_2
      23: aconst_null
      24: invokestatic  #366                // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;
      27: invokedynamic #384,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      32: invokestatic  #390                // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      35: astore_3
      36: iconst_0
      37: istore        4
      39: aload_3
      40: invokestatic  #394                // Method kotlin/sequences/SequencesKt.first:(Lkotlin/sequences/Sequence;)Ljava/lang/Object;
      43: aload_3
      44: invokestatic  #397                // Method kotlin/sequences/SequencesKt.last:(Lkotlin/sequences/Sequence;)Ljava/lang/Object;
      47: invokestatic  #197                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      50: nop
      51: nop
      52: nop
      53: areturn

  private static final java.lang.String extractNumbersString(java.lang.String);
    Code:
       0: aload_0
       1: aload_0
       2: new           #322                // class kotlin/text/Regex
       5: dup
       6: ldc_w         #404                // String Card\\s+\\d+:\\s+
       9: invokespecial #327                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      12: invokestatic  #331                // Method find:(Ljava/lang/String;Lkotlin/text/Regex;)Ljava/lang/String;
      15: checkcast     #333                // class java/lang/CharSequence
      18: invokestatic  #339                // Method kotlin/text/StringsKt.removePrefix:(Ljava/lang/String;Ljava/lang/CharSequence;)Ljava/lang/String;
      21: areturn

  private static final java.lang.String find(java.lang.String, kotlin.text.Regex);
    Code:
       0: aload_1
       1: aload_0
       2: checkcast     #333                // class java/lang/CharSequence
       5: iconst_0
       6: iconst_2
       7: aconst_null
       8: invokestatic  #409                // Method kotlin/text/Regex.find$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/text/MatchResult;
      11: dup
      12: ifnull        23
      15: invokeinterface #413,  1          // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;
      20: goto          25
      23: pop
      24: aconst_null
      25: dup
      26: ifnonnull     46
      29: pop
      30: ldc_w         #415                // String Required value was null.
      33: astore_2
      34: new           #417                // class java/lang/IllegalArgumentException
      37: dup
      38: aload_2
      39: invokevirtual #418                // Method java/lang/Object.toString:()Ljava/lang/String;
      42: invokespecial #419                // Method java/lang/IllegalArgumentException."<init>":(Ljava/lang/String;)V
      45: athrow
      46: areturn

  private static final java.util.List extractNumbers$lambda$14$lambda$12(kotlin.text.MatchResult);
    Code:
       0: aload_0
       1: ldc_w         #424                // String part
       4: invokestatic  #430                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: invokeinterface #413,  1          // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;
      13: checkcast     #333                // class java/lang/CharSequence
      16: invokestatic  #434                // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
      19: invokevirtual #418                // Method java/lang/Object.toString:()Ljava/lang/String;
      22: checkcast     #333                // class java/lang/CharSequence
      25: astore_1
      26: new           #322                // class kotlin/text/Regex
      29: dup
      30: ldc_w         #436                // String \\s+
      33: invokespecial #327                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      36: astore_2
      37: iconst_0
      38: istore_3
      39: aload_2
      40: aload_1
      41: iload_3
      42: invokevirtual #440                // Method kotlin/text/Regex.split:(Ljava/lang/CharSequence;I)Ljava/util/List;
      45: checkcast     #40                 // class java/lang/Iterable
      48: astore_1
      49: nop
      50: iconst_0
      51: istore_2
      52: aload_1
      53: astore_3
      54: new           #95                 // class java/util/ArrayList
      57: dup
      58: aload_1
      59: bipush        10
      61: invokestatic  #101                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      64: invokespecial #104                // Method java/util/ArrayList."<init>":(I)V
      67: checkcast     #88                 // class java/util/Collection
      70: astore        4
      72: iconst_0
      73: istore        5
      75: aload_3
      76: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      81: astore        6
      83: aload         6
      85: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      90: ifeq          137
      93: aload         6
      95: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     100: astore        7
     102: aload         4
     104: aload         7
     106: checkcast     #106                // class java/lang/String
     109: astore        8
     111: astore        10
     113: iconst_0
     114: istore        9
     116: aload         8
     118: invokestatic  #347                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     121: nop
     122: invokestatic  #164                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     125: aload         10
     127: swap
     128: invokeinterface #114,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     133: pop
     134: goto          83
     137: aload         4
     139: checkcast     #116                // class java/util/List
     142: nop
     143: areturn

  static {};
    Code:
       0: ldc_w         #445                // String \n
       3: checkcast     #333                // class java/lang/CharSequence
       6: invokestatic  #448                // Method kotlin/text/StringsKt.lines:(Ljava/lang/CharSequence;)Ljava/util/List;
       9: checkcast     #40                 // class java/lang/Iterable
      12: astore_0
      13: nop
      14: iconst_0
      15: istore_1
      16: aload_0
      17: astore_2
      18: new           #95                 // class java/util/ArrayList
      21: dup
      22: aload_0
      23: bipush        10
      25: invokestatic  #101                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      28: invokespecial #104                // Method java/util/ArrayList."<init>":(I)V
      31: checkcast     #88                 // class java/util/Collection
      34: astore_3
      35: iconst_0
      36: istore        4
      38: aload_2
      39: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      44: astore        5
      46: aload         5
      48: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      53: ifeq          102
      56: aload         5
      58: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      63: astore        6
      65: aload_3
      66: aload         6
      68: checkcast     #106                // class java/lang/String
      71: astore        7
      73: astore        9
      75: iconst_0
      76: istore        8
      78: aload         7
      80: checkcast     #333                // class java/lang/CharSequence
      83: invokestatic  #434                // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
      86: invokevirtual #418                // Method java/lang/Object.toString:()Ljava/lang/String;
      89: nop
      90: aload         9
      92: swap
      93: invokeinterface #114,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      98: pop
      99: goto          46
     102: aload_3
     103: checkcast     #116                // class java/util/List
     106: nop
     107: checkcast     #40                 // class java/lang/Iterable
     110: astore_0
     111: nop
     112: iconst_0
     113: istore_1
     114: aload_0
     115: astore_2
     116: new           #95                 // class java/util/ArrayList
     119: dup
     120: invokespecial #191                // Method java/util/ArrayList."<init>":()V
     123: checkcast     #88                 // class java/util/Collection
     126: astore_3
     127: iconst_0
     128: istore        4
     130: aload_2
     131: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     136: astore        5
     138: aload         5
     140: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     145: ifeq          201
     148: aload         5
     150: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     155: astore        6
     157: aload         6
     159: checkcast     #106                // class java/lang/String
     162: astore        7
     164: iconst_0
     165: istore        8
     167: aload         7
     169: checkcast     #333                // class java/lang/CharSequence
     172: invokeinterface #451,  1          // InterfaceMethod java/lang/CharSequence.length:()I
     177: ifle          184
     180: iconst_1
     181: goto          185
     184: iconst_0
     185: nop
     186: ifeq          138
     189: aload_3
     190: aload         6
     192: invokeinterface #114,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     197: pop
     198: goto          138
     201: aload_3
     202: checkcast     #116                // class java/util/List
     205: nop
     206: putstatic     #34                 // Field lines:Ljava/util/List;
     209: return
}


import java.io.File
import kotlin.math.abs

/**
 * Reads lines from the given input txt file.
 */
fun readInput(name: String) = File("src", "$name.txt")
    .readLines()

fun <T> List<T>.second() = this[1]
fun <T, R> Pair<T, R>.reverse() = second to first

data class Point(val x: Int, val y: Int) {
    fun neighbours(includeCenter: Boolean = false): List<Point> =
        if (includeCenter) listOf(Point(x, y + 1), Point(x + 1, y), this, Point(x, y - 1), Point(x - 1, y))
        else listOf(Point(x, y + 1), Point(x + 1, y), Point(x, y - 1), Point(x - 1, y))

    fun allNeighbours(): Set<Point> =
        setOf(
            Point(x - 1, y - 1),
            Point(x, y - 1),
            Point(x + 1, y - 1),
            Point(x - 1, y),
            Point(x + 1, y),
            Point(x - 1, y + 1),
            Point(x, y + 1),
            Point(x + 1, y + 1)
        )

    fun distanceTo(other: Point) = abs(x - other.x) + abs(y - other.y)
    operator fun plus(other: Point) = Point(x + other.x, y + other.y)
}

fun IntRange.fullyContains(other: IntRange) =
    contains(other.first) && contains(other.last)

fun IntRange.overlapsWith(other: IntRange) =
    contains(other.first) || contains(other.last)

fun IntRange.union(other: IntRange): IntRange? {
    return if (overlapsWith(other))
        IntRange(minOf(first, other.first), maxOf(last, other.last))
    else null
}

fun List<Int>.findPattern(startIndex: Int = 1): Pair<Int, Int> {
    (startIndex..size / 2).forEach { windowSize ->
        print("$windowSize\r")
        val tmp = this.windowed(windowSize)
        tmp.forEachIndexed { index, intList ->
            if (index + windowSize >= tmp.size)
                return@forEachIndexed
            if (intList == tmp[index + windowSize])
                return index + 1 to windowSize
        }
    }
    error("no pattern")
}

Compiled from "Utils.kt"
public final class UtilsKt {
  public static final java.util.List<java.lang.String> readInput(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #10                 // String name
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #18                 // class java/io/File
       9: dup
      10: ldc           #20                 // String src
      12: new           #22                 // class java/lang/StringBuilder
      15: dup
      16: invokespecial #26                 // Method java/lang/StringBuilder."<init>":()V
      19: aload_0
      20: invokevirtual #30                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      23: ldc           #32                 // String .txt
      25: invokevirtual #30                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      28: invokevirtual #36                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      31: invokespecial #39                 // Method java/io/File."<init>":(Ljava/lang/String;Ljava/lang/String;)V
      34: aconst_null
      35: iconst_1
      36: aconst_null
      37: invokestatic  #45                 // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;
      40: areturn

  public static final <T> T second(java.util.List<? extends T>);
    Code:
       0: aload_0
       1: ldc           #51                 // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: iconst_1
       8: invokeinterface #57,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      13: areturn

  public static final <T, R> kotlin.Pair<R, T> reverse(kotlin.Pair<? extends T, ? extends R>);
    Code:
       0: aload_0
       1: ldc           #51                 // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokevirtual #68                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      10: aload_0
      11: invokevirtual #71                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      14: invokestatic  #77                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      17: areturn

  public static final boolean fullyContains(kotlin.ranges.IntRange, kotlin.ranges.IntRange);
    Code:
       0: aload_0
       1: ldc           #51                 // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #83                 // String other
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: aload_1
      14: invokevirtual #88                 // Method kotlin/ranges/IntRange.getFirst:()I
      17: invokevirtual #92                 // Method kotlin/ranges/IntRange.contains:(I)Z
      20: ifeq          38
      23: aload_0
      24: aload_1
      25: invokevirtual #95                 // Method kotlin/ranges/IntRange.getLast:()I
      28: invokevirtual #92                 // Method kotlin/ranges/IntRange.contains:(I)Z
      31: ifeq          38
      34: iconst_1
      35: goto          39
      38: iconst_0
      39: ireturn

  public static final boolean overlapsWith(kotlin.ranges.IntRange, kotlin.ranges.IntRange);
    Code:
       0: aload_0
       1: ldc           #51                 // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #83                 // String other
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: aload_1
      14: invokevirtual #88                 // Method kotlin/ranges/IntRange.getFirst:()I
      17: invokevirtual #92                 // Method kotlin/ranges/IntRange.contains:(I)Z
      20: ifne          34
      23: aload_0
      24: aload_1
      25: invokevirtual #95                 // Method kotlin/ranges/IntRange.getLast:()I
      28: invokevirtual #92                 // Method kotlin/ranges/IntRange.contains:(I)Z
      31: ifeq          38
      34: iconst_1
      35: goto          39
      38: iconst_0
      39: ireturn

  public static final kotlin.ranges.IntRange union(kotlin.ranges.IntRange, kotlin.ranges.IntRange);
    Code:
       0: aload_0
       1: ldc           #51                 // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #83                 // String other
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: aload_1
      14: invokestatic  #104                // Method overlapsWith:(Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;)Z
      17: ifeq          52
      20: new           #85                 // class kotlin/ranges/IntRange
      23: dup
      24: aload_0
      25: invokevirtual #88                 // Method kotlin/ranges/IntRange.getFirst:()I
      28: aload_1
      29: invokevirtual #88                 // Method kotlin/ranges/IntRange.getFirst:()I
      32: invokestatic  #110                // Method java/lang/Math.min:(II)I
      35: aload_0
      36: invokevirtual #95                 // Method kotlin/ranges/IntRange.getLast:()I
      39: aload_1
      40: invokevirtual #95                 // Method kotlin/ranges/IntRange.getLast:()I
      43: invokestatic  #113                // Method java/lang/Math.max:(II)I
      46: invokespecial #116                // Method kotlin/ranges/IntRange."<init>":(II)V
      49: goto          53
      52: aconst_null
      53: areturn

  public static final kotlin.Pair<java.lang.Integer, java.lang.Integer> findPattern(java.util.List<java.lang.Integer>, int);
    Code:
       0: aload_0
       1: ldc           #51                 // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #85                 // class kotlin/ranges/IntRange
       9: dup
      10: iload_1
      11: aload_0
      12: invokeinterface #123,  1          // InterfaceMethod java/util/List.size:()I
      17: iconst_2
      18: idiv
      19: invokespecial #116                // Method kotlin/ranges/IntRange."<init>":(II)V
      22: checkcast     #125                // class java/lang/Iterable
      25: astore_2
      26: iconst_0
      27: istore_3
      28: aload_2
      29: invokeinterface #129,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      34: astore        4
      36: aload         4
      38: invokeinterface #135,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      43: ifeq          241
      46: aload         4
      48: checkcast     #137                // class kotlin/collections/IntIterator
      51: invokevirtual #140                // Method kotlin/collections/IntIterator.nextInt:()I
      54: istore        5
      56: iload         5
      58: istore        6
      60: iconst_0
      61: istore        7
      63: new           #22                 // class java/lang/StringBuilder
      66: dup
      67: invokespecial #26                 // Method java/lang/StringBuilder."<init>":()V
      70: iload         6
      72: invokevirtual #143                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      75: bipush        13
      77: invokevirtual #146                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      80: invokevirtual #36                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      83: getstatic     #152                // Field java/lang/System.out:Ljava/io/PrintStream;
      86: swap
      87: invokevirtual #158                // Method java/io/PrintStream.print:(Ljava/lang/Object;)V
      90: aload_0
      91: checkcast     #125                // class java/lang/Iterable
      94: iload         6
      96: iconst_0
      97: iconst_0
      98: bipush        6
     100: aconst_null
     101: invokestatic  #164                // Method kotlin/collections/CollectionsKt.windowed$default:(Ljava/lang/Iterable;IIZILjava/lang/Object;)Ljava/util/List;
     104: astore        8
     106: aload         8
     108: checkcast     #125                // class java/lang/Iterable
     111: astore        9
     113: iconst_0
     114: istore        10
     116: iconst_0
     117: istore        11
     119: aload         9
     121: invokeinterface #129,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     126: astore        12
     128: aload         12
     130: invokeinterface #135,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     135: ifeq          235
     138: aload         12
     140: invokeinterface #167,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     145: astore        13
     147: iload         11
     149: iinc          11, 1
     152: istore        14
     154: iload         14
     156: ifge          162
     159: invokestatic  #170                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     162: iload         14
     164: aload         13
     166: checkcast     #53                 // class java/util/List
     169: astore        15
     171: istore        16
     173: iconst_0
     174: istore        17
     176: iload         16
     178: iload         6
     180: iadd
     181: aload         8
     183: invokeinterface #123,  1          // InterfaceMethod java/util/List.size:()I
     188: if_icmplt     194
     191: goto          231
     194: aload         15
     196: aload         8
     198: iload         16
     200: iload         6
     202: iadd
     203: invokeinterface #57,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     208: invokestatic  #174                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     211: ifeq          230
     214: iload         16
     216: iconst_1
     217: iadd
     218: invokestatic  #180                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     221: iload         6
     223: invokestatic  #180                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     226: invokestatic  #77                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     229: areturn
     230: nop
     231: nop
     232: goto          128
     235: nop
     236: nop
     237: nop
     238: goto          36
     241: nop
     242: new           #182                // class java/lang/IllegalStateException
     245: dup
     246: ldc           #184                // String no pattern
     248: invokevirtual #185                // Method java/lang/Object.toString:()Ljava/lang/String;
     251: invokespecial #188                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     254: athrow

  public static kotlin.Pair findPattern$default(java.util.List, int, int, java.lang.Object);
    Code:
       0: iload_2
       1: iconst_1
       2: iand
       3: ifeq          8
       6: iconst_1
       7: istore_1
       8: aload_0
       9: iload_1
      10: invokestatic  #210                // Method findPattern:(Ljava/util/List;I)Lkotlin/Pair;
      13: areturn
}


import java.io.File

fun main() {
    fun part1(input: String) {
        val pairs = input.split("\n").map {
            val parts = it.split(",")
            Pair(parts[0].split("-").map { it.toInt() }, parts[1].split("-").map { it.toInt() })
        }
        val count = pairs.count {
            val (a, b) = it
            (a[0] <= b[0] && a[1] >= b[1]) || (b[0] <= a[0] && b[1] >= a[1])
        }
        println(count)
    }

    fun part2(input: String) {
        val pairs = input.split("\n").map {
            val parts = it.split(",")
            Pair(parts[0].split("-").map { it.toInt() }, parts[1].split("-").map { it.toInt() })
        }
        val count = pairs.count {
            val (a, b) = it
            (a[0] <= b[1] && a[1] >= b[0]) || (b[0] <= a[1] && b[1] >= a[0])
        }
        println(count)
    }

    val input = File("src/Day04.txt").readText()
    part1(input)
    part2(input)
}

Compiled from "Day04.kt"
public final class Day04Kt {
  public static final void main();
    Code:
       0: new           #8                  // class java/io/File
       3: dup
       4: ldc           #10                 // String src/Day04.txt
       6: invokespecial #14                 // Method java/io/File."<init>":(Ljava/lang/String;)V
       9: aconst_null
      10: iconst_1
      11: aconst_null
      12: invokestatic  #20                 // Method kotlin/io/FilesKt.readText$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/lang/String;
      15: astore_0
      16: aload_0
      17: invokestatic  #23                 // Method main$part1:(Ljava/lang/String;)V
      20: aload_0
      21: invokestatic  #26                 // Method main$part2:(Ljava/lang/String;)V
      24: return

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

  private static final void main$part1(java.lang.String);
    Code:
       0: aload_0
       1: checkcast     #35                 // class java/lang/CharSequence
       4: iconst_1
       5: anewarray     #37                 // class java/lang/String
       8: astore_2
       9: aload_2
      10: iconst_0
      11: ldc           #39                 // String \n
      13: aastore
      14: aload_2
      15: iconst_0
      16: iconst_0
      17: bipush        6
      19: aconst_null
      20: invokestatic  #45                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      23: checkcast     #47                 // class java/lang/Iterable
      26: astore_2
      27: iconst_0
      28: istore_3
      29: aload_2
      30: astore        4
      32: new           #49                 // class java/util/ArrayList
      35: dup
      36: aload_2
      37: bipush        10
      39: invokestatic  #55                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      42: invokespecial #58                 // Method java/util/ArrayList."<init>":(I)V
      45: checkcast     #60                 // class java/util/Collection
      48: astore        5
      50: iconst_0
      51: istore        6
      53: aload         4
      55: invokeinterface #64,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      60: astore        7
      62: aload         7
      64: invokeinterface #70,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      69: ifeq          428
      72: aload         7
      74: invokeinterface #74,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      79: astore        8
      81: aload         5
      83: aload         8
      85: checkcast     #37                 // class java/lang/String
      88: astore        9
      90: astore        23
      92: iconst_0
      93: istore        10
      95: aload         9
      97: checkcast     #35                 // class java/lang/CharSequence
     100: iconst_1
     101: anewarray     #37                 // class java/lang/String
     104: astore        11
     106: aload         11
     108: iconst_0
     109: ldc           #76                 // String ,
     111: aastore
     112: aload         11
     114: iconst_0
     115: iconst_0
     116: bipush        6
     118: aconst_null
     119: invokestatic  #45                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     122: astore        12
     124: aload         12
     126: iconst_0
     127: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     132: checkcast     #35                 // class java/lang/CharSequence
     135: iconst_1
     136: anewarray     #37                 // class java/lang/String
     139: astore        11
     141: aload         11
     143: iconst_0
     144: ldc           #84                 // String -
     146: aastore
     147: aload         11
     149: iconst_0
     150: iconst_0
     151: bipush        6
     153: aconst_null
     154: invokestatic  #45                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     157: checkcast     #47                 // class java/lang/Iterable
     160: astore        11
     162: iconst_0
     163: istore        13
     165: aload         11
     167: astore        14
     169: new           #49                 // class java/util/ArrayList
     172: dup
     173: aload         11
     175: bipush        10
     177: invokestatic  #55                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     180: invokespecial #58                 // Method java/util/ArrayList."<init>":(I)V
     183: checkcast     #60                 // class java/util/Collection
     186: astore        15
     188: iconst_0
     189: istore        16
     191: aload         14
     193: invokeinterface #64,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     198: astore        17
     200: aload         17
     202: invokeinterface #70,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     207: ifeq          254
     210: aload         17
     212: invokeinterface #74,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     217: astore        18
     219: aload         15
     221: aload         18
     223: checkcast     #37                 // class java/lang/String
     226: astore        19
     228: astore        20
     230: iconst_0
     231: istore        21
     233: aload         19
     235: invokestatic  #90                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     238: nop
     239: invokestatic  #94                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     242: aload         20
     244: swap
     245: invokeinterface #98,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     250: pop
     251: goto          200
     254: aload         15
     256: checkcast     #78                 // class java/util/List
     259: nop
     260: aload         12
     262: iconst_1
     263: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     268: checkcast     #35                 // class java/lang/CharSequence
     271: iconst_1
     272: anewarray     #37                 // class java/lang/String
     275: astore        11
     277: aload         11
     279: iconst_0
     280: ldc           #84                 // String -
     282: aastore
     283: aload         11
     285: iconst_0
     286: iconst_0
     287: bipush        6
     289: aconst_null
     290: invokestatic  #45                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     293: checkcast     #47                 // class java/lang/Iterable
     296: astore        11
     298: astore        20
     300: iconst_0
     301: istore        13
     303: aload         11
     305: astore        14
     307: new           #49                 // class java/util/ArrayList
     310: dup
     311: aload         11
     313: bipush        10
     315: invokestatic  #55                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     318: invokespecial #58                 // Method java/util/ArrayList."<init>":(I)V
     321: checkcast     #60                 // class java/util/Collection
     324: astore        15
     326: iconst_0
     327: istore        16
     329: aload         14
     331: invokeinterface #64,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     336: astore        17
     338: aload         17
     340: invokeinterface #70,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     345: ifeq          392
     348: aload         17
     350: invokeinterface #74,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     355: astore        18
     357: aload         15
     359: aload         18
     361: checkcast     #37                 // class java/lang/String
     364: astore        19
     366: astore        22
     368: iconst_0
     369: istore        21
     371: aload         19
     373: invokestatic  #90                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     376: nop
     377: invokestatic  #94                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     380: aload         22
     382: swap
     383: invokeinterface #98,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     388: pop
     389: goto          338
     392: aload         15
     394: checkcast     #78                 // class java/util/List
     397: nop
     398: aload         20
     400: swap
     401: astore        24
     403: astore        25
     405: new           #100                // class kotlin/Pair
     408: dup
     409: aload         25
     411: aload         24
     413: invokespecial #103                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     416: aload         23
     418: swap
     419: invokeinterface #98,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     424: pop
     425: goto          62
     428: aload         5
     430: checkcast     #78                 // class java/util/List
     433: nop
     434: astore_1
     435: aload_1
     436: checkcast     #47                 // class java/lang/Iterable
     439: astore_3
     440: iconst_0
     441: istore        4
     443: aload_3
     444: instanceof    #60                 // class java/util/Collection
     447: ifeq          466
     450: aload_3
     451: checkcast     #60                 // class java/util/Collection
     454: invokeinterface #106,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
     459: ifeq          466
     462: iconst_0
     463: goto          674
     466: iconst_0
     467: istore        5
     469: aload_3
     470: invokeinterface #64,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     475: astore        6
     477: aload         6
     479: invokeinterface #70,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     484: ifeq          672
     487: aload         6
     489: invokeinterface #74,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     494: astore        7
     496: aload         7
     498: checkcast     #100                // class kotlin/Pair
     501: astore        8
     503: iconst_0
     504: istore        9
     506: aload         8
     508: invokevirtual #109                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     511: checkcast     #78                 // class java/util/List
     514: astore        10
     516: aload         8
     518: invokevirtual #112                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     521: checkcast     #78                 // class java/util/List
     524: astore        11
     526: aload         10
     528: iconst_0
     529: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     534: checkcast     #114                // class java/lang/Number
     537: invokevirtual #118                // Method java/lang/Number.intValue:()I
     540: aload         11
     542: iconst_0
     543: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     548: checkcast     #114                // class java/lang/Number
     551: invokevirtual #118                // Method java/lang/Number.intValue:()I
     554: if_icmpgt     588
     557: aload         10
     559: iconst_1
     560: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     565: checkcast     #114                // class java/lang/Number
     568: invokevirtual #118                // Method java/lang/Number.intValue:()I
     571: aload         11
     573: iconst_1
     574: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     579: checkcast     #114                // class java/lang/Number
     582: invokevirtual #118                // Method java/lang/Number.intValue:()I
     585: if_icmpge     650
     588: aload         11
     590: iconst_0
     591: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     596: checkcast     #114                // class java/lang/Number
     599: invokevirtual #118                // Method java/lang/Number.intValue:()I
     602: aload         10
     604: iconst_0
     605: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     610: checkcast     #114                // class java/lang/Number
     613: invokevirtual #118                // Method java/lang/Number.intValue:()I
     616: if_icmpgt     654
     619: aload         11
     621: iconst_1
     622: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     627: checkcast     #114                // class java/lang/Number
     630: invokevirtual #118                // Method java/lang/Number.intValue:()I
     633: aload         10
     635: iconst_1
     636: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     641: checkcast     #114                // class java/lang/Number
     644: invokevirtual #118                // Method java/lang/Number.intValue:()I
     647: if_icmplt     654
     650: iconst_1
     651: goto          655
     654: iconst_0
     655: ifeq          477
     658: iinc          5, 1
     661: iload         5
     663: ifge          477
     666: invokestatic  #121                // Method kotlin/collections/CollectionsKt.throwCountOverflow:()V
     669: goto          477
     672: iload         5
     674: istore_2
     675: getstatic     #127                // Field java/lang/System.out:Ljava/io/PrintStream;
     678: iload_2
     679: invokevirtual #132                // Method java/io/PrintStream.println:(I)V
     682: return

  private static final void main$part2(java.lang.String);
    Code:
       0: aload_0
       1: checkcast     #35                 // class java/lang/CharSequence
       4: iconst_1
       5: anewarray     #37                 // class java/lang/String
       8: astore_2
       9: aload_2
      10: iconst_0
      11: ldc           #39                 // String \n
      13: aastore
      14: aload_2
      15: iconst_0
      16: iconst_0
      17: bipush        6
      19: aconst_null
      20: invokestatic  #45                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      23: checkcast     #47                 // class java/lang/Iterable
      26: astore_2
      27: iconst_0
      28: istore_3
      29: aload_2
      30: astore        4
      32: new           #49                 // class java/util/ArrayList
      35: dup
      36: aload_2
      37: bipush        10
      39: invokestatic  #55                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      42: invokespecial #58                 // Method java/util/ArrayList."<init>":(I)V
      45: checkcast     #60                 // class java/util/Collection
      48: astore        5
      50: iconst_0
      51: istore        6
      53: aload         4
      55: invokeinterface #64,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      60: astore        7
      62: aload         7
      64: invokeinterface #70,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      69: ifeq          428
      72: aload         7
      74: invokeinterface #74,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      79: astore        8
      81: aload         5
      83: aload         8
      85: checkcast     #37                 // class java/lang/String
      88: astore        9
      90: astore        23
      92: iconst_0
      93: istore        10
      95: aload         9
      97: checkcast     #35                 // class java/lang/CharSequence
     100: iconst_1
     101: anewarray     #37                 // class java/lang/String
     104: astore        11
     106: aload         11
     108: iconst_0
     109: ldc           #76                 // String ,
     111: aastore
     112: aload         11
     114: iconst_0
     115: iconst_0
     116: bipush        6
     118: aconst_null
     119: invokestatic  #45                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     122: astore        12
     124: aload         12
     126: iconst_0
     127: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     132: checkcast     #35                 // class java/lang/CharSequence
     135: iconst_1
     136: anewarray     #37                 // class java/lang/String
     139: astore        11
     141: aload         11
     143: iconst_0
     144: ldc           #84                 // String -
     146: aastore
     147: aload         11
     149: iconst_0
     150: iconst_0
     151: bipush        6
     153: aconst_null
     154: invokestatic  #45                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     157: checkcast     #47                 // class java/lang/Iterable
     160: astore        11
     162: iconst_0
     163: istore        13
     165: aload         11
     167: astore        14
     169: new           #49                 // class java/util/ArrayList
     172: dup
     173: aload         11
     175: bipush        10
     177: invokestatic  #55                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     180: invokespecial #58                 // Method java/util/ArrayList."<init>":(I)V
     183: checkcast     #60                 // class java/util/Collection
     186: astore        15
     188: iconst_0
     189: istore        16
     191: aload         14
     193: invokeinterface #64,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     198: astore        17
     200: aload         17
     202: invokeinterface #70,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     207: ifeq          254
     210: aload         17
     212: invokeinterface #74,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     217: astore        18
     219: aload         15
     221: aload         18
     223: checkcast     #37                 // class java/lang/String
     226: astore        19
     228: astore        20
     230: iconst_0
     231: istore        21
     233: aload         19
     235: invokestatic  #90                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     238: nop
     239: invokestatic  #94                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     242: aload         20
     244: swap
     245: invokeinterface #98,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     250: pop
     251: goto          200
     254: aload         15
     256: checkcast     #78                 // class java/util/List
     259: nop
     260: aload         12
     262: iconst_1
     263: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     268: checkcast     #35                 // class java/lang/CharSequence
     271: iconst_1
     272: anewarray     #37                 // class java/lang/String
     275: astore        11
     277: aload         11
     279: iconst_0
     280: ldc           #84                 // String -
     282: aastore
     283: aload         11
     285: iconst_0
     286: iconst_0
     287: bipush        6
     289: aconst_null
     290: invokestatic  #45                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     293: checkcast     #47                 // class java/lang/Iterable
     296: astore        11
     298: astore        20
     300: iconst_0
     301: istore        13
     303: aload         11
     305: astore        14
     307: new           #49                 // class java/util/ArrayList
     310: dup
     311: aload         11
     313: bipush        10
     315: invokestatic  #55                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     318: invokespecial #58                 // Method java/util/ArrayList."<init>":(I)V
     321: checkcast     #60                 // class java/util/Collection
     324: astore        15
     326: iconst_0
     327: istore        16
     329: aload         14
     331: invokeinterface #64,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     336: astore        17
     338: aload         17
     340: invokeinterface #70,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     345: ifeq          392
     348: aload         17
     350: invokeinterface #74,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     355: astore        18
     357: aload         15
     359: aload         18
     361: checkcast     #37                 // class java/lang/String
     364: astore        19
     366: astore        22
     368: iconst_0
     369: istore        21
     371: aload         19
     373: invokestatic  #90                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     376: nop
     377: invokestatic  #94                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     380: aload         22
     382: swap
     383: invokeinterface #98,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     388: pop
     389: goto          338
     392: aload         15
     394: checkcast     #78                 // class java/util/List
     397: nop
     398: aload         20
     400: swap
     401: astore        24
     403: astore        25
     405: new           #100                // class kotlin/Pair
     408: dup
     409: aload         25
     411: aload         24
     413: invokespecial #103                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     416: aload         23
     418: swap
     419: invokeinterface #98,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     424: pop
     425: goto          62
     428: aload         5
     430: checkcast     #78                 // class java/util/List
     433: nop
     434: astore_1
     435: aload_1
     436: checkcast     #47                 // class java/lang/Iterable
     439: astore_3
     440: iconst_0
     441: istore        4
     443: aload_3
     444: instanceof    #60                 // class java/util/Collection
     447: ifeq          466
     450: aload_3
     451: checkcast     #60                 // class java/util/Collection
     454: invokeinterface #106,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
     459: ifeq          466
     462: iconst_0
     463: goto          674
     466: iconst_0
     467: istore        5
     469: aload_3
     470: invokeinterface #64,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     475: astore        6
     477: aload         6
     479: invokeinterface #70,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     484: ifeq          672
     487: aload         6
     489: invokeinterface #74,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     494: astore        7
     496: aload         7
     498: checkcast     #100                // class kotlin/Pair
     501: astore        8
     503: iconst_0
     504: istore        9
     506: aload         8
     508: invokevirtual #109                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     511: checkcast     #78                 // class java/util/List
     514: astore        10
     516: aload         8
     518: invokevirtual #112                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     521: checkcast     #78                 // class java/util/List
     524: astore        11
     526: aload         10
     528: iconst_0
     529: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     534: checkcast     #114                // class java/lang/Number
     537: invokevirtual #118                // Method java/lang/Number.intValue:()I
     540: aload         11
     542: iconst_1
     543: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     548: checkcast     #114                // class java/lang/Number
     551: invokevirtual #118                // Method java/lang/Number.intValue:()I
     554: if_icmpgt     588
     557: aload         10
     559: iconst_1
     560: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     565: checkcast     #114                // class java/lang/Number
     568: invokevirtual #118                // Method java/lang/Number.intValue:()I
     571: aload         11
     573: iconst_0
     574: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     579: checkcast     #114                // class java/lang/Number
     582: invokevirtual #118                // Method java/lang/Number.intValue:()I
     585: if_icmpge     650
     588: aload         11
     590: iconst_0
     591: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     596: checkcast     #114                // class java/lang/Number
     599: invokevirtual #118                // Method java/lang/Number.intValue:()I
     602: aload         10
     604: iconst_1
     605: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     610: checkcast     #114                // class java/lang/Number
     613: invokevirtual #118                // Method java/lang/Number.intValue:()I
     616: if_icmpgt     654
     619: aload         11
     621: iconst_1
     622: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     627: checkcast     #114                // class java/lang/Number
     630: invokevirtual #118                // Method java/lang/Number.intValue:()I
     633: aload         10
     635: iconst_0
     636: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     641: checkcast     #114                // class java/lang/Number
     644: invokevirtual #118                // Method java/lang/Number.intValue:()I
     647: if_icmplt     654
     650: iconst_1
     651: goto          655
     654: iconst_0
     655: ifeq          477
     658: iinc          5, 1
     661: iload         5
     663: ifge          477
     666: invokestatic  #121                // Method kotlin/collections/CollectionsKt.throwCountOverflow:()V
     669: goto          477
     672: iload         5
     674: istore_2
     675: getstatic     #127                // Field java/lang/System.out:Ljava/io/PrintStream;
     678: iload_2
     679: invokevirtual #132                // Method java/io/PrintStream.println:(I)V
     682: return
}