package day04

import java.io.File
import kotlin.math.pow

fun main() {
    val data = parse("src/day04/Day04.txt")

    println("🎄 Day 04 🎄")

    println()

    println("[Part 1]")
    println("Answer: ${part1(data)}")

    println()

    println("[Part 2]")
    println("Answer: ${part2(data)}")
}

private fun String.toMatches(): Int {
    val (_, winningPart, playerPart) = split(": ", " | ")

    val winningNumbers = winningPart
        .split(" ")
        .mapNotNull(String::toIntOrNull)
        .toSet()

    val playerNumbers = playerPart
        .split(" ")
        .mapNotNull(String::toIntOrNull)

    return playerNumbers.count { it in winningNumbers }
}

private fun parse(path: String): List<Int> =
    File(path)
        .readLines()
        .map(String::toMatches)

private fun part1(data: List<Int>): Int =
    data.sumOf { 2.0.pow(it).toInt() / 2 }

private fun part2(data: List<Int>): Int {
    val pile = MutableList(data.size) { 1 }
    for ((i, matches) in data.withIndex()) {
        for (offset in 1..matches) {
            pile[i + offset] += pile[i]
        }
    }
    return pile.sum()
}

Compiled from "Day04.kt"
public final class day04.Day04Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String src/day04/Day04.txt
       2: invokestatic  #12                 // Method parse:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: ldc           #14                 // String 🎄 Day 04 🎄
       8: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      11: swap
      12: invokevirtual #26                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      15: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      18: invokevirtual #28                 // Method java/io/PrintStream.println:()V
      21: ldc           #30                 // String [Part 1]
      23: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      26: swap
      27: invokevirtual #26                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      30: new           #32                 // class java/lang/StringBuilder
      33: dup
      34: invokespecial #35                 // Method java/lang/StringBuilder."<init>":()V
      37: ldc           #37                 // String Answer:
      39: invokevirtual #41                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      42: aload_0
      43: invokestatic  #45                 // Method part1:(Ljava/util/List;)I
      46: invokevirtual #48                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      49: invokevirtual #52                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      52: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      55: swap
      56: invokevirtual #26                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      59: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      62: invokevirtual #28                 // Method java/io/PrintStream.println:()V
      65: ldc           #54                 // String [Part 2]
      67: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      70: swap
      71: invokevirtual #26                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      74: new           #32                 // class java/lang/StringBuilder
      77: dup
      78: invokespecial #35                 // Method java/lang/StringBuilder."<init>":()V
      81: ldc           #37                 // String Answer:
      83: invokevirtual #41                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      86: aload_0
      87: invokestatic  #57                 // Method part2:(Ljava/util/List;)I
      90: invokevirtual #48                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      93: invokevirtual #52                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      96: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      99: swap
     100: invokevirtual #26                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     103: return

  private static final int toMatches(java.lang.String);
    Code:
       0: aload_0
       1: checkcast     #63                 // class java/lang/CharSequence
       4: iconst_2
       5: anewarray     #65                 // class java/lang/String
       8: astore_2
       9: aload_2
      10: iconst_0
      11: ldc           #67                 // String :
      13: aastore
      14: aload_2
      15: iconst_1
      16: ldc           #69                 // String  |
      18: aastore
      19: aload_2
      20: iconst_0
      21: iconst_0
      22: bipush        6
      24: aconst_null
      25: invokestatic  #75                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      28: astore_1
      29: aload_1
      30: iconst_1
      31: invokeinterface #81,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      36: checkcast     #65                 // class java/lang/String
      39: astore_2
      40: aload_1
      41: iconst_2
      42: invokeinterface #81,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      47: checkcast     #65                 // class java/lang/String
      50: astore_3
      51: aload_2
      52: checkcast     #63                 // class java/lang/CharSequence
      55: iconst_1
      56: anewarray     #65                 // class java/lang/String
      59: astore        5
      61: aload         5
      63: iconst_0
      64: ldc           #83                 // String
      66: aastore
      67: aload         5
      69: iconst_0
      70: iconst_0
      71: bipush        6
      73: aconst_null
      74: invokestatic  #75                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      77: checkcast     #85                 // class java/lang/Iterable
      80: astore        5
      82: nop
      83: iconst_0
      84: istore        6
      86: aload         5
      88: astore        7
      90: new           #87                 // class java/util/ArrayList
      93: dup
      94: invokespecial #88                 // Method java/util/ArrayList."<init>":()V
      97: checkcast     #90                 // class java/util/Collection
     100: astore        8
     102: iconst_0
     103: istore        9
     105: aload         7
     107: astore        10
     109: iconst_0
     110: istore        11
     112: aload         10
     114: invokeinterface #94,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     119: astore        12
     121: aload         12
     123: invokeinterface #100,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     128: ifeq          189
     131: aload         12
     133: invokeinterface #104,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     138: astore        13
     140: aload         13
     142: astore        14
     144: iconst_0
     145: istore        15
     147: aload         14
     149: checkcast     #65                 // class java/lang/String
     152: astore        16
     154: iconst_0
     155: istore        17
     157: aload         16
     159: invokestatic  #108                // Method kotlin/text/StringsKt.toIntOrNull:(Ljava/lang/String;)Ljava/lang/Integer;
     162: dup
     163: ifnull        184
     166: astore        18
     168: iconst_0
     169: istore        19
     171: aload         8
     173: aload         18
     175: invokeinterface #112,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     180: pop
     181: goto          185
     184: pop
     185: nop
     186: goto          121
     189: nop
     190: aload         8
     192: checkcast     #77                 // class java/util/List
     195: nop
     196: checkcast     #85                 // class java/lang/Iterable
     199: invokestatic  #118                // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;
     202: astore        4
     204: aload_3
     205: checkcast     #63                 // class java/lang/CharSequence
     208: iconst_1
     209: anewarray     #65                 // class java/lang/String
     212: astore        6
     214: aload         6
     216: iconst_0
     217: ldc           #83                 // String
     219: aastore
     220: aload         6
     222: iconst_0
     223: iconst_0
     224: bipush        6
     226: aconst_null
     227: invokestatic  #75                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     230: checkcast     #85                 // class java/lang/Iterable
     233: astore        6
     235: nop
     236: iconst_0
     237: istore        7
     239: aload         6
     241: astore        8
     243: new           #87                 // class java/util/ArrayList
     246: dup
     247: invokespecial #88                 // Method java/util/ArrayList."<init>":()V
     250: checkcast     #90                 // class java/util/Collection
     253: astore        9
     255: iconst_0
     256: istore        10
     258: aload         8
     260: astore        11
     262: iconst_0
     263: istore        12
     265: aload         11
     267: invokeinterface #94,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     272: astore        13
     274: aload         13
     276: invokeinterface #100,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     281: ifeq          342
     284: aload         13
     286: invokeinterface #104,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     291: astore        14
     293: aload         14
     295: astore        15
     297: iconst_0
     298: istore        16
     300: aload         15
     302: checkcast     #65                 // class java/lang/String
     305: astore        17
     307: iconst_0
     308: istore        18
     310: aload         17
     312: invokestatic  #108                // Method kotlin/text/StringsKt.toIntOrNull:(Ljava/lang/String;)Ljava/lang/Integer;
     315: dup
     316: ifnull        337
     319: astore        19
     321: iconst_0
     322: istore        20
     324: aload         9
     326: aload         19
     328: invokeinterface #112,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     333: pop
     334: goto          338
     337: pop
     338: nop
     339: goto          274
     342: nop
     343: aload         9
     345: checkcast     #77                 // class java/util/List
     348: nop
     349: astore        5
     351: aload         5
     353: checkcast     #85                 // class java/lang/Iterable
     356: astore        6
     358: iconst_0
     359: istore        7
     361: aload         6
     363: instanceof    #90                 // class java/util/Collection
     366: ifeq          386
     369: aload         6
     371: checkcast     #90                 // class java/util/Collection
     374: invokeinterface #121,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
     379: ifeq          386
     382: iconst_0
     383: goto          461
     386: iconst_0
     387: istore        8
     389: aload         6
     391: invokeinterface #94,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     396: astore        9
     398: aload         9
     400: invokeinterface #100,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     405: ifeq          459
     408: aload         9
     410: invokeinterface #104,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     415: astore        10
     417: aload         10
     419: checkcast     #123                // class java/lang/Number
     422: invokevirtual #127                // Method java/lang/Number.intValue:()I
     425: istore        11
     427: iconst_0
     428: istore        12
     430: aload         4
     432: iload         11
     434: invokestatic  #133                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     437: invokeinterface #138,  2          // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
     442: ifeq          398
     445: iinc          8, 1
     448: iload         8
     450: ifge          398
     453: invokestatic  #141                // Method kotlin/collections/CollectionsKt.throwCountOverflow:()V
     456: goto          398
     459: iload         8
     461: ireturn

  private static final java.util.List<java.lang.Integer> parse(java.lang.String);
    Code:
       0: new           #176                // class java/io/File
       3: dup
       4: aload_0
       5: invokespecial #179                // Method java/io/File."<init>":(Ljava/lang/String;)V
       8: aconst_null
       9: iconst_1
      10: aconst_null
      11: invokestatic  #185                // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;
      14: checkcast     #85                 // class java/lang/Iterable
      17: astore_1
      18: nop
      19: iconst_0
      20: istore_2
      21: aload_1
      22: astore_3
      23: new           #87                 // class java/util/ArrayList
      26: dup
      27: aload_1
      28: bipush        10
      30: invokestatic  #189                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      33: invokespecial #192                // Method java/util/ArrayList."<init>":(I)V
      36: checkcast     #90                 // class java/util/Collection
      39: astore        4
      41: iconst_0
      42: istore        5
      44: aload_3
      45: invokeinterface #94,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      50: astore        6
      52: aload         6
      54: invokeinterface #100,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      59: ifeq          105
      62: aload         6
      64: invokeinterface #104,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      69: astore        7
      71: aload         4
      73: aload         7
      75: checkcast     #65                 // class java/lang/String
      78: astore        8
      80: astore        10
      82: iconst_0
      83: istore        9
      85: aload         8
      87: invokestatic  #194                // Method toMatches:(Ljava/lang/String;)I
      90: invokestatic  #133                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      93: aload         10
      95: swap
      96: invokeinterface #112,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     101: pop
     102: goto          52
     105: aload         4
     107: checkcast     #77                 // class java/util/List
     110: nop
     111: areturn

  private static final int part1(java.util.List<java.lang.Integer>);
    Code:
       0: aload_0
       1: checkcast     #85                 // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: invokeinterface #94,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      13: astore_3
      14: aload_3
      15: invokeinterface #100,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      20: ifeq          70
      23: aload_3
      24: invokeinterface #104,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      29: astore        4
      31: iload_2
      32: aload         4
      34: checkcast     #123                // class java/lang/Number
      37: invokevirtual #127                // Method java/lang/Number.intValue:()I
      40: istore        5
      42: istore        7
      44: iconst_0
      45: istore        6
      47: ldc2_w        #203                // double 2.0d
      50: iload         5
      52: i2d
      53: invokestatic  #210                // Method java/lang/Math.pow:(DD)D
      56: d2i
      57: iconst_2
      58: idiv
      59: istore        8
      61: iload         7
      63: iload         8
      65: iadd
      66: istore_2
      67: goto          14
      70: iload_2
      71: ireturn

  private static final int part2(java.util.List<java.lang.Integer>);
    Code:
       0: aload_0
       1: invokeinterface #214,  1          // InterfaceMethod java/util/List.size:()I
       6: istore_2
       7: new           #87                 // class java/util/ArrayList
      10: dup
      11: iload_2
      12: invokespecial #192                // Method java/util/ArrayList."<init>":(I)V
      15: astore_3
      16: iconst_0
      17: istore        4
      19: iload         4
      21: iload_2
      22: if_icmpge     56
      25: iload         4
      27: istore        5
      29: aload_3
      30: iload         5
      32: istore        6
      34: astore        8
      36: iconst_0
      37: istore        7
      39: iconst_1
      40: invokestatic  #133                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      43: aload         8
      45: swap
      46: invokevirtual #215                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      49: pop
      50: iinc          4, 1
      53: goto          19
      56: aload_3
      57: checkcast     #77                 // class java/util/List
      60: astore_1
      61: aload_0
      62: checkcast     #85                 // class java/lang/Iterable
      65: invokeinterface #94,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      70: astore_2
      71: iconst_0
      72: istore_3
      73: aload_2
      74: invokeinterface #100,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      79: ifeq          174
      82: iload_3
      83: istore        4
      85: iload_3
      86: iconst_1
      87: iadd
      88: istore_3
      89: aload_2
      90: invokeinterface #104,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      95: checkcast     #123                // class java/lang/Number
      98: invokevirtual #127                // Method java/lang/Number.intValue:()I
     101: istore        5
     103: iconst_1
     104: istore        6
     106: iload         6
     108: iload         5
     110: if_icmpgt     73
     113: iload         4
     115: iload         6
     117: iadd
     118: istore        7
     120: aload_1
     121: iload         7
     123: aload_1
     124: iload         7
     126: invokeinterface #81,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     131: checkcast     #123                // class java/lang/Number
     134: invokevirtual #127                // Method java/lang/Number.intValue:()I
     137: aload_1
     138: iload         4
     140: invokeinterface #81,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     145: checkcast     #123                // class java/lang/Number
     148: invokevirtual #127                // Method java/lang/Number.intValue:()I
     151: iadd
     152: invokestatic  #133                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     155: invokeinterface #219,  3          // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;
     160: pop
     161: iload         6
     163: iload         5
     165: if_icmpeq     73
     168: iinc          6, 1
     171: goto          113
     174: aload_1
     175: checkcast     #85                 // class java/lang/Iterable
     178: invokestatic  #223                // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
     181: ireturn

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


