import java.math.BigInteger

object Puzzle16 {

    @JvmStatic
    fun main(args: Array<String>) {
        val input = Puzzle16::class.java.getResource("puzzle16.txt").readText()
        val ticketInfo = TicketInfo(input)
        println(ticketInfo.sumInvalidNumbers())
        println(ticketInfo.getProdOfDepartmentFields())
    }

    class TicketInfo(input: String) {
        private val rules: Rules
        private val myTicket: List<Int>
        private val otherTickets : List<List<Int>>

        init {
            val parts = input.split("\n\n")
            rules = Rules(parts.first().split("\n"))
            myTicket = parts[1].split("\n")[1].split(",").map(String::toInt)
            val ticketLines = parts.last().split("\n").drop(1)
            otherTickets = mutableListOf<List<Int>>()
            ticketLines.forEach { line ->
                otherTickets.add(line.split(",").map(String::toInt))
            }
        }
        fun sumInvalidNumbers(): Int{
            val invalidFields = rules.getInvalidData(otherTickets)
            return invalidFields.sum()
        }

        fun getProdOfDepartmentFields(): BigInteger{
            val validTickets = rules.getValidTickets(otherTickets)
            rules.findRuleFields(validTickets)
            return rules.getValuesForFields(myTicket, "departure").fold(BigInteger.ONE) { prod, element -> prod * element.toBigInteger() }
        }
    }

    private class Rules(lines: List<String>) {

        fun getValidTickets(ticketData: List<List<Int>>): List<List<Int>> {
            return ticketData.filterNot { ticket -> ticket.any { i -> inValid(i) } }
        }

        fun findRuleFields(ticketData: List<List<Int>>){
            val maxIndex = ticketData.first().lastIndex
            for (rule in rules) {
                for (fieldNumber in 0..maxIndex) {
                    if (ticketData.none { ticket -> rule.inValid(ticket[fieldNumber]) }){
                        rule.fieldNumbers.add(fieldNumber)
                    }
                }
            }

            while (rules.any { rule -> rule.fieldNumbers.size > 1 }){
                rules.filter { rule -> rule.fieldNumbers.size == 1 }.forEach { onlyRule ->
                    val fieldNumberToRemove = onlyRule.fieldNumbers.first()
                    rules.filter { rule -> rule.fieldNumbers.size > 1 && rule.fieldNumbers.contains(fieldNumberToRemove) }.forEach { removeSameFieldRule ->
                        removeSameFieldRule.fieldNumbers.remove(fieldNumberToRemove)
                    }
                }
            }
        }

        fun getInvalidData(ticketData: List<List<Int>>): List<Int> {
            val invalidData = mutableListOf<Int>()
            ticketData.forEach { ticket ->
                ticket.forEach { value ->
                    if (inValid(value)){
                        invalidData.add(value)
                    }
                }
            }

            return invalidData
        }

        private fun inValid(value: Int): Boolean {
            return rules.all { rule -> rule.inValid(value) }
        }

        fun getValuesForFields(myTicket: List<Int>, fieldStartsWith: String): List<Int> {
            return rules.filter { rule -> rule.name.startsWith(fieldStartsWith) }.map { rule -> myTicket[rule.fieldNumbers.first()] }
        }

        private data class Rule(val name: String, val ranges: List<Pair<Int, Int>>, var fieldNumbers: MutableList<Int>) {
            fun inValid(value: Int): Boolean {
                return ranges.all { range -> value < range.first || value > range.second }
            }
        }

        private val rules: MutableList<Rule> = mutableListOf()

        init {
            lines.forEach { line ->
                val nameAndRules = line.split(": ")
                val name = nameAndRules.first()
                val rulesString = nameAndRules.last().split(" or ")
                val rulesArray = rulesString.map { it -> Pair(it.split("-").first().toInt(), it.split("-").last().toInt()) }
                rules.add(Rule(name, rulesArray, mutableListOf()))
            }
        }

    }
}

Compiled from "Puzzle16.kt"
final class Puzzle16$Rules$Rule {
  private final java.lang.String name;

  private final java.util.List<kotlin.Pair<java.lang.Integer, java.lang.Integer>> ranges;

  private java.util.List<java.lang.Integer> fieldNumbers;

  public Puzzle16$Rules$Rule(java.lang.String, java.util.List<kotlin.Pair<java.lang.Integer, java.lang.Integer>>, java.util.List<java.lang.Integer>);
    Code:
       0: aload_1
       1: ldc           #10                 // String name
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #18                 // String ranges
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_3
      13: ldc           #20                 // String fieldNumbers
      15: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: aload_0
      19: invokespecial #23                 // Method java/lang/Object."<init>":()V
      22: aload_0
      23: aload_1
      24: putfield      #26                 // Field name:Ljava/lang/String;
      27: aload_0
      28: aload_2
      29: putfield      #29                 // Field ranges:Ljava/util/List;
      32: aload_0
      33: aload_3
      34: putfield      #31                 // Field fieldNumbers:Ljava/util/List;
      37: return

  public final java.lang.String getName();
    Code:
       0: aload_0
       1: getfield      #26                 // Field name:Ljava/lang/String;
       4: areturn

  public final java.util.List<kotlin.Pair<java.lang.Integer, java.lang.Integer>> getRanges();
    Code:
       0: aload_0
       1: getfield      #29                 // Field ranges:Ljava/util/List;
       4: areturn

  public final java.util.List<java.lang.Integer> getFieldNumbers();
    Code:
       0: aload_0
       1: getfield      #31                 // Field fieldNumbers:Ljava/util/List;
       4: areturn

  public final void setFieldNumbers(java.util.List<java.lang.Integer>);
    Code:
       0: aload_1
       1: ldc           #45                 // String <set-?>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: putfield      #31                 // Field fieldNumbers:Ljava/util/List;
      11: return