package day03

import java.io.File

fun main() {
    val data = parse("src/day03/Day03.txt")

    println("🎄 Day 03 🎄")

    println()

    println("[Part 1]")
    println("Answer: ${part1(data)}")

    println()

    println("[Part 2]")
    println("Answer: ${part2(data)}")
}

private data class Part(
    val rx: IntRange,
    val ry: IntRange,
    val value: Int,
)

private data class Symbol(
    val x: Int,
    val y: Int,
    val value: Char,
)

private data class Schematic(
    val parts: List<Part>,
    val symbols: List<Symbol>,
)

private val PATTERN = """(\d+)|[^.]""".toRegex()

private fun parse(path: String): Schematic {
    val parts = mutableListOf<Part>()
    val symbols = mutableListOf<Symbol>()

    val data = File(path).readLines()
    for ((y, line) in data.withIndex()) {
        val (matchedParts, matchedSymbols) = PATTERN.findAll(line)
            .partition { it.value[0].isDigit() }

        parts.addAll(matchedParts.map {
            val a = it.range.first
            val b = it.range.last

            val rx = (a - 1)..(b + 1)
            val ry = (y - 1)..(y + 1)

            Part(rx, ry, it.value.toInt())
        })

        symbols.addAll(matchedSymbols.map {
            Symbol(x = it.range.first, y, it.value[0])
        })
    }

    return Schematic(parts, symbols)
}

private fun part1(data: Schematic): Int {
    val (parts, symbols) = data
    return parts.sumOf { (rx, ry, value) ->
        if (symbols.any { (sx, sy) -> (sx in rx) && (sy in ry) }) {
            value
        } else {
            0
        }
    }
}

private fun part2(data: Schematic): Int {
    val (parts, symbols) = data
    val gears = symbols.filter { it.value == '*' }
    return gears.sumOf { (sx, sy) ->
        val adjacentNumbers = parts.mapNotNull { (rx, ry, value) ->
            if ((sx in rx) && (sy in ry)) value else null
        }

        if (adjacentNumbers.count() == 2) {
            adjacentNumbers.reduce(Int::times)
        } else {
            0
        }
    }
}

Compiled from "Day03.kt"
public final class day03.Day03Kt {
  private static final kotlin.text.Regex PATTERN;

  public static final void main();
    Code:
       0: ldc           #8                  // String src/day03/Day03.txt
       2: invokestatic  #12                 // Method parse:(Ljava/lang/String;)Lday03/Schematic;
       5: astore_0
       6: ldc           #14                 // String 🎄 Day 03 🎄
       8: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      11: swap
      12: invokevirtual #26                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      15: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      18: invokevirtual #28                 // Method java/io/PrintStream.println:()V
      21: ldc           #30                 // String [Part 1]
      23: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      26: swap
      27: invokevirtual #26                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      30: new           #32                 // class java/lang/StringBuilder
      33: dup
      34: invokespecial #35                 // Method java/lang/StringBuilder."<init>":()V
      37: ldc           #37                 // String Answer:
      39: invokevirtual #41                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      42: aload_0
      43: invokestatic  #45                 // Method part1:(Lday03/Schematic;)I
      46: invokevirtual #48                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      49: invokevirtual #52                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      52: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      55: swap
      56: invokevirtual #26                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      59: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      62: invokevirtual #28                 // Method java/io/PrintStream.println:()V
      65: ldc           #54                 // String [Part 2]
      67: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      70: swap
      71: invokevirtual #26                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      74: new           #32                 // class java/lang/StringBuilder
      77: dup
      78: invokespecial #35                 // Method java/lang/StringBuilder."<init>":()V
      81: ldc           #37                 // String Answer:
      83: invokevirtual #41                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      86: aload_0
      87: invokestatic  #57                 // Method part2:(Lday03/Schematic;)I
      90: invokevirtual #48                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      93: invokevirtual #52                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      96: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      99: swap
     100: invokevirtual #26                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     103: return

  private static final day03.Schematic parse(java.lang.String);
    Code:
       0: new           #61                 // class java/util/ArrayList
       3: dup
       4: invokespecial #62                 // Method java/util/ArrayList."<init>":()V
       7: checkcast     #64                 // class java/util/List
      10: astore_1
      11: new           #61                 // class java/util/ArrayList
      14: dup
      15: invokespecial #62                 // Method java/util/ArrayList."<init>":()V
      18: checkcast     #64                 // class java/util/List
      21: astore_2
      22: new           #66                 // class java/io/File
      25: dup
      26: aload_0
      27: invokespecial #69                 // Method java/io/File."<init>":(Ljava/lang/String;)V
      30: aconst_null
      31: iconst_1
      32: aconst_null
      33: invokestatic  #75                 // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;
      36: astore_3
      37: aload_3
      38: checkcast     #77                 // class java/lang/Iterable
      41: invokeinterface #81,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      46: astore        4
      48: iconst_0
      49: istore        5
      51: aload         4
      53: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      58: ifeq          565
      61: iload         5
      63: istore        6
      65: iload         5
      67: iconst_1
      68: iadd
      69: istore        5
      71: aload         4
      73: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      78: checkcast     #93                 // class java/lang/String
      81: astore        7
      83: getstatic     #97                 // Field PATTERN:Lkotlin/text/Regex;
      86: aload         7
      88: checkcast     #99                 // class java/lang/CharSequence
      91: iconst_0
      92: iconst_2
      93: aconst_null
      94: invokestatic  #105                // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;
      97: astore        9
      99: nop
     100: iconst_0
     101: istore        10
     103: new           #61                 // class java/util/ArrayList
     106: dup
     107: invokespecial #62                 // Method java/util/ArrayList."<init>":()V
     110: astore        11
     112: new           #61                 // class java/util/ArrayList
     115: dup
     116: invokespecial #62                 // Method java/util/ArrayList."<init>":()V
     119: astore        12
     121: aload         9
     123: invokeinterface #108,  1          // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
     128: astore        13
     130: aload         13
     132: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     137: ifeq          198
     140: aload         13
     142: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     147: astore        14
     149: aload         14
     151: checkcast     #110                // class kotlin/text/MatchResult
     154: astore        15
     156: iconst_0
     157: istore        16
     159: aload         15
     161: invokeinterface #113,  1          // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;
     166: iconst_0
     167: invokevirtual #117                // Method java/lang/String.charAt:(I)C
     170: invokestatic  #123                // Method java/lang/Character.isDigit:(C)Z
     173: nop
     174: ifeq          187
     177: aload         11
     179: aload         14
     181: invokevirtual #127                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     184: goto          194
     187: aload         12
     189: aload         14
     191: invokevirtual #127                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     194: pop
     195: goto          130
     198: new           #129                // class kotlin/Pair
     201: dup
     202: aload         11
     204: aload         12
     206: invokespecial #132                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     209: astore        8
     211: aload         8
     213: invokevirtual #135                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     216: checkcast     #64                 // class java/util/List
     219: astore        9
     221: aload         8
     223: invokevirtual #138                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     226: checkcast     #64                 // class java/util/List
     229: astore        10
     231: aload_1
     232: aload         9
     234: checkcast     #77                 // class java/lang/Iterable
     237: astore        11
     239: astore        24
     241: iconst_0
     242: istore        12
     244: aload         11
     246: astore        13
     248: new           #61                 // class java/util/ArrayList
     251: dup
     252: aload         11
     254: bipush        10
     256: invokestatic  #144                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     259: invokespecial #147                // Method java/util/ArrayList."<init>":(I)V
     262: checkcast     #149                // class java/util/Collection
     265: astore        14
     267: iconst_0
     268: istore        15
     270: aload         13
     272: invokeinterface #81,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     277: astore        16
     279: aload         16
     281: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     286: ifeq          403
     289: aload         16
     291: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     296: astore        17
     298: aload         14
     300: aload         17
     302: checkcast     #110                // class kotlin/text/MatchResult
     305: astore        18
     307: astore        25
     309: iconst_0
     310: istore        19
     312: aload         18
     314: invokeinterface #153,  1          // InterfaceMethod kotlin/text/MatchResult.getRange:()Lkotlin/ranges/IntRange;
     319: invokevirtual #159                // Method kotlin/ranges/IntRange.getFirst:()I
     322: istore        20
     324: aload         18
     326: invokeinterface #153,  1          // InterfaceMethod kotlin/text/MatchResult.getRange:()Lkotlin/ranges/IntRange;
     331: invokevirtual #162                // Method kotlin/ranges/IntRange.getLast:()I
     334: istore        21
     336: new           #155                // class kotlin/ranges/IntRange
     339: dup
     340: iload         20
     342: iconst_1
     343: isub
     344: iload         21
     346: iconst_1
     347: iadd
     348: invokespecial #165                // Method kotlin/ranges/IntRange."<init>":(II)V
     351: astore        22
     353: new           #155                // class kotlin/ranges/IntRange
     356: dup
     357: iload         6
     359: iconst_1
     360: isub
     361: iload         6
     363: iconst_1
     364: iadd
     365: invokespecial #165                // Method kotlin/ranges/IntRange."<init>":(II)V
     368: astore        23
     370: new           #167                // class day03/Part
     373: dup
     374: aload         22
     376: aload         23
     378: aload         18
     380: invokeinterface #113,  1          // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;
     385: invokestatic  #173                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     388: invokespecial #176                // Method day03/Part."<init>":(Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;I)V
     391: aload         25
     393: swap
     394: invokeinterface #177,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     399: pop
     400: goto          279
     403: aload         14
     405: checkcast     #64                 // class java/util/List
     408: nop
     409: aload         24
     411: swap
     412: checkcast     #149                // class java/util/Collection
     415: invokeinterface #181,  2          // InterfaceMethod java/util/List.addAll:(Ljava/util/Collection;)Z
     420: pop
     421: aload_2
     422: aload         10
     424: checkcast     #77                 // class java/lang/Iterable
     427: astore        11
     429: astore        24
     431: iconst_0
     432: istore        12
     434: aload         11
     436: astore        13
     438: new           #61                 // class java/util/ArrayList
     441: dup
     442: aload         11
     444: bipush        10
     446: invokestatic  #144                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     449: invokespecial #147                // Method java/util/ArrayList."<init>":(I)V
     452: checkcast     #149                // class java/util/Collection
     455: astore        14
     457: iconst_0
     458: istore        15
     460: aload         13
     462: invokeinterface #81,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     467: astore        16
     469: aload         16
     471: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     476: ifeq          544
     479: aload         16
     481: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     486: astore        17
     488: aload         14
     490: aload         17
     492: checkcast     #110                // class kotlin/text/MatchResult
     495: astore        18
     497: astore        25
     499: iconst_0
     500: istore        19
     502: new           #183                // class day03/Symbol
     505: dup
     506: aload         18
     508: invokeinterface #153,  1          // InterfaceMethod kotlin/text/MatchResult.getRange:()Lkotlin/ranges/IntRange;
     513: invokevirtual #159                // Method kotlin/ranges/IntRange.getFirst:()I
     516: iload         6
     518: aload         18
     520: invokeinterface #113,  1          // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;
     525: iconst_0
     526: invokevirtual #117                // Method java/lang/String.charAt:(I)C
     529: invokespecial #186                // Method day03/Symbol."<init>":(IIC)V
     532: aload         25
     534: swap
     535: invokeinterface #177,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     540: pop
     541: goto          469
     544: aload         14
     546: checkcast     #64                 // class java/util/List
     549: nop
     550: aload         24
     552: swap
     553: checkcast     #149                // class java/util/Collection
     556: invokeinterface #181,  2          // InterfaceMethod java/util/List.addAll:(Ljava/util/Collection;)Z
     561: pop
     562: goto          51
     565: new           #188                // class day03/Schematic
     568: dup
     569: aload_1
     570: aload_2
     571: invokespecial #191                // Method day03/Schematic."<init>":(Ljava/util/List;Ljava/util/List;)V
     574: areturn