  public final boolean inValid(int);
    Code:
       0: aload_0
       1: getfield      #29                 // Field ranges:Ljava/util/List;
       4: checkcast     #49                 // class java/lang/Iterable
       7: astore_2
       8: iconst_0
       9: istore_3
      10: aload_2
      11: instanceof    #51                 // class java/util/Collection
      14: ifeq          33
      17: aload_2
      18: checkcast     #51                 // class java/util/Collection
      21: invokeinterface #55,  1           // InterfaceMethod java/util/Collection.isEmpty:()Z
      26: ifeq          33
      29: iconst_1
      30: goto          113
      33: aload_2
      34: invokeinterface #59,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      39: astore        4
      41: aload         4
      43: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      48: ifeq          112
      51: aload         4
      53: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      58: astore        5
      60: aload         5
      62: checkcast     #70                 // class kotlin/Pair
      65: astore        6
      67: iconst_0
      68: istore        7
      70: iload_1
      71: aload         6
      73: invokevirtual #73                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      76: checkcast     #75                 // class java/lang/Number
      79: invokevirtual #79                 // Method java/lang/Number.intValue:()I
      82: if_icmplt     100
      85: iload_1
      86: aload         6
      88: invokevirtual #82                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      91: checkcast     #75                 // class java/lang/Number
      94: invokevirtual #79                 // Method java/lang/Number.intValue:()I
      97: if_icmple     104
     100: iconst_1
     101: goto          105
     104: iconst_0
     105: ifne          41
     108: iconst_0
     109: goto          113
     112: iconst_1
     113: ireturn

  public final java.lang.String component1();
    Code:
       0: aload_0
       1: getfield      #26                 // Field name:Ljava/lang/String;
       4: areturn

  public final java.util.List<kotlin.Pair<java.lang.Integer, java.lang.Integer>> component2();
    Code:
       0: aload_0
       1: getfield      #29                 // Field ranges:Ljava/util/List;
       4: areturn

  public final java.util.List<java.lang.Integer> component3();
    Code:
       0: aload_0
       1: getfield      #31                 // Field fieldNumbers:Ljava/util/List;
       4: areturn

  public final Puzzle16$Rules$Rule copy(java.lang.String, java.util.List<kotlin.Pair<java.lang.Integer, java.lang.Integer>>, java.util.List<java.lang.Integer>);
    Code:
       0: aload_1
       1: ldc           #10                 // String name
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #18                 // String ranges
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_3
      13: ldc           #20                 // String fieldNumbers
      15: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: new           #2                  // class Puzzle16$Rules$Rule
      21: dup
      22: aload_1
      23: aload_2
      24: aload_3
      25: invokespecial #100                // Method "<init>":(Ljava/lang/String;Ljava/util/List;Ljava/util/List;)V
      28: areturn

  public static Puzzle16$Rules$Rule copy$default(Puzzle16$Rules$Rule, java.lang.String, java.util.List, java.util.List, int, java.lang.Object);
    Code:
       0: iload         4
       2: iconst_1
       3: iand
       4: ifeq          12
       7: aload_0
       8: getfield      #26                 // Field name:Ljava/lang/String;
      11: astore_1
      12: iload         4
      14: iconst_2
      15: iand
      16: ifeq          24
      19: aload_0
      20: getfield      #29                 // Field ranges:Ljava/util/List;
      23: astore_2
      24: iload         4
      26: iconst_4
      27: iand
      28: ifeq          36
      31: aload_0
      32: getfield      #31                 // Field fieldNumbers:Ljava/util/List;
      35: astore_3
      36: aload_0
      37: aload_1
      38: aload_2
      39: aload_3
      40: invokevirtual #104                // Method copy:(Ljava/lang/String;Ljava/util/List;Ljava/util/List;)LPuzzle16$Rules$Rule;
      43: areturn

  public java.lang.String toString();
    Code:
       0: new           #107                // class java/lang/StringBuilder
       3: dup
       4: invokespecial #108                // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #110                // String Rule(name=
       9: invokevirtual #114                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #26                 // Field name:Ljava/lang/String;
      16: invokevirtual #114                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      19: ldc           #116                // String , ranges=
      21: invokevirtual #114                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #29                 // Field ranges:Ljava/util/List;
      28: invokevirtual #119                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      31: ldc           #121                // String , fieldNumbers=
      33: invokevirtual #114                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      36: aload_0
      37: getfield      #31                 // Field fieldNumbers:Ljava/util/List;
      40: invokevirtual #119                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      43: bipush        41
      45: invokevirtual #124                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      48: invokevirtual #126                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      51: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #26                 // Field name:Ljava/lang/String;
       4: invokevirtual #131                // Method java/lang/String.hashCode:()I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #29                 // Field ranges:Ljava/util/List;
      16: invokevirtual #132                // Method java/lang/Object.hashCode:()I
      19: iadd
      20: istore_1
      21: iload_1
      22: bipush        31
      24: imul
      25: aload_0
      26: getfield      #31                 // Field fieldNumbers:Ljava/util/List;
      29: invokevirtual #132                // Method java/lang/Object.hashCode:()I
      32: iadd
      33: istore_1
      34: iload_1
      35: ireturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class Puzzle16$Rules$Rule
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Puzzle16$Rules$Rule
      20: astore_2
      21: aload_0
      22: getfield      #26                 // Field name:Ljava/lang/String;
      25: aload_2
      26: getfield      #26                 // Field name:Ljava/lang/String;
      29: invokestatic  #140                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      32: ifne          37
      35: iconst_0
      36: ireturn
      37: aload_0
      38: getfield      #29                 // Field ranges:Ljava/util/List;
      41: aload_2
      42: getfield      #29                 // Field ranges:Ljava/util/List;
      45: invokestatic  #140                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      48: ifne          53
      51: iconst_0
      52: ireturn
      53: aload_0
      54: getfield      #31                 // Field fieldNumbers:Ljava/util/List;
      57: aload_2
      58: getfield      #31                 // Field fieldNumbers:Ljava/util/List;
      61: invokestatic  #140                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      64: ifne          69
      67: iconst_0
      68: ireturn
      69: iconst_1
      70: ireturn
}