  private static final int part1(day03.Schematic);
    Code:
       0: aload_0
       1: invokevirtual #230                // Method day03/Schematic.component1:()Ljava/util/List;
       4: astore_1
       5: aload_0
       6: invokevirtual #232                // Method day03/Schematic.component2:()Ljava/util/List;
       9: astore_2
      10: aload_1
      11: checkcast     #77                 // class java/lang/Iterable
      14: astore_3
      15: iconst_0
      16: istore        4
      18: aload_3
      19: invokeinterface #81,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      24: astore        5
      26: aload         5
      28: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      33: ifeq          273
      36: aload         5
      38: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      43: astore        6
      45: iload         4
      47: aload         6
      49: checkcast     #167                // class day03/Part
      52: astore        7
      54: istore        21
      56: iconst_0
      57: istore        8
      59: aload         7
      61: invokevirtual #234                // Method day03/Part.component1:()Lkotlin/ranges/IntRange;
      64: astore        9
      66: aload         7
      68: invokevirtual #236                // Method day03/Part.component2:()Lkotlin/ranges/IntRange;
      71: astore        10
      73: aload         7
      75: invokevirtual #239                // Method day03/Part.component3:()I
      78: istore        11
      80: aload_2
      81: checkcast     #77                 // class java/lang/Iterable
      84: astore        12
      86: iconst_0
      87: istore        13
      89: aload         12
      91: instanceof    #149                // class java/util/Collection
      94: ifeq          114
      97: aload         12
      99: checkcast     #149                // class java/util/Collection
     102: invokeinterface #242,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
     107: ifeq          114
     110: iconst_0
     111: goto          251
     114: aload         12
     116: invokeinterface #81,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     121: astore        14
     123: aload         14
     125: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     130: ifeq          250
     133: aload         14
     135: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     140: astore        15
     142: aload         15
     144: checkcast     #183                // class day03/Symbol
     147: astore        16
     149: iconst_0
     150: istore        17
     152: aload         16
     154: invokevirtual #244                // Method day03/Symbol.component1:()I
     157: istore        18
     159: aload         16
     161: invokevirtual #246                // Method day03/Symbol.component2:()I
     164: istore        19
     166: aload         9
     168: invokevirtual #159                // Method kotlin/ranges/IntRange.getFirst:()I
     171: istore        20
     173: iload         18
     175: aload         9
     177: invokevirtual #162                // Method kotlin/ranges/IntRange.getLast:()I
     180: if_icmpgt     198
     183: iload         20
     185: iload         18
     187: if_icmpgt     194
     190: iconst_1
     191: goto          199
     194: iconst_0
     195: goto          199
     198: iconst_0
     199: ifeq          242
     202: aload         10
     204: invokevirtual #159                // Method kotlin/ranges/IntRange.getFirst:()I
     207: istore        20
     209: iload         19
     211: aload         10
     213: invokevirtual #162                // Method kotlin/ranges/IntRange.getLast:()I
     216: if_icmpgt     234
     219: iload         20
     221: iload         19
     223: if_icmpgt     230
     226: iconst_1
     227: goto          235
     230: iconst_0
     231: goto          235
     234: iconst_0
     235: ifeq          242
     238: iconst_1
     239: goto          243
     242: iconst_0
     243: ifeq          123
     246: iconst_1
     247: goto          251
     250: iconst_0
     251: ifeq          259
     254: iload         11
     256: goto          260
     259: iconst_0
     260: nop
     261: istore        22
     263: iload         21
     265: iload         22
     267: iadd
     268: istore        4
     270: goto          26
     273: iload         4
     275: ireturn

  private static final int part2(day03.Schematic);
    Code:
       0: aload_0
       1: invokevirtual #230                // Method day03/Schematic.component1:()Ljava/util/List;
       4: astore_1
       5: aload_0
       6: invokevirtual #232                // Method day03/Schematic.component2:()Ljava/util/List;
       9: astore_2
      10: aload_2
      11: checkcast     #77                 // class java/lang/Iterable
      14: astore        4
      16: iconst_0
      17: istore        5
      19: aload         4
      21: astore        6
      23: new           #61                 // class java/util/ArrayList
      26: dup
      27: invokespecial #62                 // Method java/util/ArrayList."<init>":()V
      30: checkcast     #149                // class java/util/Collection
      33: astore        7
      35: iconst_0
      36: istore        8
      38: aload         6
      40: invokeinterface #81,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      45: astore        9
      47: aload         9
      49: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      54: ifeq          107
      57: aload         9
      59: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      64: astore        10
      66: aload         10
      68: checkcast     #183                // class day03/Symbol
      71: astore        11
      73: iconst_0
      74: istore        12
      76: aload         11
      78: invokevirtual #256                // Method day03/Symbol.getValue:()C
      81: bipush        42
      83: if_icmpne     90
      86: iconst_1
      87: goto          91
      90: iconst_0
      91: ifeq          47
      94: aload         7
      96: aload         10
      98: invokeinterface #177,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     103: pop
     104: goto          47
     107: aload         7
     109: checkcast     #64                 // class java/util/List
     112: nop
     113: astore_3
     114: aload_3
     115: checkcast     #77                 // class java/lang/Iterable
     118: astore        4
     120: iconst_0
     121: istore        5
     123: aload         4
     125: invokeinterface #81,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     130: astore        6
     132: aload         6
     134: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     139: ifeq          536
     142: aload         6
     144: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     149: astore        7
     151: iload         5
     153: aload         7
     155: checkcast     #183                // class day03/Symbol
     158: astore        8
     160: istore        32
     162: iconst_0
     163: istore        9
     165: aload         8
     167: invokevirtual #244                // Method day03/Symbol.component1:()I
     170: istore        10
     172: aload         8
     174: invokevirtual #246                // Method day03/Symbol.component2:()I
     177: istore        11
     179: aload_1
     180: checkcast     #77                 // class java/lang/Iterable
     183: astore        12
     185: iconst_0
     186: istore        13
     188: aload         12
     190: astore        14
     192: new           #61                 // class java/util/ArrayList
     195: dup
     196: invokespecial #62                 // Method java/util/ArrayList."<init>":()V
     199: checkcast     #149                // class java/util/Collection
     202: astore        15
     204: iconst_0
     205: istore        16
     207: aload         14
     209: astore        17
     211: iconst_0
     212: istore        18
     214: aload         17
     216: invokeinterface #81,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     221: astore        19
     223: aload         19
     225: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     230: ifeq          388
     233: aload         19
     235: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     240: astore        20
     242: aload         20
     244: astore        21
     246: iconst_0
     247: istore        22
     249: aload         21
     251: checkcast     #167                // class day03/Part
     254: astore        23
     256: iconst_0
     257: istore        24
     259: aload         23
     261: invokevirtual #234                // Method day03/Part.component1:()Lkotlin/ranges/IntRange;
     264: astore        25
     266: aload         23
     268: invokevirtual #236                // Method day03/Part.component2:()Lkotlin/ranges/IntRange;
     271: astore        26
     273: aload         23
     275: invokevirtual #239                // Method day03/Part.component3:()I
     278: istore        27
     280: aload         25
     282: invokevirtual #159                // Method kotlin/ranges/IntRange.getFirst:()I
     285: istore        28
     287: iload         10
     289: aload         25
     291: invokevirtual #162                // Method kotlin/ranges/IntRange.getLast:()I
     294: if_icmpgt     312
     297: iload         28
     299: iload         10
     301: if_icmpgt     308
     304: iconst_1
     305: goto          313
     308: iconst_0
     309: goto          313
     312: iconst_0
     313: ifeq          360
     316: aload         26
     318: invokevirtual #159                // Method kotlin/ranges/IntRange.getFirst:()I
     321: istore        28
     323: iload         11
     325: aload         26
     327: invokevirtual #162                // Method kotlin/ranges/IntRange.getLast:()I
     330: if_icmpgt     348
     333: iload         28
     335: iload         11
     337: if_icmpgt     344
     340: iconst_1
     341: goto          349
     344: iconst_0
     345: goto          349
     348: iconst_0
     349: ifeq          360
     352: iload         27
     354: invokestatic  #260                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     357: goto          361
     360: aconst_null
     361: dup
     362: ifnull        383
     365: astore        29
     367: iconst_0
     368: istore        30
     370: aload         15
     372: aload         29
     374: invokeinterface #177,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     379: pop
     380: goto          384
     383: pop
     384: nop
     385: goto          223
     388: nop
     389: aload         15
     391: checkcast     #64                 // class java/util/List
     394: nop
     395: astore        31
     397: aload         31
     399: checkcast     #149                // class java/util/Collection
     402: invokeinterface #263,  1          // InterfaceMethod java/util/Collection.size:()I
     407: iconst_2
     408: if_icmpne     522
     411: aload         31
     413: checkcast     #77                 // class java/lang/Iterable
     416: astore        12
     418: iconst_0
     419: istore        13
     421: aload         12
     423: invokeinterface #81,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     428: astore        14
     430: aload         14
     432: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     437: ifne          451
     440: new           #265                // class java/lang/UnsupportedOperationException
     443: dup
     444: ldc_w         #267                // String Empty collection can\'t be reduced.
     447: invokespecial #268                // Method java/lang/UnsupportedOperationException."<init>":(Ljava/lang/String;)V
     450: athrow
     451: aload         14
     453: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     458: astore        15
     460: aload         14
     462: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     467: ifeq          511
     470: aload         15
     472: aload         14
     474: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     479: checkcast     #270                // class java/lang/Number
     482: invokevirtual #273                // Method java/lang/Number.intValue:()I
     485: istore        16
     487: checkcast     #270                // class java/lang/Number
     490: invokevirtual #273                // Method java/lang/Number.intValue:()I
     493: istore        17
     495: iconst_0
     496: istore        18
     498: iload         17
     500: iload         16
     502: imul
     503: invokestatic  #260                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     506: astore        15
     508: goto          460
     511: aload         15
     513: checkcast     #270                // class java/lang/Number
     516: invokevirtual #273                // Method java/lang/Number.intValue:()I
     519: goto          523
     522: iconst_0
     523: nop
     524: istore        33
     526: iload         32
     528: iload         33
     530: iadd
     531: istore        5
     533: goto          132
     536: iload         5
     538: ireturn

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

  static {};
    Code:
       0: new           #101                // class kotlin/text/Regex
       3: dup
       4: ldc_w         #310                // String (\\d+)|[^.]
       7: invokespecial #311                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      10: putstatic     #97                 // Field PATTERN:Lkotlin/text/Regex;
      13: return
}


package day02

import java.io.File

fun main() {
    val data = parse("src/day02/Day02.txt")

    println("🎄 Day 02 🎄")

    println()

    println("[Part 1]")
    println("Answer: ${part1(data)}")

    println()

    println("[Part 2]")
    println("Answer: ${part2(data)}")
}

private data class CubeSet(
    val redCount: Int,
    val blueCount: Int,
    val greenCount: Int,
)

private data class Game(
    val id: Int,
    val sets: List<CubeSet>,
)

private val PATTERN = """(\d+) (red|blue|green)""".toRegex()

private fun String.toCubeSet(): CubeSet {
    val colors = PATTERN.findAll(this)
        .map { it.destructured }
        .associate { (count, color) -> color to count.toInt() }

    return CubeSet(
        colors.getOrDefault("red", 0),
        colors.getOrDefault("blue", 0),
        colors.getOrDefault("green", 0),
    )
}

private fun String.toGame(): Game {
    val parts = this
        .split(";", ":")
        .map(String::trim)

    val id = parts.first()
        .filter(Char::isDigit)
        .toInt()

    val sets = parts
        .drop(1)
        .map(String::toCubeSet)

    return Game(id, sets)
}

private fun parse(path: String): List<Game> =
    File(path)
        .readLines()
        .map(String::toGame)

private fun part1(data: List<Game>): Int =
    data.asSequence()
        .filter { (_, sets) -> sets.all { it.redCount <= 12 } }
        .filter { (_, sets) -> sets.all { it.blueCount <= 14 } }
        .filter { (_, sets) -> sets.all { it.greenCount <= 13 } }
        .sumOf(Game::id)