Compiled from "Puzzle16.kt"
public final class Puzzle16$TicketInfo {
  private final Puzzle16$Rules rules;

  private final java.util.List<java.lang.Integer> myTicket;

  private final java.util.List<java.util.List<java.lang.Integer>> otherTickets;

  public Puzzle16$TicketInfo(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #9                  // String input
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #18                 // Method java/lang/Object."<init>":()V
      10: nop
      11: aload_1
      12: checkcast     #20                 // class java/lang/CharSequence
      15: iconst_1
      16: anewarray     #22                 // class java/lang/String
      19: astore_3
      20: aload_3
      21: iconst_0
      22: ldc           #24                 // String \n\n
      24: aastore
      25: aload_3
      26: iconst_0
      27: iconst_0
      28: bipush        6
      30: aconst_null
      31: invokestatic  #30                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      34: astore_2
      35: aload_0
      36: new           #32                 // class Puzzle16$Rules
      39: dup
      40: aload_2
      41: invokestatic  #38                 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
      44: checkcast     #20                 // class java/lang/CharSequence
      47: iconst_1
      48: anewarray     #22                 // class java/lang/String
      51: astore_3
      52: aload_3
      53: iconst_0
      54: ldc           #40                 // String \n
      56: aastore
      57: aload_3
      58: iconst_0
      59: iconst_0
      60: bipush        6
      62: aconst_null
      63: invokestatic  #30                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      66: invokespecial #43                 // Method Puzzle16$Rules."<init>":(Ljava/util/List;)V
      69: putfield      #47                 // Field rules:LPuzzle16$Rules;
      72: aload_0
      73: aload_2
      74: iconst_1
      75: invokeinterface #53,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      80: checkcast     #20                 // class java/lang/CharSequence
      83: iconst_1
      84: anewarray     #22                 // class java/lang/String
      87: astore_3
      88: aload_3
      89: iconst_0
      90: ldc           #40                 // String \n
      92: aastore
      93: aload_3
      94: iconst_0
      95: iconst_0
      96: bipush        6
      98: aconst_null
      99: invokestatic  #30                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     102: iconst_1
     103: invokeinterface #53,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     108: checkcast     #20                 // class java/lang/CharSequence
     111: iconst_1
     112: anewarray     #22                 // class java/lang/String
     115: astore_3
     116: aload_3
     117: iconst_0
     118: ldc           #55                 // String ,
     120: aastore
     121: aload_3
     122: iconst_0
     123: iconst_0
     124: bipush        6
     126: aconst_null
     127: invokestatic  #30                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     130: checkcast     #57                 // class java/lang/Iterable
     133: astore_3
     134: astore        21
     136: iconst_0
     137: istore        4
     139: aload_3
     140: astore        5
     142: new           #59                 // class java/util/ArrayList
     145: dup
     146: aload_3
     147: bipush        10
     149: invokestatic  #63                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     152: invokespecial #66                 // Method java/util/ArrayList."<init>":(I)V
     155: checkcast     #68                 // class java/util/Collection
     158: astore        6
     160: iconst_0
     161: istore        7
     163: aload         5
     165: invokeinterface #72,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     170: astore        8
     172: aload         8
     174: invokeinterface #78,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     179: ifeq          226
     182: aload         8
     184: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     189: astore        9
     191: aload         6
     193: aload         9
     195: checkcast     #22                 // class java/lang/String
     198: astore        10
     200: astore        22
     202: iconst_0
     203: istore        11
     205: aload         10
     207: invokestatic  #88                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     210: nop
     211: invokestatic  #92                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     214: aload         22
     216: swap
     217: invokeinterface #96,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     222: pop
     223: goto          172
     226: aload         6
     228: checkcast     #49                 // class java/util/List
     231: nop
     232: aload         21
     234: swap
     235: putfield      #100                // Field myTicket:Ljava/util/List;
     238: aload_2
     239: invokestatic  #103                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     242: checkcast     #20                 // class java/lang/CharSequence
     245: iconst_1
     246: anewarray     #22                 // class java/lang/String
     249: astore        4
     251: aload         4
     253: iconst_0
     254: ldc           #40                 // String \n
     256: aastore
     257: aload         4
     259: iconst_0
     260: iconst_0
     261: bipush        6
     263: aconst_null
     264: invokestatic  #30                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     267: checkcast     #57                 // class java/lang/Iterable
     270: iconst_1
     271: invokestatic  #107                // Method kotlin/collections/CollectionsKt.drop:(Ljava/lang/Iterable;I)Ljava/util/List;
     274: astore_3
     275: aload_0
     276: new           #59                 // class java/util/ArrayList
     279: dup
     280: invokespecial #108                // Method java/util/ArrayList."<init>":()V
     283: checkcast     #49                 // class java/util/List
     286: putfield      #111                // Field otherTickets:Ljava/util/List;
     289: aload_3
     290: checkcast     #57                 // class java/lang/Iterable
     293: astore        4
     295: iconst_0
     296: istore        5
     298: aload         4
     300: invokeinterface #72,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     305: astore        6
     307: aload         6
     309: invokeinterface #78,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     314: ifeq          486
     317: aload         6
     319: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     324: astore        7
     326: aload         7
     328: checkcast     #22                 // class java/lang/String
     331: astore        8
     333: iconst_0
     334: istore        9
     336: aload_0
     337: getfield      #111                // Field otherTickets:Ljava/util/List;
     340: aload         8
     342: checkcast     #20                 // class java/lang/CharSequence
     345: iconst_1
     346: anewarray     #22                 // class java/lang/String
     349: astore        10
     351: aload         10
     353: iconst_0
     354: ldc           #55                 // String ,
     356: aastore
     357: aload         10
     359: iconst_0
     360: iconst_0
     361: bipush        6
     363: aconst_null
     364: invokestatic  #30                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     367: checkcast     #57                 // class java/lang/Iterable
     370: astore        10
     372: astore        11
     374: iconst_0
     375: istore        12
     377: aload         10
     379: astore        13
     381: new           #59                 // class java/util/ArrayList
     384: dup
     385: aload         10
     387: bipush        10
     389: invokestatic  #63                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     392: invokespecial #66                 // Method java/util/ArrayList."<init>":(I)V
     395: checkcast     #68                 // class java/util/Collection
     398: astore        14
     400: iconst_0
     401: istore        15
     403: aload         13
     405: invokeinterface #72,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     410: astore        16
     412: aload         16
     414: invokeinterface #78,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     419: ifeq          466
     422: aload         16
     424: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     429: astore        17
     431: aload         14
     433: aload         17
     435: checkcast     #22                 // class java/lang/String
     438: astore        18
     440: astore        19
     442: iconst_0
     443: istore        20
     445: aload         18
     447: invokestatic  #88                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     450: nop
     451: invokestatic  #92                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     454: aload         19
     456: swap
     457: invokeinterface #96,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     462: pop
     463: goto          412
     466: aload         14
     468: checkcast     #49                 // class java/util/List
     471: nop
     472: aload         11
     474: swap
     475: invokeinterface #112,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     480: pop
     481: nop
     482: nop
     483: goto          307
     486: nop
     487: nop
     488: return

  public final int sumInvalidNumbers();
    Code:
       0: aload_0
       1: getfield      #47                 // Field rules:LPuzzle16$Rules;
       4: aload_0
       5: getfield      #111                // Field otherTickets:Ljava/util/List;
       8: invokevirtual #141                // Method Puzzle16$Rules.getInvalidData:(Ljava/util/List;)Ljava/util/List;
      11: astore_1
      12: aload_1
      13: checkcast     #57                 // class java/lang/Iterable
      16: invokestatic  #145                // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
      19: ireturn

  public final java.math.BigInteger getProdOfDepartmentFields();
    Code:
       0: aload_0
       1: getfield      #47                 // Field rules:LPuzzle16$Rules;
       4: aload_0
       5: getfield      #111                // Field otherTickets:Ljava/util/List;
       8: invokevirtual #151                // Method Puzzle16$Rules.getValidTickets:(Ljava/util/List;)Ljava/util/List;
      11: astore_1
      12: aload_0
      13: getfield      #47                 // Field rules:LPuzzle16$Rules;
      16: aload_1
      17: invokevirtual #154                // Method Puzzle16$Rules.findRuleFields:(Ljava/util/List;)V
      20: aload_0
      21: getfield      #47                 // Field rules:LPuzzle16$Rules;
      24: aload_0
      25: getfield      #100                // Field myTicket:Ljava/util/List;
      28: ldc           #156                // String departure
      30: invokevirtual #160                // Method Puzzle16$Rules.getValuesForFields:(Ljava/util/List;Ljava/lang/String;)Ljava/util/List;
      33: checkcast     #57                 // class java/lang/Iterable
      36: astore_2
      37: getstatic     #166                // Field java/math/BigInteger.ONE:Ljava/math/BigInteger;
      40: astore_3
      41: iconst_0
      42: istore        4
      44: aload_3
      45: astore        5
      47: aload_2
      48: invokeinterface #72,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      53: astore        6
      55: aload         6
      57: invokeinterface #78,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      62: ifeq          126
      65: aload         6
      67: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      72: astore        7
      74: aload         5
      76: aload         7
      78: checkcast     #168                // class java/lang/Number
      81: invokevirtual #171                // Method java/lang/Number.intValue:()I
      84: istore        8
      86: astore        9
      88: iconst_0
      89: istore        10
      91: nop
      92: aload         9
      94: invokestatic  #175                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      97: aload         9
      99: iload         8
     101: i2l
     102: invokestatic  #178                // Method java/math/BigInteger.valueOf:(J)Ljava/math/BigInteger;
     105: dup
     106: ldc           #180                // String valueOf(...)
     108: invokestatic  #183                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     111: invokevirtual #187                // Method java/math/BigInteger.multiply:(Ljava/math/BigInteger;)Ljava/math/BigInteger;
     114: dup
     115: ldc           #189                // String multiply(...)
     117: invokestatic  #183                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     120: nop
     121: astore        5
     123: goto          55
     126: aload         5
     128: dup
     129: ldc           #191                // String fold(...)
     131: invokestatic  #183                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     134: areturn
}

Compiled from "Puzzle16.kt"
final class Puzzle16$Rules {
  private final java.util.List<Puzzle16$Rules$Rule> rules;