private fun part2(data: List<Game>): Int =
    data.sumOf { (_, sets) ->
        sets.maxOf(CubeSet::redCount) *
            sets.maxOf(CubeSet::blueCount) *
            sets.maxOf(CubeSet::greenCount)
    }

Compiled from "Day02.kt"
public final class day02.Day02Kt {
  private static final kotlin.text.Regex PATTERN;

  public static final void main();
    Code:
       0: ldc           #8                  // String src/day02/Day02.txt
       2: invokestatic  #12                 // Method parse:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: ldc           #14                 // String 🎄 Day 02 🎄
       8: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      11: swap
      12: invokevirtual #26                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      15: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      18: invokevirtual #28                 // Method java/io/PrintStream.println:()V
      21: ldc           #30                 // String [Part 1]
      23: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      26: swap
      27: invokevirtual #26                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      30: new           #32                 // class java/lang/StringBuilder
      33: dup
      34: invokespecial #35                 // Method java/lang/StringBuilder."<init>":()V
      37: ldc           #37                 // String Answer:
      39: invokevirtual #41                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      42: aload_0
      43: invokestatic  #45                 // Method part1:(Ljava/util/List;)I
      46: invokevirtual #48                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      49: invokevirtual #52                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      52: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      55: swap
      56: invokevirtual #26                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      59: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      62: invokevirtual #28                 // Method java/io/PrintStream.println:()V
      65: ldc           #54                 // String [Part 2]
      67: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      70: swap
      71: invokevirtual #26                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      74: new           #32                 // class java/lang/StringBuilder
      77: dup
      78: invokespecial #35                 // Method java/lang/StringBuilder."<init>":()V
      81: ldc           #37                 // String Answer:
      83: invokevirtual #41                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      86: aload_0
      87: invokestatic  #57                 // Method part2:(Ljava/util/List;)I
      90: invokevirtual #48                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      93: invokevirtual #52                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      96: getstatic     #20                 // Field java/lang/System.out:Ljava/io/PrintStream;
      99: swap
     100: invokevirtual #26                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     103: return

  private static final day02.CubeSet toCubeSet(java.lang.String);
    Code:
       0: getstatic     #65                 // Field PATTERN:Lkotlin/text/Regex;
       3: aload_0
       4: checkcast     #67                 // class java/lang/CharSequence
       7: iconst_0
       8: iconst_2
       9: aconst_null
      10: invokestatic  #73                 // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;
      13: invokedynamic #92,  0             // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      18: invokestatic  #98                 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      21: astore_2
      22: nop
      23: iconst_0
      24: istore_3
      25: aload_2
      26: astore        4
      28: new           #100                // class java/util/LinkedHashMap
      31: dup
      32: invokespecial #101                // Method java/util/LinkedHashMap."<init>":()V
      35: checkcast     #103                // class java/util/Map
      38: astore        5
      40: iconst_0
      41: istore        6
      43: aload         4
      45: invokeinterface #109,  1          // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
      50: astore        7
      52: aload         7
      54: invokeinterface #115,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      59: ifeq          163
      62: aload         7
      64: invokeinterface #119,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      69: astore        8
      71: aload         5
      73: astore        9
      75: aload         8
      77: checkcast     #121                // class kotlin/text/MatchResult$Destructured
      80: astore        10
      82: iconst_0
      83: istore        11
      85: aload         10
      87: invokevirtual #125                // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
      90: invokeinterface #131,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
      95: iconst_1
      96: invokeinterface #137,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     101: checkcast     #139                // class java/lang/String
     104: astore        12
     106: aload         10
     108: invokevirtual #125                // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     111: invokeinterface #131,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     116: iconst_2
     117: invokeinterface #137,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     122: checkcast     #139                // class java/lang/String
     125: astore        13
     127: aload         13
     129: aload         12
     131: invokestatic  #145                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     134: invokestatic  #149                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     137: invokestatic  #155                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     140: astore        10
     142: aload         9
     144: aload         10
     146: invokevirtual #160                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     149: aload         10
     151: invokevirtual #163                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     154: invokeinterface #167,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     159: pop
     160: goto          52
     163: aload         5
     165: nop
     166: astore_1
     167: new           #169                // class day02/CubeSet
     170: dup
     171: aload_1
     172: ldc           #171                // String red
     174: iconst_0
     175: invokestatic  #149                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     178: invokeinterface #174,  3          // InterfaceMethod java/util/Map.getOrDefault:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     183: checkcast     #176                // class java/lang/Number
     186: invokevirtual #180                // Method java/lang/Number.intValue:()I
     189: aload_1
     190: ldc           #182                // String blue
     192: iconst_0
     193: invokestatic  #149                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     196: invokeinterface #174,  3          // InterfaceMethod java/util/Map.getOrDefault:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     201: checkcast     #176                // class java/lang/Number
     204: invokevirtual #180                // Method java/lang/Number.intValue:()I
     207: aload_1
     208: ldc           #184                // String green
     210: iconst_0
     211: invokestatic  #149                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     214: invokeinterface #174,  3          // InterfaceMethod java/util/Map.getOrDefault:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     219: checkcast     #176                // class java/lang/Number
     222: invokevirtual #180                // Method java/lang/Number.intValue:()I
     225: invokespecial #187                // Method day02/CubeSet."<init>":(III)V
     228: areturn

  private static final day02.Game toGame(java.lang.String);
    Code:
       0: aload_0
       1: checkcast     #67                 // class java/lang/CharSequence
       4: iconst_2
       5: anewarray     #139                // class java/lang/String
       8: astore_2
       9: aload_2
      10: iconst_0
      11: ldc           #207                // String ;
      13: aastore
      14: aload_2
      15: iconst_1
      16: ldc           #209                // String :
      18: aastore
      19: aload_2
      20: iconst_0
      21: iconst_0
      22: bipush        6
      24: aconst_null
      25: invokestatic  #215                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      28: checkcast     #217                // class java/lang/Iterable
      31: astore_2
      32: nop
      33: iconst_0
      34: istore_3
      35: aload_2
      36: astore        4
      38: new           #219                // class java/util/ArrayList
      41: dup
      42: aload_2
      43: bipush        10
      45: invokestatic  #225                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      48: invokespecial #228                // Method java/util/ArrayList."<init>":(I)V
      51: checkcast     #230                // class java/util/Collection
      54: astore        5
      56: iconst_0
      57: istore        6
      59: aload         4
      61: invokeinterface #231,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      66: astore        7
      68: aload         7
      70: invokeinterface #115,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      75: ifeq          125
      78: aload         7
      80: invokeinterface #119,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      85: astore        8
      87: aload         5
      89: aload         8
      91: checkcast     #139                // class java/lang/String
      94: astore        9
      96: astore        13
      98: iconst_0
      99: istore        10
     101: aload         9
     103: checkcast     #67                 // class java/lang/CharSequence
     106: invokestatic  #235                // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     109: invokevirtual #236                // Method java/lang/Object.toString:()Ljava/lang/String;
     112: nop
     113: aload         13
     115: swap
     116: invokeinterface #240,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     121: pop
     122: goto          68
     125: aload         5
     127: checkcast     #133                // class java/util/List
     130: nop
     131: astore_1
     132: aload_1
     133: invokestatic  #244                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
     136: checkcast     #139                // class java/lang/String
     139: astore_3
     140: nop
     141: iconst_0
     142: istore        4
     144: aload_3
     145: checkcast     #67                 // class java/lang/CharSequence
     148: astore        5
     150: new           #32                 // class java/lang/StringBuilder
     153: dup
     154: invokespecial #35                 // Method java/lang/StringBuilder."<init>":()V
     157: checkcast     #246                // class java/lang/Appendable
     160: astore        6
     162: iconst_0
     163: istore        7
     165: iconst_0
     166: istore        8
     168: aload         5
     170: invokeinterface #249,  1          // InterfaceMethod java/lang/CharSequence.length:()I
     175: istore        9
     177: iload         8
     179: iload         9
     181: if_icmpge     227
     184: aload         5
     186: iload         8
     188: invokeinterface #253,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     193: istore        10
     195: iload         10
     197: istore        11
     199: iconst_0
     200: istore        12
     202: iload         11
     204: invokestatic  #259                // Method java/lang/Character.isDigit:(C)Z
     207: nop
     208: ifeq          221
     211: aload         6
     213: iload         10
     215: invokeinterface #262,  2          // InterfaceMethod java/lang/Appendable.append:(C)Ljava/lang/Appendable;
     220: pop
     221: iinc          8, 1
     224: goto          177
     227: aload         6
     229: checkcast     #32                 // class java/lang/StringBuilder
     232: invokevirtual #52                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     235: invokestatic  #145                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     238: istore_2
     239: aload_1
     240: checkcast     #217                // class java/lang/Iterable
     243: iconst_1
     244: invokestatic  #266                // Method kotlin/collections/CollectionsKt.drop:(Ljava/lang/Iterable;I)Ljava/util/List;
     247: checkcast     #217                // class java/lang/Iterable
     250: astore        4
     252: nop
     253: iconst_0
     254: istore        5
     256: aload         4
     258: astore        6
     260: new           #219                // class java/util/ArrayList
     263: dup
     264: aload         4
     266: bipush        10
     268: invokestatic  #225                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     271: invokespecial #228                // Method java/util/ArrayList."<init>":(I)V
     274: checkcast     #230                // class java/util/Collection
     277: astore        7
     279: iconst_0
     280: istore        8
     282: aload         6
     284: invokeinterface #231,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     289: astore        9
     291: aload         9
     293: invokeinterface #115,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     298: ifeq          341
     301: aload         9
     303: invokeinterface #119,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     308: astore        10
     310: aload         7
     312: aload         10
     314: checkcast     #139                // class java/lang/String
     317: astore        11
     319: astore        13
     321: iconst_0
     322: istore        12
     324: aload         11
     326: invokestatic  #268                // Method toCubeSet:(Ljava/lang/String;)Lday02/CubeSet;
     329: aload         13
     331: swap
     332: invokeinterface #240,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     337: pop
     338: goto          291
     341: aload         7
     343: checkcast     #133                // class java/util/List
     346: nop
     347: astore_3
     348: new           #270                // class day02/Game
     351: dup
     352: iload_2
     353: aload_3
     354: invokespecial #273                // Method day02/Game."<init>":(ILjava/util/List;)V
     357: areturn

  private static final java.util.List<day02.Game> parse(java.lang.String);
    Code:
       0: new           #299                // class java/io/File
       3: dup
       4: aload_0
       5: invokespecial #302                // Method java/io/File."<init>":(Ljava/lang/String;)V
       8: aconst_null
       9: iconst_1
      10: aconst_null
      11: invokestatic  #308                // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;
      14: checkcast     #217                // class java/lang/Iterable
      17: astore_1
      18: nop
      19: iconst_0
      20: istore_2
      21: aload_1
      22: astore_3
      23: new           #219                // class java/util/ArrayList
      26: dup
      27: aload_1
      28: bipush        10
      30: invokestatic  #225                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      33: invokespecial #228                // Method java/util/ArrayList."<init>":(I)V
      36: checkcast     #230                // class java/util/Collection
      39: astore        4
      41: iconst_0
      42: istore        5
      44: aload_3
      45: invokeinterface #231,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      50: astore        6
      52: aload         6
      54: invokeinterface #115,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      59: ifeq          102
      62: aload         6
      64: invokeinterface #119,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      69: astore        7
      71: aload         4
      73: aload         7
      75: checkcast     #139                // class java/lang/String
      78: astore        8
      80: astore        10
      82: iconst_0
      83: istore        9
      85: aload         8
      87: invokestatic  #310                // Method toGame:(Ljava/lang/String;)Lday02/Game;
      90: aload         10
      92: swap
      93: invokeinterface #240,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      98: pop
      99: goto          52
     102: aload         4
     104: checkcast     #133                // class java/util/List
     107: nop
     108: areturn

  private static final int part1(java.util.List<day02.Game>);
    Code:
       0: aload_0
       1: checkcast     #217                // class java/lang/Iterable
       4: invokestatic  #317                // Method kotlin/collections/CollectionsKt.asSequence:(Ljava/lang/Iterable;)Lkotlin/sequences/Sequence;
       7: invokedynamic #325,  0            // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function1;
      12: invokestatic  #328                // Method kotlin/sequences/SequencesKt.filter:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      15: invokedynamic #333,  0            // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function1;
      20: invokestatic  #328                // Method kotlin/sequences/SequencesKt.filter:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      23: invokedynamic #338,  0            // InvokeDynamic #3:invoke:()Lkotlin/jvm/functions/Function1;
      28: invokestatic  #328                // Method kotlin/sequences/SequencesKt.filter:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      31: astore_1
      32: iconst_0
      33: istore_2
      34: aload_1
      35: invokeinterface #109,  1          // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
      40: astore_3
      41: aload_3
      42: invokeinterface #115,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      47: ifeq          87
      50: aload_3
      51: invokeinterface #119,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      56: astore        4
      58: iload_2
      59: aload         4
      61: checkcast     #270                // class day02/Game
      64: astore        5
      66: istore        7
      68: iconst_0
      69: istore        6
      71: aload         5
      73: invokevirtual #341                // Method day02/Game.getId:()I
      76: istore        8
      78: iload         7
      80: iload         8
      82: iadd
      83: istore_2
      84: goto          41
      87: iload_2
      88: ireturn