  public Puzzle16$Rules(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #10                 // String lines
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #19                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: new           #21                 // class java/util/ArrayList
      14: dup
      15: invokespecial #22                 // Method java/util/ArrayList."<init>":()V
      18: checkcast     #24                 // class java/util/List
      21: putfield      #28                 // Field rules:Ljava/util/List;
      24: nop
      25: aload_1
      26: checkcast     #30                 // class java/lang/Iterable
      29: astore_2
      30: iconst_0
      31: istore_3
      32: aload_2
      33: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      38: astore        4
      40: aload         4
      42: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      47: ifeq          359
      50: aload         4
      52: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      57: astore        5
      59: aload         5
      61: checkcast     #46                 // class java/lang/String
      64: astore        6
      66: iconst_0
      67: istore        7
      69: aload         6
      71: checkcast     #48                 // class java/lang/CharSequence
      74: iconst_1
      75: anewarray     #46                 // class java/lang/String
      78: astore        8
      80: aload         8
      82: iconst_0
      83: ldc           #50                 // String :
      85: aastore
      86: aload         8
      88: iconst_0
      89: iconst_0
      90: bipush        6
      92: aconst_null
      93: invokestatic  #56                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      96: astore        9
      98: aload         9
     100: invokestatic  #62                 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
     103: checkcast     #46                 // class java/lang/String
     106: astore        8
     108: aload         9
     110: invokestatic  #65                 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     113: checkcast     #48                 // class java/lang/CharSequence
     116: iconst_1
     117: anewarray     #46                 // class java/lang/String
     120: astore        10
     122: aload         10
     124: iconst_0
     125: ldc           #67                 // String  or
     127: aastore
     128: aload         10
     130: iconst_0
     131: iconst_0
     132: bipush        6
     134: aconst_null
     135: invokestatic  #56                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     138: astore        11
     140: aload         11
     142: checkcast     #30                 // class java/lang/Iterable
     145: astore        12
     147: iconst_0
     148: istore        13
     150: aload         12
     152: astore        14
     154: new           #21                 // class java/util/ArrayList
     157: dup
     158: aload         12
     160: bipush        10
     162: invokestatic  #71                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     165: invokespecial #74                 // Method java/util/ArrayList."<init>":(I)V
     168: checkcast     #76                 // class java/util/Collection
     171: astore        15
     173: iconst_0
     174: istore        16
     176: aload         14
     178: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     183: astore        17
     185: aload         17
     187: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     192: ifeq          315
     195: aload         17
     197: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     202: astore        18
     204: aload         15
     206: aload         18
     208: checkcast     #46                 // class java/lang/String
     211: astore        19
     213: astore        20
     215: iconst_0
     216: istore        21
     218: new           #78                 // class kotlin/Pair
     221: dup
     222: aload         19
     224: checkcast     #48                 // class java/lang/CharSequence
     227: iconst_1
     228: anewarray     #46                 // class java/lang/String
     231: astore        22
     233: aload         22
     235: iconst_0
     236: ldc           #80                 // String -
     238: aastore
     239: aload         22
     241: iconst_0
     242: iconst_0
     243: bipush        6
     245: aconst_null
     246: invokestatic  #56                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     249: invokestatic  #62                 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
     252: checkcast     #46                 // class java/lang/String
     255: invokestatic  #86                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     258: invokestatic  #90                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     261: aload         19
     263: checkcast     #48                 // class java/lang/CharSequence
     266: iconst_1
     267: anewarray     #46                 // class java/lang/String
     270: astore        22
     272: aload         22
     274: iconst_0
     275: ldc           #80                 // String -
     277: aastore
     278: aload         22
     280: iconst_0
     281: iconst_0
     282: bipush        6
     284: aconst_null
     285: invokestatic  #56                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     288: invokestatic  #65                 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     291: checkcast     #46                 // class java/lang/String
     294: invokestatic  #86                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     297: invokestatic  #90                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     300: invokespecial #93                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     303: aload         20
     305: swap
     306: invokeinterface #97,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     311: pop
     312: goto          185
     315: aload         15
     317: checkcast     #24                 // class java/util/List
     320: nop
     321: astore        10
     323: aload_0
     324: getfield      #28                 // Field rules:Ljava/util/List;
     327: new           #99                 // class Puzzle16$Rules$Rule
     330: dup
     331: aload         8
     333: aload         10
     335: new           #21                 // class java/util/ArrayList
     338: dup
     339: invokespecial #22                 // Method java/util/ArrayList."<init>":()V
     342: checkcast     #24                 // class java/util/List
     345: invokespecial #102                // Method Puzzle16$Rules$Rule."<init>":(Ljava/lang/String;Ljava/util/List;Ljava/util/List;)V
     348: invokeinterface #103,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     353: pop
     354: nop
     355: nop
     356: goto          40
     359: nop
     360: nop
     361: return

  public final java.util.List<java.util.List<java.lang.Integer>> getValidTickets(java.util.List<? extends java.util.List<java.lang.Integer>>);
    Code:
       0: aload_1
       1: ldc           #134                // String ticketData
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #30                 // class java/lang/Iterable
      10: astore_2
      11: iconst_0
      12: istore_3
      13: aload_2
      14: astore        4
      16: new           #21                 // class java/util/ArrayList
      19: dup
      20: invokespecial #22                 // Method java/util/ArrayList."<init>":()V
      23: checkcast     #76                 // class java/util/Collection
      26: astore        5
      28: iconst_0
      29: istore        6
      31: aload         4
      33: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      38: astore        7
      40: aload         7
      42: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      47: ifeq          176
      50: aload         7
      52: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      57: astore        8
      59: aload         8
      61: checkcast     #24                 // class java/util/List
      64: astore        9
      66: iconst_0
      67: istore        10
      69: aload         9
      71: checkcast     #30                 // class java/lang/Iterable
      74: astore        11
      76: iconst_0
      77: istore        12
      79: aload         11
      81: instanceof    #76                 // class java/util/Collection
      84: ifeq          104
      87: aload         11
      89: checkcast     #76                 // class java/util/Collection
      92: invokeinterface #137,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      97: ifeq          104
     100: iconst_0
     101: goto          159
     104: aload         11
     106: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     111: astore        13
     113: aload         13
     115: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     120: ifeq          158
     123: aload         13
     125: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     130: astore        14
     132: aload         14
     134: checkcast     #139                // class java/lang/Number
     137: invokevirtual #143                // Method java/lang/Number.intValue:()I
     140: istore        15
     142: iconst_0
     143: istore        16
     145: aload_0
     146: iload         15
     148: invokespecial #147                // Method inValid:(I)Z
     151: ifeq          113
     154: iconst_1
     155: goto          159
     158: iconst_0
     159: nop
     160: ifne          40
     163: aload         5
     165: aload         8
     167: invokeinterface #97,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     172: pop
     173: goto          40
     176: aload         5
     178: checkcast     #24                 // class java/util/List
     181: nop
     182: areturn

  public final void findRuleFields(java.util.List<? extends java.util.List<java.lang.Integer>>);
    Code:
       0: aload_1
       1: ldc           #134                // String ticketData
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: invokestatic  #62                 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
      10: checkcast     #24                 // class java/util/List
      13: invokestatic  #164                // Method kotlin/collections/CollectionsKt.getLastIndex:(Ljava/util/List;)I
      16: istore_2
      17: aload_0
      18: getfield      #28                 // Field rules:Ljava/util/List;
      21: invokeinterface #165,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
      26: astore_3
      27: aload_3
      28: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      33: ifeq          187
      36: aload_3
      37: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      42: checkcast     #99                 // class Puzzle16$Rules$Rule
      45: astore        4
      47: iconst_0
      48: istore        5
      50: iload         5
      52: iload_2
      53: if_icmpgt     27
      56: aload_1
      57: checkcast     #30                 // class java/lang/Iterable
      60: astore        6
      62: iconst_0
      63: istore        7
      65: aload         6
      67: instanceof    #76                 // class java/util/Collection
      70: ifeq          90
      73: aload         6
      75: checkcast     #76                 // class java/util/Collection
      78: invokeinterface #137,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      83: ifeq          90
      86: iconst_1
      87: goto          156
      90: aload         6
      92: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      97: astore        8
      99: aload         8
     101: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     106: ifeq          155
     109: aload         8
     111: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     116: astore        9
     118: aload         9
     120: checkcast     #24                 // class java/util/List
     123: astore        10
     125: iconst_0
     126: istore        11
     128: aload         4
     130: aload         10
     132: iload         5
     134: invokeinterface #169,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     139: checkcast     #139                // class java/lang/Number
     142: invokevirtual #143                // Method java/lang/Number.intValue:()I
     145: invokevirtual #170                // Method Puzzle16$Rules$Rule.inValid:(I)Z
     148: ifeq          99
     151: iconst_0
     152: goto          156
     155: iconst_1
     156: ifeq          175
     159: aload         4
     161: invokevirtual #174                // Method Puzzle16$Rules$Rule.getFieldNumbers:()Ljava/util/List;
     164: iload         5
     166: invokestatic  #90                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     169: invokeinterface #103,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     174: pop
     175: iload         5
     177: iload_2
     178: if_icmpeq     27
     181: iinc          5, 1
     184: goto          56
     187: aload_0
     188: getfield      #28                 // Field rules:Ljava/util/List;
     191: checkcast     #30                 // class java/lang/Iterable
     194: astore_3
     195: iconst_0
     196: istore        4
     198: aload_3
     199: instanceof    #76                 // class java/util/Collection
     202: ifeq          221
     205: aload_3
     206: checkcast     #76                 // class java/util/Collection
     209: invokeinterface #137,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
     214: ifeq          221
     217: iconst_0
     218: goto          285
     221: aload_3
     222: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     227: astore        5
     229: aload         5
     231: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     236: ifeq          284
     239: aload         5
     241: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     246: astore        6
     248: aload         6
     250: checkcast     #99                 // class Puzzle16$Rules$Rule
     253: astore        7
     255: iconst_0
     256: istore        8
     258: aload         7
     260: invokevirtual #174                // Method Puzzle16$Rules$Rule.getFieldNumbers:()Ljava/util/List;
     263: invokeinterface #177,  1          // InterfaceMethod java/util/List.size:()I
     268: iconst_1
     269: if_icmple     276
     272: iconst_1
     273: goto          277
     276: iconst_0
     277: ifeq          229
     280: iconst_1
     281: goto          285
     284: iconst_0
     285: ifeq          663
     288: aload_0
     289: getfield      #28                 // Field rules:Ljava/util/List;
     292: checkcast     #30                 // class java/lang/Iterable
     295: astore_3
     296: iconst_0
     297: istore        4
     299: aload_3
     300: astore        5
     302: new           #21                 // class java/util/ArrayList
     305: dup
     306: invokespecial #22                 // Method java/util/ArrayList."<init>":()V
     309: checkcast     #76                 // class java/util/Collection
     312: astore        6
     314: iconst_0
     315: istore        7
     317: aload         5
     319: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     324: astore        8
     326: aload         8
     328: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     333: ifeq          390
     336: aload         8
     338: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     343: astore        9
     345: aload         9
     347: checkcast     #99                 // class Puzzle16$Rules$Rule
     350: astore        10
     352: iconst_0
     353: istore        11
     355: aload         10
     357: invokevirtual #174                // Method Puzzle16$Rules$Rule.getFieldNumbers:()Ljava/util/List;
     360: invokeinterface #177,  1          // InterfaceMethod java/util/List.size:()I
     365: iconst_1
     366: if_icmpne     373
     369: iconst_1
     370: goto          374
     373: iconst_0
     374: ifeq          326
     377: aload         6
     379: aload         9
     381: invokeinterface #97,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     386: pop
     387: goto          326
     390: aload         6
     392: checkcast     #24                 // class java/util/List
     395: nop
     396: checkcast     #30                 // class java/lang/Iterable
     399: astore_3
     400: nop
     401: iconst_0
     402: istore        4
     404: aload_3
     405: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     410: astore        5
     412: aload         5
     414: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     419: ifeq          659
     422: aload         5
     424: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     429: astore        6
     431: aload         6
     433: checkcast     #99                 // class Puzzle16$Rules$Rule
     436: astore        7
     438: iconst_0
     439: istore        8
     441: aload         7
     443: invokevirtual #174                // Method Puzzle16$Rules$Rule.getFieldNumbers:()Ljava/util/List;
     446: invokestatic  #62                 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
     449: checkcast     #139                // class java/lang/Number
     452: invokevirtual #143                // Method java/lang/Number.intValue:()I
     455: istore        9
     457: aload_0
     458: getfield      #28                 // Field rules:Ljava/util/List;
     461: checkcast     #30                 // class java/lang/Iterable
     464: astore        10
     466: iconst_0
     467: istore        11
     469: aload         10
     471: astore        12
     473: new           #21                 // class java/util/ArrayList
     476: dup
     477: invokespecial #22                 // Method java/util/ArrayList."<init>":()V
     480: checkcast     #76                 // class java/util/Collection
     483: astore        13
     485: iconst_0
     486: istore        14
     488: aload         12
     490: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     495: astore        15
     497: aload         15
     499: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     504: ifeq          579
     507: aload         15
     509: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     514: astore        16
     516: aload         16
     518: checkcast     #99                 // class Puzzle16$Rules$Rule
     521: astore        17
     523: iconst_0
     524: istore        18
     526: aload         17
     528: invokevirtual #174                // Method Puzzle16$Rules$Rule.getFieldNumbers:()Ljava/util/List;
     531: invokeinterface #177,  1          // InterfaceMethod java/util/List.size:()I
     536: iconst_1
     537: if_icmple     562
     540: aload         17
     542: invokevirtual #174                // Method Puzzle16$Rules$Rule.getFieldNumbers:()Ljava/util/List;
     545: iload         9
     547: invokestatic  #90                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     550: invokeinterface #180,  2          // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
     555: ifeq          562
     558: iconst_1
     559: goto          563
     562: iconst_0
     563: ifeq          497
     566: aload         13
     568: aload         16
     570: invokeinterface #97,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     575: pop
     576: goto          497
     579: aload         13
     581: checkcast     #24                 // class java/util/List
     584: nop
     585: checkcast     #30                 // class java/lang/Iterable
     588: astore        10
     590: nop
     591: iconst_0
     592: istore        11
     594: aload         10
     596: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     601: astore        12
     603: aload         12
     605: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     610: ifeq          653
     613: aload         12
     615: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     620: astore        13
     622: aload         13
     624: checkcast     #99                 // class Puzzle16$Rules$Rule
     627: astore        14
     629: iconst_0
     630: istore        15
     632: aload         14
     634: invokevirtual #174                // Method Puzzle16$Rules$Rule.getFieldNumbers:()Ljava/util/List;
     637: iload         9
     639: invokestatic  #90                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     642: invokeinterface #183,  2          // InterfaceMethod java/util/List.remove:(Ljava/lang/Object;)Z
     647: pop
     648: nop
     649: nop
     650: goto          603
     653: nop
     654: nop
     655: nop
     656: goto          412
     659: nop
     660: goto          187
     663: return

  public final java.util.List<java.lang.Integer> getInvalidData(java.util.List<? extends java.util.List<java.lang.Integer>>);
    Code:
       0: aload_1
       1: ldc           #134                // String ticketData
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #21                 // class java/util/ArrayList
       9: dup
      10: invokespecial #22                 // Method java/util/ArrayList."<init>":()V
      13: checkcast     #24                 // class java/util/List
      16: astore_2
      17: aload_1
      18: checkcast     #30                 // class java/lang/Iterable
      21: astore_3
      22: iconst_0
      23: istore        4
      25: aload_3
      26: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      31: astore        5
      33: aload         5
      35: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      40: ifeq          145
      43: aload         5
      45: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      50: astore        6
      52: aload         6
      54: checkcast     #24                 // class java/util/List
      57: astore        7
      59: iconst_0
      60: istore        8
      62: aload         7
      64: checkcast     #30                 // class java/lang/Iterable
      67: astore        9
      69: iconst_0
      70: istore        10
      72: aload         9
      74: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      79: astore        11
      81: aload         11
      83: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      88: ifeq          139
      91: aload         11
      93: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      98: astore        12
     100: aload         12
     102: checkcast     #139                // class java/lang/Number
     105: invokevirtual #143                // Method java/lang/Number.intValue:()I
     108: istore        13
     110: iconst_0
     111: istore        14
     113: aload_0
     114: iload         13
     116: invokespecial #147                // Method inValid:(I)Z
     119: ifeq          134
     122: aload_2
     123: iload         13
     125: invokestatic  #90                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     128: invokeinterface #103,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     133: pop
     134: nop
     135: nop
     136: goto          81
     139: nop
     140: nop
     141: nop
     142: goto          33
     145: nop
     146: aload_2
     147: areturn

  private final boolean inValid(int);
    Code:
       0: aload_0
       1: getfield      #28                 // Field rules:Ljava/util/List;
       4: checkcast     #30                 // class java/lang/Iterable
       7: astore_2
       8: iconst_0
       9: istore_3
      10: aload_2
      11: instanceof    #76                 // class java/util/Collection
      14: ifeq          33
      17: aload_2
      18: checkcast     #76                 // class java/util/Collection
      21: invokeinterface #137,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      26: ifeq          33
      29: iconst_1
      30: goto          84
      33: aload_2
      34: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      39: astore        4
      41: aload         4
      43: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      48: ifeq          83
      51: aload         4
      53: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      58: astore        5
      60: aload         5
      62: checkcast     #99                 // class Puzzle16$Rules$Rule
      65: astore        6
      67: iconst_0
      68: istore        7
      70: aload         6
      72: iload_1
      73: invokevirtual #170                // Method Puzzle16$Rules$Rule.inValid:(I)Z
      76: ifne          41
      79: iconst_0
      80: goto          84
      83: iconst_1
      84: ireturn

  public final java.util.List<java.lang.Integer> getValuesForFields(java.util.List<java.lang.Integer>, java.lang.String);
    Code:
       0: aload_1
       1: ldc           #216                // String myTicket
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #218                // String fieldStartsWith
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: getfield      #28                 // Field rules:Ljava/util/List;
      16: checkcast     #30                 // class java/lang/Iterable
      19: astore_3
      20: iconst_0
      21: istore        4
      23: aload_3
      24: astore        5
      26: new           #21                 // class java/util/ArrayList
      29: dup
      30: invokespecial #22                 // Method java/util/ArrayList."<init>":()V
      33: checkcast     #76                 // class java/util/Collection
      36: astore        6
      38: iconst_0
      39: istore        7
      41: aload         5
      43: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      48: astore        8
      50: aload         8
      52: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      57: ifeq          107
      60: aload         8
      62: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      67: astore        9
      69: aload         9
      71: checkcast     #99                 // class Puzzle16$Rules$Rule
      74: astore        10
      76: iconst_0
      77: istore        11
      79: aload         10
      81: invokevirtual #222                // Method Puzzle16$Rules$Rule.getName:()Ljava/lang/String;
      84: aload_2
      85: iconst_0
      86: iconst_2
      87: aconst_null
      88: invokestatic  #226                // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
      91: ifeq          50
      94: aload         6
      96: aload         9
      98: invokeinterface #97,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     103: pop
     104: goto          50
     107: aload         6
     109: checkcast     #24                 // class java/util/List
     112: nop
     113: checkcast     #30                 // class java/lang/Iterable
     116: astore_3
     117: nop
     118: iconst_0
     119: istore        4
     121: aload_3
     122: astore        5
     124: new           #21                 // class java/util/ArrayList
     127: dup
     128: aload_3
     129: bipush        10
     131: invokestatic  #71                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     134: invokespecial #74                 // Method java/util/ArrayList."<init>":(I)V
     137: checkcast     #76                 // class java/util/Collection
     140: astore        6
     142: iconst_0
     143: istore        7
     145: aload         5
     147: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     152: astore        8
     154: aload         8
     156: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     161: ifeq          228
     164: aload         8
     166: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     171: astore        9
     173: aload         6
     175: aload         9
     177: checkcast     #99                 // class Puzzle16$Rules$Rule
     180: astore        10
     182: astore        12
     184: iconst_0
     185: istore        11
     187: aload_1
     188: aload         10
     190: invokevirtual #174                // Method Puzzle16$Rules$Rule.getFieldNumbers:()Ljava/util/List;
     193: invokestatic  #62                 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
     196: checkcast     #139                // class java/lang/Number
     199: invokevirtual #143                // Method java/lang/Number.intValue:()I
     202: invokeinterface #169,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     207: checkcast     #139                // class java/lang/Number
     210: invokevirtual #143                // Method java/lang/Number.intValue:()I
     213: invokestatic  #90                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     216: aload         12
     218: swap
     219: invokeinterface #97,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     224: pop
     225: goto          154
     228: aload         6
     230: checkcast     #24                 // class java/util/List
     233: nop
     234: areturn
}

Compiled from "Puzzle16.kt"
public final class Puzzle16 {
  public static final Puzzle16 INSTANCE;

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