  private static final int part2(java.util.List<day02.Game>);
    Code:
       0: aload_0
       1: checkcast     #217                // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: invokeinterface #231,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      13: astore_3
      14: aload_3
      15: invokeinterface #115,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      20: ifeq          389
      23: aload_3
      24: invokeinterface #119,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      29: astore        4
      31: iload_2
      32: aload         4
      34: checkcast     #270                // class day02/Game
      37: astore        5
      39: istore        15
      41: iconst_0
      42: istore        6
      44: aload         5
      46: invokevirtual #346                // Method day02/Game.component2:()Ljava/util/List;
      49: astore        7
      51: aload         7
      53: checkcast     #217                // class java/lang/Iterable
      56: invokeinterface #231,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      61: astore        8
      63: aload         8
      65: invokeinterface #115,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      70: ifne          81
      73: new           #348                // class java/util/NoSuchElementException
      76: dup
      77: invokespecial #349                // Method java/util/NoSuchElementException."<init>":()V
      80: athrow
      81: aload         8
      83: invokeinterface #119,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      88: checkcast     #169                // class day02/CubeSet
      91: astore        9
      93: iconst_0
      94: istore        10
      96: aload         9
      98: invokevirtual #352                // Method day02/CubeSet.getRedCount:()I
     101: istore        9
     103: aload         8
     105: invokeinterface #115,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     110: ifeq          149
     113: aload         8
     115: invokeinterface #119,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     120: checkcast     #169                // class day02/CubeSet
     123: astore        10
     125: iconst_0
     126: istore        11
     128: aload         10
     130: invokevirtual #352                // Method day02/CubeSet.getRedCount:()I
     133: istore        10
     135: iload         9
     137: iload         10
     139: if_icmpge     103
     142: iload         10
     144: istore        9
     146: goto          103
     149: iload         9
     151: aload         7
     153: checkcast     #217                // class java/lang/Iterable
     156: astore        12
     158: istore        13
     160: aload         12
     162: invokeinterface #231,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     167: astore        8
     169: aload         8
     171: invokeinterface #115,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     176: ifne          187
     179: new           #348                // class java/util/NoSuchElementException
     182: dup
     183: invokespecial #349                // Method java/util/NoSuchElementException."<init>":()V
     186: athrow
     187: aload         8
     189: invokeinterface #119,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     194: checkcast     #169                // class day02/CubeSet
     197: astore        9
     199: iconst_0
     200: istore        10
     202: aload         9
     204: invokevirtual #355                // Method day02/CubeSet.getBlueCount:()I
     207: istore        9
     209: aload         8
     211: invokeinterface #115,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     216: ifeq          255
     219: aload         8
     221: invokeinterface #119,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     226: checkcast     #169                // class day02/CubeSet
     229: astore        10
     231: iconst_0
     232: istore        11
     234: aload         10
     236: invokevirtual #355                // Method day02/CubeSet.getBlueCount:()I
     239: istore        10
     241: iload         9
     243: iload         10
     245: if_icmpge     209
     248: iload         10
     250: istore        9
     252: goto          209
     255: iload         9
     257: istore        14
     259: iload         13
     261: iload         14
     263: imul
     264: aload         7
     266: checkcast     #217                // class java/lang/Iterable
     269: astore        12
     271: istore        13
     273: aload         12
     275: invokeinterface #231,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     280: astore        8
     282: aload         8
     284: invokeinterface #115,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     289: ifne          300
     292: new           #348                // class java/util/NoSuchElementException
     295: dup
     296: invokespecial #349                // Method java/util/NoSuchElementException."<init>":()V
     299: athrow
     300: aload         8
     302: invokeinterface #119,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     307: checkcast     #169                // class day02/CubeSet
     310: astore        9
     312: iconst_0
     313: istore        10
     315: aload         9
     317: invokevirtual #358                // Method day02/CubeSet.getGreenCount:()I
     320: istore        9
     322: aload         8
     324: invokeinterface #115,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     329: ifeq          368
     332: aload         8
     334: invokeinterface #119,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     339: checkcast     #169                // class day02/CubeSet
     342: astore        10
     344: iconst_0
     345: istore        11
     347: aload         10
     349: invokevirtual #358                // Method day02/CubeSet.getGreenCount:()I
     352: istore        10
     354: iload         9
     356: iload         10
     358: if_icmpge     322
     361: iload         10
     363: istore        9
     365: goto          322
     368: iload         9
     370: istore        14
     372: iload         13
     374: iload         14
     376: imul
     377: nop
     378: istore        16
     380: iload         15
     382: iload         16
     384: iadd
     385: istore_2
     386: goto          14
     389: iload_2
     390: ireturn

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

  private static final kotlin.text.MatchResult$Destructured toCubeSet$lambda$0(kotlin.text.MatchResult);
    Code:
       0: aload_0
       1: ldc_w         #370                // String it
       4: invokestatic  #376                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: invokeinterface #380,  1          // InterfaceMethod kotlin/text/MatchResult.getDestructured:()Lkotlin/text/MatchResult$Destructured;
      13: areturn

  private static final boolean part1$lambda$6(day02.Game);
    Code:
       0: aload_0
       1: ldc_w         #383                // String <destruct>
       4: invokestatic  #376                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: invokevirtual #346                // Method day02/Game.component2:()Ljava/util/List;
      11: astore_1
      12: aload_1
      13: checkcast     #217                // class java/lang/Iterable
      16: astore_2
      17: iconst_0
      18: istore_3
      19: aload_2
      20: instanceof    #230                // class java/util/Collection
      23: ifeq          42
      26: aload_2
      27: checkcast     #230                // class java/util/Collection
      30: invokeinterface #386,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      35: ifeq          42
      38: iconst_1
      39: goto          102
      42: aload_2
      43: invokeinterface #231,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      48: astore        4
      50: aload         4
      52: invokeinterface #115,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      57: ifeq          101
      60: aload         4
      62: invokeinterface #119,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      67: astore        5
      69: aload         5
      71: checkcast     #169                // class day02/CubeSet
      74: astore        6
      76: iconst_0
      77: istore        7
      79: aload         6
      81: invokevirtual #352                // Method day02/CubeSet.getRedCount:()I
      84: bipush        12
      86: if_icmpgt     93
      89: iconst_1
      90: goto          94
      93: iconst_0
      94: ifne          50
      97: iconst_0
      98: goto          102
     101: iconst_1
     102: ireturn

  private static final boolean part1$lambda$8(day02.Game);
    Code:
       0: aload_0
       1: ldc_w         #383                // String <destruct>
       4: invokestatic  #376                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: invokevirtual #346                // Method day02/Game.component2:()Ljava/util/List;
      11: astore_1
      12: aload_1
      13: checkcast     #217                // class java/lang/Iterable
      16: astore_2
      17: iconst_0
      18: istore_3
      19: aload_2
      20: instanceof    #230                // class java/util/Collection
      23: ifeq          42
      26: aload_2
      27: checkcast     #230                // class java/util/Collection
      30: invokeinterface #386,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      35: ifeq          42
      38: iconst_1
      39: goto          102
      42: aload_2
      43: invokeinterface #231,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      48: astore        4
      50: aload         4
      52: invokeinterface #115,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      57: ifeq          101
      60: aload         4
      62: invokeinterface #119,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      67: astore        5
      69: aload         5
      71: checkcast     #169                // class day02/CubeSet
      74: astore        6
      76: iconst_0
      77: istore        7
      79: aload         6
      81: invokevirtual #355                // Method day02/CubeSet.getBlueCount:()I
      84: bipush        14
      86: if_icmpgt     93
      89: iconst_1
      90: goto          94
      93: iconst_0
      94: ifne          50
      97: iconst_0
      98: goto          102
     101: iconst_1
     102: ireturn

  private static final boolean part1$lambda$10(day02.Game);
    Code:
       0: aload_0
       1: ldc_w         #383                // String <destruct>
       4: invokestatic  #376                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: invokevirtual #346                // Method day02/Game.component2:()Ljava/util/List;
      11: astore_1
      12: aload_1
      13: checkcast     #217                // class java/lang/Iterable
      16: astore_2
      17: iconst_0
      18: istore_3
      19: aload_2
      20: instanceof    #230                // class java/util/Collection
      23: ifeq          42
      26: aload_2
      27: checkcast     #230                // class java/util/Collection
      30: invokeinterface #386,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      35: ifeq          42
      38: iconst_1
      39: goto          102
      42: aload_2
      43: invokeinterface #231,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      48: astore        4
      50: aload         4
      52: invokeinterface #115,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      57: ifeq          101
      60: aload         4
      62: invokeinterface #119,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      67: astore        5
      69: aload         5
      71: checkcast     #169                // class day02/CubeSet
      74: astore        6
      76: iconst_0
      77: istore        7
      79: aload         6
      81: invokevirtual #358                // Method day02/CubeSet.getGreenCount:()I
      84: bipush        13
      86: if_icmpgt     93
      89: iconst_1
      90: goto          94
      93: iconst_0
      94: ifne          50
      97: iconst_0
      98: goto          102
     101: iconst_1
     102: ireturn

  static {};
    Code:
       0: new           #69                 // class kotlin/text/Regex
       3: dup
       4: ldc_w         #395                // String (\\d+) (red|blue|green)
       7: invokespecial #396                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      10: putstatic     #65                 // Field PATTERN:Lkotlin/text/Regex;
      13: return
}