  public static final void main(java.lang.String[]);
    Code:
       0: aload_0
       1: ldc           #16                 // String args
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: ldc           #2                  // class Puzzle16
       8: ldc           #24                 // String puzzle16.txt
      10: invokevirtual #30                 // Method java/lang/Class.getResource:(Ljava/lang/String;)Ljava/net/URL;
      13: dup
      14: ldc           #32                 // String getResource(...)
      16: invokestatic  #35                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      19: astore_2
      20: getstatic     #41                 // Field kotlin/text/Charsets.UTF_8:Ljava/nio/charset/Charset;
      23: astore_3
      24: aload_2
      25: invokestatic  #47                 // Method kotlin/io/TextStreamsKt.readBytes:(Ljava/net/URL;)[B
      28: astore        4
      30: new           #49                 // class java/lang/String
      33: dup
      34: aload         4
      36: aload_3
      37: invokespecial #52                 // Method java/lang/String."<init>":([BLjava/nio/charset/Charset;)V
      40: astore_1
      41: new           #54                 // class Puzzle16$TicketInfo
      44: dup
      45: aload_1
      46: invokespecial #57                 // Method Puzzle16$TicketInfo."<init>":(Ljava/lang/String;)V
      49: astore_2
      50: aload_2
      51: invokevirtual #61                 // Method Puzzle16$TicketInfo.sumInvalidNumbers:()I
      54: istore_3
      55: getstatic     #67                 // Field java/lang/System.out:Ljava/io/PrintStream;
      58: iload_3
      59: invokevirtual #73                 // Method java/io/PrintStream.println:(I)V
      62: aload_2
      63: invokevirtual #77                 // Method Puzzle16$TicketInfo.getProdOfDepartmentFields:()Ljava/math/BigInteger;
      66: getstatic     #67                 // Field java/lang/System.out:Ljava/io/PrintStream;
      69: swap
      70: invokevirtual #80                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      73: return

  static {};
    Code:
       0: new           #2                  // class Puzzle16
       3: dup
       4: invokespecial #87                 // Method "<init>":()V
       7: putstatic     #90                 // Field INSTANCE:LPuzzle16;
      10: return
}