package challenges

class Day02(private val input: List<String>) {
    private val checkMap = mapOf("red" to 12, "green" to 13, "blue" to 14)

    fun getPart1(): Int = input.mapIndexed { index, s -> if (checkGame(s.split(";"))) index + 1 else 0 }.sum()

    fun getPart2(): Int = calcPowers(input)

    // Part 1 helper
    private fun checkGame(draws: List<String>): Boolean = draws.all { checkDraw(it) }

    private fun checkDraw(draw: String): Boolean = draw.split(",").all { checkCube(it) }

    private fun checkCube(cube: String): Boolean = cube.trim().split(" ").let {
        it.isNotEmpty() && it[0].toInt() <= checkMap[it[1]]!!
    }

    // Part 2 helper
    private fun calcPowers(games: List<String>) = games.sumOf {
        game -> listOf("red", "green", "blue").map { s ->
        "\\d+ $s".toRegex().findAll(game).map {
                it.value.trim().split(" ").first().toInt()
            }.max()
        }.reduce { acc, elem -> acc * elem }
    }
}

Compiled from "Day02.kt"
public final class challenges.Day02 {
  private final java.util.List<java.lang.String> input;

  private final java.util.Map<java.lang.String, java.lang.Integer> checkMap;

  public challenges.Day02(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #10                 // String input
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #19                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: aload_1
      12: putfield      #22                 // Field input:Ljava/util/List;
      15: aload_0
      16: iconst_3
      17: anewarray     #24                 // class kotlin/Pair
      20: astore_2
      21: aload_2
      22: iconst_0
      23: ldc           #26                 // String red
      25: bipush        12
      27: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      30: invokestatic  #38                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      33: aastore
      34: aload_2
      35: iconst_1
      36: ldc           #40                 // String green
      38: bipush        13
      40: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      43: invokestatic  #38                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      46: aastore
      47: aload_2
      48: iconst_2
      49: ldc           #42                 // String blue
      51: bipush        14
      53: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      56: invokestatic  #38                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      59: aastore
      60: aload_2
      61: invokestatic  #48                 // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;
      64: putfield      #52                 // Field checkMap:Ljava/util/Map;
      67: return

  public final int getPart1();
    Code:
       0: aload_0
       1: getfield      #22                 // Field input:Ljava/util/List;
       4: checkcast     #58                 // class java/lang/Iterable
       7: astore_1
       8: iconst_0
       9: istore_2
      10: aload_1
      11: astore_3
      12: new           #60                 // class java/util/ArrayList
      15: dup
      16: aload_1
      17: bipush        10
      19: invokestatic  #66                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      22: invokespecial #69                 // Method java/util/ArrayList."<init>":(I)V
      25: checkcast     #71                 // class java/util/Collection
      28: astore        4
      30: iconst_0
      31: istore        5
      33: iconst_0
      34: istore        6
      36: aload_3
      37: invokeinterface #75,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      42: astore        7
      44: aload         7
      46: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      51: ifeq          153
      54: aload         7
      56: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      61: astore        8
      63: aload         4
      65: iload         6
      67: iinc          6, 1
      70: istore        9
      72: iload         9
      74: ifge          80
      77: invokestatic  #88                 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
      80: iload         9
      82: aload         8
      84: checkcast     #90                 // class java/lang/String
      87: astore        10
      89: istore        11
      91: astore        14
      93: iconst_0
      94: istore        12
      96: aload_0
      97: aload         10
      99: checkcast     #92                 // class java/lang/CharSequence
     102: iconst_1
     103: anewarray     #90                 // class java/lang/String
     106: astore        13
     108: aload         13
     110: iconst_0
     111: ldc           #94                 // String ;
     113: aastore
     114: aload         13
     116: iconst_0
     117: iconst_0
     118: bipush        6
     120: aconst_null
     121: invokestatic  #100                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     124: invokespecial #104                // Method checkGame:(Ljava/util/List;)Z
     127: ifeq          137
     130: iload         11
     132: iconst_1
     133: iadd
     134: goto          138
     137: iconst_0
     138: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     141: aload         14
     143: swap
     144: invokeinterface #108,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     149: pop
     150: goto          44
     153: aload         4
     155: checkcast     #110                // class java/util/List
     158: nop
     159: checkcast     #58                 // class java/lang/Iterable
     162: invokestatic  #114                // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
     165: ireturn

  public final int getPart2();
    Code:
       0: aload_0
       1: aload_0
       2: getfield      #22                 // Field input:Ljava/util/List;
       5: invokespecial #136                // Method calcPowers:(Ljava/util/List;)I
       8: ireturn

  private final boolean checkGame(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: checkcast     #58                 // class java/lang/Iterable
       4: astore_2
       5: iconst_0
       6: istore_3
       7: aload_2
       8: instanceof    #71                 // class java/util/Collection
      11: ifeq          30
      14: aload_2
      15: checkcast     #71                 // class java/util/Collection
      18: invokeinterface #140,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      23: ifeq          30
      26: iconst_1
      27: goto          81
      30: aload_2
      31: invokeinterface #75,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      36: astore        4
      38: aload         4
      40: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      45: ifeq          80
      48: aload         4
      50: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      55: astore        5
      57: aload         5
      59: checkcast     #90                 // class java/lang/String
      62: astore        6
      64: iconst_0
      65: istore        7
      67: aload_0
      68: aload         6
      70: invokespecial #144                // Method checkDraw:(Ljava/lang/String;)Z
      73: ifne          38
      76: iconst_0
      77: goto          81
      80: iconst_1
      81: ireturn

  private final boolean checkDraw(java.lang.String);
    Code:
       0: aload_1
       1: checkcast     #92                 // class java/lang/CharSequence
       4: iconst_1
       5: anewarray     #90                 // class java/lang/String
       8: astore_2
       9: aload_2
      10: iconst_0
      11: ldc           #152                // String ,
      13: aastore
      14: aload_2
      15: iconst_0
      16: iconst_0
      17: bipush        6
      19: aconst_null
      20: invokestatic  #100                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      23: checkcast     #58                 // class java/lang/Iterable
      26: astore_2
      27: iconst_0
      28: istore_3
      29: aload_2
      30: instanceof    #71                 // class java/util/Collection
      33: ifeq          52
      36: aload_2
      37: checkcast     #71                 // class java/util/Collection
      40: invokeinterface #140,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      45: ifeq          52
      48: iconst_1
      49: goto          103
      52: aload_2
      53: invokeinterface #75,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      58: astore        4
      60: aload         4
      62: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      67: ifeq          102
      70: aload         4
      72: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      77: astore        5
      79: aload         5
      81: checkcast     #90                 // class java/lang/String
      84: astore        6
      86: iconst_0
      87: istore        7
      89: aload_0
      90: aload         6
      92: invokespecial #155                // Method checkCube:(Ljava/lang/String;)Z
      95: ifne          60
      98: iconst_0
      99: goto          103
     102: iconst_1
     103: ireturn

  private final boolean checkCube(java.lang.String);
    Code:
       0: aload_1
       1: checkcast     #92                 // class java/lang/CharSequence
       4: invokestatic  #161                // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
       7: invokevirtual #165                // Method java/lang/Object.toString:()Ljava/lang/String;
      10: checkcast     #92                 // class java/lang/CharSequence
      13: iconst_1
      14: anewarray     #90                 // class java/lang/String
      17: astore_2
      18: aload_2
      19: iconst_0
      20: ldc           #167                // String
      22: aastore
      23: aload_2
      24: iconst_0
      25: iconst_0
      26: bipush        6
      28: aconst_null
      29: invokestatic  #100                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      32: astore_3
      33: iconst_0
      34: istore        4
      36: aload_3
      37: checkcast     #71                 // class java/util/Collection
      40: invokeinterface #140,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      45: ifne          52
      48: iconst_1
      49: goto          53
      52: iconst_0
      53: ifeq          102
      56: aload_3
      57: iconst_0
      58: invokeinterface #171,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      63: checkcast     #90                 // class java/lang/String
      66: invokestatic  #175                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      69: aload_0
      70: getfield      #52                 // Field checkMap:Ljava/util/Map;
      73: aload_3
      74: iconst_1
      75: invokeinterface #171,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      80: invokeinterface #180,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      85: dup
      86: invokestatic  #184                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      89: checkcast     #186                // class java/lang/Number
      92: invokevirtual #189                // Method java/lang/Number.intValue:()I
      95: if_icmpgt     102
      98: iconst_1
      99: goto          103
     102: iconst_0
     103: nop
     104: ireturn

  private final int calcPowers(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: checkcast     #58                 // class java/lang/Iterable
       4: astore_2
       5: iconst_0
       6: istore_3
       7: aload_2
       8: invokeinterface #75,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      13: astore        4
      15: aload         4
      17: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      22: ifeq          346
      25: aload         4
      27: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      32: astore        5
      34: iload_3
      35: aload         5
      37: checkcast     #90                 // class java/lang/String
      40: astore        6
      42: istore        18
      44: iconst_0
      45: istore        7
      47: iconst_3
      48: anewarray     #90                 // class java/lang/String
      51: astore        8
      53: aload         8
      55: iconst_0
      56: ldc           #26                 // String red
      58: aastore
      59: aload         8
      61: iconst_1
      62: ldc           #40                 // String green
      64: aastore
      65: aload         8
      67: iconst_2
      68: ldc           #42                 // String blue
      70: aastore
      71: aload         8
      73: invokestatic  #196                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      76: checkcast     #58                 // class java/lang/Iterable
      79: astore        8
      81: iconst_0
      82: istore        9
      84: aload         8
      86: astore        10
      88: new           #60                 // class java/util/ArrayList
      91: dup
      92: aload         8
      94: bipush        10
      96: invokestatic  #66                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      99: invokespecial #69                 // Method java/util/ArrayList."<init>":(I)V
     102: checkcast     #71                 // class java/util/Collection
     105: astore        11
     107: iconst_0
     108: istore        12
     110: aload         10
     112: invokeinterface #75,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     117: astore        13
     119: aload         13
     121: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     126: ifeq          222
     129: aload         13
     131: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     136: astore        14
     138: aload         11
     140: aload         14
     142: checkcast     #90                 // class java/lang/String
     145: astore        15
     147: astore        16
     149: iconst_0
     150: istore        17
     152: new           #198                // class kotlin/text/Regex
     155: dup
     156: new           #200                // class java/lang/StringBuilder
     159: dup
     160: invokespecial #201                // Method java/lang/StringBuilder."<init>":()V
     163: ldc           #203                // String \\d+
     165: invokevirtual #207                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     168: aload         15
     170: invokevirtual #207                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     173: invokevirtual #208                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     176: invokespecial #211                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
     179: aload         6
     181: checkcast     #92                 // class java/lang/CharSequence
     184: iconst_0
     185: iconst_2
     186: aconst_null
     187: invokestatic  #215                // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;
     190: invokedynamic #234,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
     195: invokestatic  #240                // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
     198: invokestatic  #244                // Method kotlin/sequences/SequencesKt.maxOrThrow:(Lkotlin/sequences/Sequence;)Ljava/lang/Comparable;
     201: checkcast     #186                // class java/lang/Number
     204: invokevirtual #189                // Method java/lang/Number.intValue:()I
     207: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     210: aload         16
     212: swap
     213: invokeinterface #108,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     218: pop
     219: goto          119
     222: aload         11
     224: checkcast     #110                // class java/util/List
     227: nop
     228: checkcast     #58                 // class java/lang/Iterable
     231: astore        8
     233: nop
     234: iconst_0
     235: istore        9
     237: aload         8
     239: invokeinterface #75,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     244: astore        10
     246: aload         10
     248: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     253: ifne          266
     256: new           #246                // class java/lang/UnsupportedOperationException
     259: dup
     260: ldc           #248                // String Empty collection can\'t be reduced.
     262: invokespecial #249                // Method java/lang/UnsupportedOperationException."<init>":(Ljava/lang/String;)V
     265: athrow
     266: aload         10
     268: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     273: astore        11
     275: aload         10
     277: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     282: ifeq          326
     285: aload         11
     287: aload         10
     289: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     294: checkcast     #186                // class java/lang/Number
     297: invokevirtual #189                // Method java/lang/Number.intValue:()I
     300: istore        12
     302: checkcast     #186                // class java/lang/Number
     305: invokevirtual #189                // Method java/lang/Number.intValue:()I
     308: istore        13
     310: iconst_0
     311: istore        14
     313: iload         13
     315: iload         12
     317: imul
     318: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     321: astore        11
     323: goto          275
     326: aload         11
     328: checkcast     #186                // class java/lang/Number
     331: invokevirtual #189                // Method java/lang/Number.intValue:()I
     334: nop
     335: istore        19
     337: iload         18
     339: iload         19
     341: iadd
     342: istore_3
     343: goto          15
     346: iload_3
     347: ireturn

  private static final int calcPowers$lambda$7$lambda$5$lambda$4(kotlin.text.MatchResult);
    Code:
       0: aload_0
       1: ldc_w         #266                // String it
       4: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: invokeinterface #271,  1          // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;
      13: checkcast     #92                 // class java/lang/CharSequence
      16: invokestatic  #161                // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
      19: invokevirtual #165                // Method java/lang/Object.toString:()Ljava/lang/String;
      22: checkcast     #92                 // class java/lang/CharSequence
      25: iconst_1
      26: anewarray     #90                 // class java/lang/String
      29: astore_1
      30: aload_1
      31: iconst_0
      32: ldc           #167                // String
      34: aastore
      35: aload_1
      36: iconst_0
      37: iconst_0
      38: bipush        6
      40: aconst_null
      41: invokestatic  #100                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      44: invokestatic  #275                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
      47: checkcast     #90                 // class java/lang/String
      50: invokestatic  #175                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      53: ireturn
}


package aula14

/*Exercício 04 da parte 'Exercícios gerais'*/
fun main() {
    print("Informe a quantidade de alunes a turma tem: ")
    val quantidadeAlunos = readln().toInt()

    val turma = receberDadosAlune(quantidadeAlunos)
    val medias = calcularMedia(quantidadeAlunos, turma)
    printarMedias(turma, medias)

}

fun receberDadosAlune(quantidadeAlunos: Int): ArrayList<String> {

    val turma = ArrayList<String>()

    var contador = 0

    while (contador < quantidadeAlunos) {
        print("Informe o nome da pessoa número ${contador + 1}: ")
        val nome = readln()
        turma.add(nome)
        contador++
    }

    return turma
}

fun calcularMedia(quantidadeAlunos: Int, turma: ArrayList<String>): DoubleArray {
    val medias = DoubleArray(quantidadeAlunos)

    turma.forEachIndexed { index, alune ->
        print("Digite a primeira nota de $alune: ")
        val nota1 = readln().toDouble()

        print("Digite a segunda nota de $alune: ")
        val nota2 = readln().toDouble()

        print("Digite a terceira nota de $alune: ")
        val nota3 = readln().toDouble()
        val media = (nota1 + nota2 + nota3) / 3
        medias[index] = media
    }
    return medias
}

fun printarMedias(turma: ArrayList<String>, medias: DoubleArray) {
    turma.forEachIndexed { index, alune ->
        println("Alune $alune teve média ${medias[index]}")
    }
}

Compiled from "Exercicio08.kt"
public final class aula14.Exercicio08Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String Informe a quantidade de alunes a turma tem:
       2: getstatic     #14                 // Field java/lang/System.out:Ljava/io/PrintStream;
       5: swap
       6: invokevirtual #20                 // Method java/io/PrintStream.print:(Ljava/lang/Object;)V
       9: invokestatic  #26                 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;
      12: invokestatic  #32                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      15: istore_0
      16: iload_0
      17: invokestatic  #36                 // Method receberDadosAlune:(I)Ljava/util/ArrayList;
      20: astore_1
      21: iload_0
      22: aload_1
      23: invokestatic  #40                 // Method calcularMedia:(ILjava/util/ArrayList;)[D
      26: astore_2
      27: aload_1
      28: aload_2
      29: invokestatic  #44                 // Method printarMedias:(Ljava/util/ArrayList;[D)V
      32: return

  public static final java.util.ArrayList<java.lang.String> receberDadosAlune(int);
    Code:
       0: new           #54                 // class java/util/ArrayList
       3: dup
       4: invokespecial #57                 // Method java/util/ArrayList."<init>":()V
       7: astore_1
       8: iconst_0
       9: istore_2
      10: iload_2
      11: iload_0
      12: if_icmpge     64
      15: new           #59                 // class java/lang/StringBuilder
      18: dup
      19: invokespecial #60                 // Method java/lang/StringBuilder."<init>":()V
      22: ldc           #62                 // String Informe o nome da pessoa número
      24: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      27: iload_2
      28: iconst_1
      29: iadd
      30: invokevirtual #69                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      33: ldc           #71                 // String :
      35: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      38: invokevirtual #74                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      41: getstatic     #14                 // Field java/lang/System.out:Ljava/io/PrintStream;
      44: swap
      45: invokevirtual #20                 // Method java/io/PrintStream.print:(Ljava/lang/Object;)V
      48: invokestatic  #26                 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;
      51: astore_3
      52: aload_1
      53: aload_3
      54: invokevirtual #78                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      57: pop
      58: iinc          2, 1
      61: goto          10
      64: aload_1
      65: areturn

  public static final double[] calcularMedia(int, java.util.ArrayList<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #83                 // String turma
       3: invokestatic  #89                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iload_0
       7: newarray       double
       9: astore_2
      10: aload_1
      11: checkcast     #91                 // class java/lang/Iterable
      14: astore_3
      15: iconst_0
      16: istore        4
      18: iconst_0
      19: istore        5
      21: aload_3
      22: invokeinterface #95,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      27: astore        6
      29: aload         6
      31: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      36: ifeq          221
      39: aload         6
      41: invokeinterface #105,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      46: astore        7
      48: iload         5
      50: iinc          5, 1
      53: istore        8
      55: iload         8
      57: ifge          63
      60: invokestatic  #110                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
      63: iload         8
      65: aload         7
      67: checkcast     #112                // class java/lang/String
      70: astore        9
      72: istore        10
      74: iconst_0
      75: istore        11
      77: new           #59                 // class java/lang/StringBuilder
      80: dup
      81: invokespecial #60                 // Method java/lang/StringBuilder."<init>":()V
      84: ldc           #114                // String Digite a primeira nota de
      86: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      89: aload         9
      91: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      94: ldc           #71                 // String :
      96: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      99: invokevirtual #74                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     102: getstatic     #14                 // Field java/lang/System.out:Ljava/io/PrintStream;
     105: swap
     106: invokevirtual #20                 // Method java/io/PrintStream.print:(Ljava/lang/Object;)V
     109: invokestatic  #26                 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;
     112: invokestatic  #120                // Method java/lang/Double.parseDouble:(Ljava/lang/String;)D
     115: dstore        12
     117: new           #59                 // class java/lang/StringBuilder
     120: dup
     121: invokespecial #60                 // Method java/lang/StringBuilder."<init>":()V
     124: ldc           #122                // String Digite a segunda nota de
     126: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     129: aload         9
     131: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     134: ldc           #71                 // String :
     136: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     139: invokevirtual #74                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     142: getstatic     #14                 // Field java/lang/System.out:Ljava/io/PrintStream;
     145: swap
     146: invokevirtual #20                 // Method java/io/PrintStream.print:(Ljava/lang/Object;)V
     149: invokestatic  #26                 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;
     152: invokestatic  #120                // Method java/lang/Double.parseDouble:(Ljava/lang/String;)D
     155: dstore        14
     157: new           #59                 // class java/lang/StringBuilder
     160: dup
     161: invokespecial #60                 // Method java/lang/StringBuilder."<init>":()V
     164: ldc           #124                // String Digite a terceira nota de
     166: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     169: aload         9
     171: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     174: ldc           #71                 // String :
     176: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     179: invokevirtual #74                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     182: getstatic     #14                 // Field java/lang/System.out:Ljava/io/PrintStream;
     185: swap
     186: invokevirtual #20                 // Method java/io/PrintStream.print:(Ljava/lang/Object;)V
     189: invokestatic  #26                 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;
     192: invokestatic  #120                // Method java/lang/Double.parseDouble:(Ljava/lang/String;)D
     195: dstore        16
     197: dload         12
     199: dload         14
     201: dadd
     202: dload         16
     204: dadd
     205: iconst_3
     206: i2d
     207: ddiv
     208: dstore        18
     210: aload_2
     211: iload         10
     213: dload         18
     215: dastore
     216: nop
     217: nop
     218: goto          29
     221: nop
     222: aload_2
     223: areturn

  public static final void printarMedias(java.util.ArrayList<java.lang.String>, double[]);
    Code:
       0: aload_0
       1: ldc           #83                 // String turma
       3: invokestatic  #89                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #141                // String medias
       9: invokestatic  #89                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: checkcast     #91                 // class java/lang/Iterable
      16: astore_2
      17: iconst_0
      18: istore_3
      19: iconst_0
      20: istore        4
      22: aload_2
      23: invokeinterface #95,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      28: astore        5
      30: aload         5
      32: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      37: ifeq          122
      40: aload         5
      42: invokeinterface #105,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      47: astore        6
      49: iload         4
      51: iinc          4, 1
      54: istore        7
      56: iload         7
      58: ifge          64
      61: invokestatic  #110                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
      64: iload         7
      66: aload         6
      68: checkcast     #112                // class java/lang/String
      71: astore        8
      73: istore        9
      75: iconst_0
      76: istore        10
      78: new           #59                 // class java/lang/StringBuilder
      81: dup
      82: invokespecial #60                 // Method java/lang/StringBuilder."<init>":()V
      85: ldc           #143                // String Alune
      87: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      90: aload         8
      92: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      95: ldc           #145                // String  teve média
      97: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     100: aload_1
     101: iload         9
     103: daload
     104: invokevirtual #148                // Method java/lang/StringBuilder.append:(D)Ljava/lang/StringBuilder;
     107: invokevirtual #74                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     110: getstatic     #14                 // Field java/lang/System.out:Ljava/io/PrintStream;
     113: swap
     114: invokevirtual #151                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     117: nop
     118: nop
     119: goto          30
     122: nop
     123: return

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


package boj_2206

import java.util.LinkedList
import java.util.StringTokenizer

val DIRECTIONS = arrayOf(arrayOf(0, 1), arrayOf(0, -1), arrayOf(1, 0), arrayOf(-1, 0))

fun main() {
    val st = StringTokenizer(readln())
    val n = st.nextToken().toInt()
    val m = st.nextToken().toInt()
    val map = Array(size = n + 1) { CharArray(size = m + 1) }
    for (row in 1..n) {
        val input = readln()
        for (col in 1..m) {
            map[row][col] = input[col - 1]
        }
    }

    val startPoint = Point(row = 1, col = 1, depth = 1, hasBreakChance = true)
    val queue = LinkedList<Point>()
    queue.offer(startPoint)
    val isVisited = Array(size = n + 1) { Array(size = m + 1) { BooleanArray(size = 2) } }
    isVisited[1][1][0] = true
    while (queue.isNotEmpty()) {
        val point = queue.poll()
        if (point.row == n && point.col == m) return println(point.depth)

        val nextPoints = DIRECTIONS.asSequence()
            .map { (rowDiff, colDiff) ->
                val nextRow = point.row + rowDiff
                val nextCol = point.col + colDiff
                val nextDepth = point.depth + 1
                Point(nextRow, nextCol, nextDepth, point.hasBreakChance)
            }
            .filter { it.row in 1..n && it.col in 1..m }
            .toList()

        nextPoints.forEach { nextPoint ->
            if (map[nextPoint.row][nextPoint.col] == '0') {
                if (nextPoint.hasBreakChance && !isVisited[nextPoint.row][nextPoint.col][0]) {
                    isVisited[nextPoint.row][nextPoint.col][0] = true
                    queue.offer(nextPoint)
                } else if (!isVisited[nextPoint.row][nextPoint.col][1]) {
                    isVisited[nextPoint.row][nextPoint.col][1] = true
                    queue.offer(nextPoint)
                }
            } else {
                if (nextPoint.hasBreakChance) {
                    isVisited[nextPoint.row][nextPoint.col][1] = true
                    queue.offer(nextPoint.copy(hasBreakChance = false))
                }
            }
        }
    }

    println(-1)
}

data class Point(
    val row: Int,
    val col: Int,
    val depth: Int,
    val hasBreakChance: Boolean
)

Compiled from "Kotlin.kt"
public final class boj_2206.KotlinKt {
  private static final java.lang.Integer[][] DIRECTIONS;

  public static final java.lang.Integer[][] getDIRECTIONS();
    Code:
       0: getstatic     #11                 // Field DIRECTIONS:[[Ljava/lang/Integer;
       3: areturn

  public static final void main();
    Code:
       0: new           #15                 // class java/util/StringTokenizer
       3: dup
       4: invokestatic  #21                 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;
       7: invokespecial #25                 // Method java/util/StringTokenizer."<init>":(Ljava/lang/String;)V
      10: astore_0
      11: aload_0
      12: invokevirtual #28                 // Method java/util/StringTokenizer.nextToken:()Ljava/lang/String;
      15: dup
      16: ldc           #30                 // String nextToken(...)
      18: invokestatic  #36                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      21: invokestatic  #42                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      24: istore_1
      25: aload_0
      26: invokevirtual #28                 // Method java/util/StringTokenizer.nextToken:()Ljava/lang/String;
      29: dup
      30: ldc           #30                 // String nextToken(...)
      32: invokestatic  #36                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      35: invokestatic  #42                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      38: istore_2
      39: iconst_0
      40: istore        4
      42: iload_1
      43: iconst_1
      44: iadd
      45: istore        5
      47: iload         5
      49: anewarray     #44                 // class "[C"
      52: astore        6
      54: iload         4
      56: iload         5
      58: if_icmpge     81
      61: iload         4
      63: istore        7
      65: aload         6
      67: iload         7
      69: iload_2
      70: iconst_1
      71: iadd
      72: newarray       char
      74: aastore
      75: iinc          4, 1
      78: goto          54
      81: aload         6
      83: astore_3
      84: iconst_1
      85: istore        4
      87: iload         4
      89: iload_1
      90: if_icmpgt     147
      93: invokestatic  #21                 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;
      96: astore        5
      98: iconst_1
      99: istore        6
     101: iload         6
     103: iload_2
     104: if_icmpgt     135
     107: aload_3
     108: iload         4
     110: aaload
     111: iload         6
     113: aload         5
     115: iload         6
     117: iconst_1
     118: isub
     119: invokevirtual #50                 // Method java/lang/String.charAt:(I)C
     122: castore
     123: iload         6
     125: iload_2
     126: if_icmpeq     135
     129: iinc          6, 1
     132: goto          107
     135: iload         4
     137: iload_1
     138: if_icmpeq     147
     141: iinc          4, 1
     144: goto          93
     147: new           #52                 // class boj_2206/Point
     150: dup
     151: iconst_1
     152: iconst_1
     153: iconst_1
     154: iconst_1
     155: invokespecial #55                 // Method boj_2206/Point."<init>":(IIIZ)V
     158: astore        4
     160: new           #57                 // class java/util/LinkedList
     163: dup
     164: invokespecial #59                 // Method java/util/LinkedList."<init>":()V
     167: astore        5
     169: aload         5
     171: aload         4
     173: invokevirtual #63                 // Method java/util/LinkedList.offer:(Ljava/lang/Object;)Z
     176: pop
     177: iconst_0
     178: istore        7
     180: iload_1
     181: iconst_1
     182: iadd
     183: istore        8
     185: iload         8
     187: anewarray     #65                 // class "[[Z"
     190: astore        9
     192: iload         7
     194: iload         8
     196: if_icmpge     264
     199: iload         7
     201: istore        10
     203: aload         9
     205: iload         10
     207: iconst_0
     208: istore        11
     210: iload_2
     211: iconst_1
     212: iadd
     213: istore        12
     215: iload         12
     217: anewarray     #67                 // class "[Z"
     220: astore        13
     222: istore        16
     224: astore        15
     226: iload         11
     228: iload         12
     230: if_icmpge     251
     233: iload         11
     235: istore        14
     237: aload         13
     239: iload         14
     241: iconst_2
     242: newarray       boolean
     244: aastore
     245: iinc          11, 1
     248: goto          226
     251: aload         15
     253: iload         16
     255: aload         13
     257: aastore
     258: iinc          7, 1
     261: goto          192
     264: aload         9
     266: astore        6
     268: aload         6
     270: iconst_1
     271: aaload
     272: iconst_1
     273: aaload
     274: iconst_0
     275: iconst_1
     276: bastore
     277: aload         5
     279: checkcast     #69                 // class java/util/Collection
     282: invokeinterface #73,  1           // InterfaceMethod java/util/Collection.isEmpty:()Z
     287: ifne          294
     290: iconst_1
     291: goto          295
     294: iconst_0
     295: ifeq          596
     298: aload         5
     300: invokevirtual #77                 // Method java/util/LinkedList.poll:()Ljava/lang/Object;
     303: checkcast     #52                 // class boj_2206/Point
     306: astore        7
     308: aload         7
     310: invokevirtual #81                 // Method boj_2206/Point.getRow:()I
     313: iload_1
     314: if_icmpne     342
     317: aload         7
     319: invokevirtual #84                 // Method boj_2206/Point.getCol:()I
     322: iload_2
     323: if_icmpne     342
     326: aload         7
     328: invokevirtual #87                 // Method boj_2206/Point.getDepth:()I
     331: istore        8
     333: getstatic     #93                 // Field java/lang/System.out:Ljava/io/PrintStream;
     336: iload         8
     338: invokevirtual #99                 // Method java/io/PrintStream.println:(I)V
     341: return
     342: getstatic     #11                 // Field DIRECTIONS:[[Ljava/lang/Integer;
     345: checkcast     #101                // class "[Ljava/lang/Object;"
     348: invokestatic  #107                // Method kotlin/collections/ArraysKt.asSequence:([Ljava/lang/Object;)Lkotlin/sequences/Sequence;
     351: aload         7
     353: invokedynamic #127,  0            // InvokeDynamic #0:invoke:(Lboj_2206/Point;)Lkotlin/jvm/functions/Function1;
     358: invokestatic  #133                // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
     361: iload_1
     362: iload_2
     363: invokedynamic #143,  0            // InvokeDynamic #1:invoke:(II)Lkotlin/jvm/functions/Function1;
     368: invokestatic  #146                // Method kotlin/sequences/SequencesKt.filter:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
     371: invokestatic  #150                // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;
     374: astore        8
     376: aload         8
     378: checkcast     #152                // class java/lang/Iterable
     381: astore        9
     383: iconst_0
     384: istore        10
     386: aload         9
     388: invokeinterface #156,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     393: astore        11
     395: aload         11
     397: invokeinterface #161,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     402: ifeq          592
     405: aload         11
     407: invokeinterface #164,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     412: astore        12
     414: aload         12
     416: checkcast     #52                 // class boj_2206/Point
     419: astore        13
     421: iconst_0
     422: istore        14
     424: aload_3
     425: aload         13
     427: invokevirtual #81                 // Method boj_2206/Point.getRow:()I
     430: aaload
     431: aload         13
     433: invokevirtual #84                 // Method boj_2206/Point.getCol:()I
     436: caload
     437: bipush        48
     439: if_icmpne     544
     442: aload         13
     444: invokevirtual #167                // Method boj_2206/Point.getHasBreakChance:()Z
     447: ifeq          497
     450: aload         6
     452: aload         13
     454: invokevirtual #81                 // Method boj_2206/Point.getRow:()I
     457: aaload
     458: aload         13
     460: invokevirtual #84                 // Method boj_2206/Point.getCol:()I
     463: aaload
     464: iconst_0
     465: baload
     466: ifne          497
     469: aload         6
     471: aload         13
     473: invokevirtual #81                 // Method boj_2206/Point.getRow:()I
     476: aaload
     477: aload         13
     479: invokevirtual #84                 // Method boj_2206/Point.getCol:()I
     482: aaload
     483: iconst_0
     484: iconst_1
     485: bastore
     486: aload         5
     488: aload         13
     490: invokevirtual #63                 // Method java/util/LinkedList.offer:(Ljava/lang/Object;)Z
     493: pop
     494: goto          587
     497: aload         6
     499: aload         13
     501: invokevirtual #81                 // Method boj_2206/Point.getRow:()I
     504: aaload
     505: aload         13
     507: invokevirtual #84                 // Method boj_2206/Point.getCol:()I
     510: aaload
     511: iconst_1
     512: baload
     513: ifne          587
     516: aload         6
     518: aload         13
     520: invokevirtual #81                 // Method boj_2206/Point.getRow:()I
     523: aaload
     524: aload         13
     526: invokevirtual #84                 // Method boj_2206/Point.getCol:()I
     529: aaload
     530: iconst_1
     531: iconst_1
     532: bastore
     533: aload         5
     535: aload         13
     537: invokevirtual #63                 // Method java/util/LinkedList.offer:(Ljava/lang/Object;)Z
     540: pop
     541: goto          587
     544: aload         13
     546: invokevirtual #167                // Method boj_2206/Point.getHasBreakChance:()Z
     549: ifeq          587
     552: aload         6
     554: aload         13
     556: invokevirtual #81                 // Method boj_2206/Point.getRow:()I
     559: aaload
     560: aload         13
     562: invokevirtual #84                 // Method boj_2206/Point.getCol:()I
     565: aaload
     566: iconst_1
     567: iconst_1
     568: bastore
     569: aload         5
     571: aload         13
     573: iconst_0
     574: iconst_0
     575: iconst_0
     576: iconst_0
     577: bipush        7
     579: aconst_null
     580: invokestatic  #171                // Method boj_2206/Point.copy$default:(Lboj_2206/Point;IIIZILjava/lang/Object;)Lboj_2206/Point;
     583: invokevirtual #63                 // Method java/util/LinkedList.offer:(Ljava/lang/Object;)Z
     586: pop
     587: nop
     588: nop
     589: goto          395
     592: nop
     593: goto          277
     596: iconst_m1
     597: istore        7
     599: getstatic     #93                 // Field java/lang/System.out:Ljava/io/PrintStream;
     602: iload         7
     604: invokevirtual #99                 // Method java/io/PrintStream.println:(I)V
     607: return

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

  private static final boj_2206.Point main$lambda$0(boj_2206.Point, java.lang.Integer[]);
    Code:
       0: aload_1
       1: ldc           #208                // String <destruct>
       3: invokestatic  #211                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: iconst_0
       8: aaload
       9: checkcast     #213                // class java/lang/Number
      12: invokevirtual #216                // Method java/lang/Number.intValue:()I
      15: istore_2
      16: aload_1
      17: iconst_1
      18: aaload
      19: checkcast     #213                // class java/lang/Number
      22: invokevirtual #216                // Method java/lang/Number.intValue:()I
      25: istore_3
      26: aload_0
      27: invokevirtual #81                 // Method boj_2206/Point.getRow:()I
      30: iload_2
      31: iadd
      32: istore        4
      34: aload_0
      35: invokevirtual #84                 // Method boj_2206/Point.getCol:()I
      38: iload_3
      39: iadd
      40: istore        5
      42: aload_0
      43: invokevirtual #87                 // Method boj_2206/Point.getDepth:()I
      46: iconst_1
      47: iadd
      48: istore        6
      50: new           #52                 // class boj_2206/Point
      53: dup
      54: iload         4
      56: iload         5
      58: iload         6
      60: aload_0
      61: invokevirtual #167                // Method boj_2206/Point.getHasBreakChance:()Z
      64: invokespecial #55                 // Method boj_2206/Point."<init>":(IIIZ)V
      67: areturn

  private static final boolean main$lambda$1(int, int, boj_2206.Point);
    Code:
       0: aload_2
       1: ldc           #224                // String it
       3: invokestatic  #211                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: invokevirtual #81                 // Method boj_2206/Point.getRow:()I
      10: istore_3
      11: iconst_1
      12: iload_3
      13: if_icmpgt     29
      16: iload_3
      17: iload_0
      18: if_icmpgt     25
      21: iconst_1
      22: goto          30
      25: iconst_0
      26: goto          30
      29: iconst_0
      30: ifeq          64
      33: aload_2
      34: invokevirtual #84                 // Method boj_2206/Point.getCol:()I
      37: istore_3
      38: iconst_1
      39: iload_3
      40: if_icmpgt     56
      43: iload_3
      44: iload_1
      45: if_icmpgt     52
      48: iconst_1
      49: goto          57
      52: iconst_0
      53: goto          57
      56: iconst_0
      57: ifeq          64
      60: iconst_1
      61: goto          65
      64: iconst_0
      65: ireturn

  static {};
    Code:
       0: iconst_4
       1: anewarray     #229                // class "[Ljava/lang/Integer;"
       4: astore_0
       5: aload_0
       6: iconst_0
       7: iconst_2
       8: anewarray     #38                 // class java/lang/Integer
      11: astore_1
      12: aload_1
      13: iconst_0
      14: iconst_0
      15: invokestatic  #233                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      18: aastore
      19: aload_1
      20: iconst_1
      21: iconst_1
      22: invokestatic  #233                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      25: aastore
      26: aload_1
      27: aastore
      28: aload_0
      29: iconst_1
      30: iconst_2
      31: anewarray     #38                 // class java/lang/Integer
      34: astore_1
      35: aload_1
      36: iconst_0
      37: iconst_0
      38: invokestatic  #233                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      41: aastore
      42: aload_1
      43: iconst_1
      44: iconst_m1
      45: invokestatic  #233                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      48: aastore
      49: aload_1
      50: aastore
      51: aload_0
      52: iconst_2
      53: iconst_2
      54: anewarray     #38                 // class java/lang/Integer
      57: astore_1
      58: aload_1
      59: iconst_0
      60: iconst_1
      61: invokestatic  #233                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      64: aastore
      65: aload_1
      66: iconst_1
      67: iconst_0
      68: invokestatic  #233                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      71: aastore
      72: aload_1
      73: aastore
      74: aload_0
      75: iconst_3
      76: iconst_2
      77: anewarray     #38                 // class java/lang/Integer
      80: astore_1
      81: aload_1
      82: iconst_0
      83: iconst_m1
      84: invokestatic  #233                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      87: aastore
      88: aload_1
      89: iconst_1
      90: iconst_0
      91: invokestatic  #233                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      94: aastore
      95: aload_1
      96: aastore
      97: aload_0
      98: putstatic     #11                 // Field DIRECTIONS:[[Ljava/lang/Integer;
     101: return
}


package boj_14888

import java.util.StringTokenizer
import kotlin.math.max
import kotlin.math.min

var maxValue = Int.MIN_VALUE
var minValue = Int.MAX_VALUE

fun main() {
    val n = readln().toInt()
    var st = StringTokenizer(readln())
    val numbers = IntArray(n)
    repeat(n) { numbers[it] = st.nextToken().toInt() }
    st = StringTokenizer(readln())
    val opCounts = IntArray(size = 4)
    repeat(opCounts.size) { opCounts[it] = st.nextToken().toInt() }

    val opSequences = IntArray(size = n - 1)
    dfs(numbers, opSequences, opCounts)

    val result = buildString {
        appendLine(maxValue)
        append(minValue)
    }

    println(result)
}

fun dfs(numbers: IntArray, opTypes: IntArray, opCounts: IntArray, opSeq: Int = 0) {
    if (opSeq == opTypes.size) {
        var result = numbers.first()
        for (i in 1..numbers.lastIndex) {
            val number = numbers[i]
            result = when (opTypes[i - 1]) {
                0 -> result + number
                1 -> result - number
                2 -> result * number
                else -> result / number
            }
        }

        maxValue = max(maxValue, result)
        minValue = min(minValue, result)

        return
    }

    opCounts.forEachIndexed { opType, opCount ->
        if (0 < opCount) {
            opTypes[opSeq] = opType
            --opCounts[opType]
            dfs(numbers, opTypes, opCounts, opSeq = opSeq + 1)
            ++opCounts[opType]
        }
    }
}

Compiled from "Kotlin.kt"
public final class boj_14888.KotlinKt {
  private static int maxValue;

  private static int minValue;

  public static final int getMaxValue();
    Code:
       0: getstatic     #10                 // Field maxValue:I
       3: ireturn

  public static final void setMaxValue(int);
    Code:
       0: iload_0
       1: putstatic     #10                 // Field maxValue:I
       4: return

  public static final int getMinValue();
    Code:
       0: getstatic     #17                 // Field minValue:I
       3: ireturn

  public static final void setMinValue(int);
    Code:
       0: iload_0
       1: putstatic     #17                 // Field minValue:I
       4: return

  public static final void main();
    Code:
       0: invokestatic  #26                 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;
       3: invokestatic  #32                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
       6: istore_0
       7: aconst_null
       8: astore_1
       9: new           #34                 // class java/util/StringTokenizer
      12: dup
      13: invokestatic  #26                 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;
      16: invokespecial #38                 // Method java/util/StringTokenizer."<init>":(Ljava/lang/String;)V
      19: astore_1
      20: iload_0
      21: newarray       int
      23: astore_2
      24: iconst_0
      25: istore_3
      26: iload_3
      27: iload_0
      28: if_icmpge     61
      31: iload_3
      32: istore        4
      34: iconst_0
      35: istore        5
      37: aload_2
      38: iload         4
      40: aload_1
      41: invokevirtual #41                 // Method java/util/StringTokenizer.nextToken:()Ljava/lang/String;
      44: dup
      45: ldc           #43                 // String nextToken(...)
      47: invokestatic  #49                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      50: invokestatic  #32                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      53: iastore
      54: nop
      55: iinc          3, 1
      58: goto          26
      61: new           #34                 // class java/util/StringTokenizer
      64: dup
      65: invokestatic  #26                 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;
      68: invokespecial #38                 // Method java/util/StringTokenizer."<init>":(Ljava/lang/String;)V
      71: astore_1
      72: iconst_4
      73: newarray       int
      75: astore_3
      76: aload_3
      77: arraylength
      78: istore        4
      80: iconst_0
      81: istore        5
      83: iload         5
      85: iload         4
      87: if_icmpge     121
      90: iload         5
      92: istore        6
      94: iconst_0
      95: istore        7
      97: aload_3
      98: iload         6
     100: aload_1
     101: invokevirtual #41                 // Method java/util/StringTokenizer.nextToken:()Ljava/lang/String;
     104: dup
     105: ldc           #43                 // String nextToken(...)
     107: invokestatic  #49                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     110: invokestatic  #32                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     113: iastore
     114: nop
     115: iinc          5, 1
     118: goto          83
     121: iload_0
     122: iconst_1
     123: isub
     124: newarray       int
     126: astore        4
     128: aload_2
     129: aload         4
     131: aload_3
     132: iconst_0
     133: bipush        8
     135: aconst_null
     136: invokestatic  #53                 // Method dfs$default:([I[I[IIILjava/lang/Object;)V
     139: new           #55                 // class java/lang/StringBuilder
     142: dup
     143: invokespecial #57                 // Method java/lang/StringBuilder."<init>":()V
     146: astore        6
     148: aload         6
     150: astore        7
     152: iconst_0
     153: istore        8
     155: aload         7
     157: getstatic     #10                 // Field maxValue:I
     160: invokevirtual #61                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     163: dup
     164: ldc           #63                 // String append(...)
     166: invokestatic  #49                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     169: bipush        10
     171: invokevirtual #66                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     174: pop
     175: aload         7
     177: getstatic     #17                 // Field minValue:I
     180: invokevirtual #61                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     183: pop
     184: nop
     185: aload         6
     187: invokevirtual #69                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     190: astore        5
     192: getstatic     #75                 // Field java/lang/System.out:Ljava/io/PrintStream;
     195: aload         5
     197: invokevirtual #81                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     200: return

  public static final void dfs(int[], int[], int[], int);
    Code:
       0: aload_0
       1: ldc           #101                // String numbers
       3: invokestatic  #104                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #106                // String opTypes
       9: invokestatic  #104                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_2
      13: ldc           #107                // String opCounts
      15: invokestatic  #104                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: iload_3
      19: aload_1
      20: arraylength
      21: if_icmpne     151
      24: aload_0
      25: invokestatic  #113                // Method kotlin/collections/ArraysKt.first:([I)I
      28: istore        4
      30: iconst_1
      31: istore        5
      33: aload_0
      34: invokestatic  #116                // Method kotlin/collections/ArraysKt.getLastIndex:([I)I
      37: istore        6
      39: iload         5
      41: iload         6
      43: if_icmpgt     128
      46: aload_0
      47: iload         5
      49: iaload
      50: istore        7
      52: aload_1
      53: iload         5
      55: iconst_1
      56: isub
      57: iaload
      58: tableswitch   { // 0 to 2
                     0: 84
                     1: 92
                     2: 100
               default: 108
          }
      84: iload         4
      86: iload         7
      88: iadd
      89: goto          113
      92: iload         4
      94: iload         7
      96: isub
      97: goto          113
     100: iload         4
     102: iload         7
     104: imul
     105: goto          113
     108: iload         4
     110: iload         7
     112: idiv
     113: istore        4
     115: iload         5
     117: iload         6
     119: if_icmpeq     128
     122: iinc          5, 1
     125: goto          46
     128: getstatic     #10                 // Field maxValue:I
     131: iload         4
     133: invokestatic  #122                // Method java/lang/Math.max:(II)I
     136: putstatic     #10                 // Field maxValue:I
     139: getstatic     #17                 // Field minValue:I
     142: iload         4
     144: invokestatic  #125                // Method java/lang/Math.min:(II)I
     147: putstatic     #17                 // Field minValue:I
     150: return
     151: aload_2
     152: astore        4
     154: iconst_0
     155: istore        5
     157: iconst_0
     158: istore        6
     160: iconst_0
     161: istore        7
     163: aload         4
     165: arraylength
     166: istore        8
     168: iload         7
     170: iload         8
     172: if_icmpge     254
     175: aload         4
     177: iload         7
     179: iaload
     180: istore        9
     182: iload         6
     184: iinc          6, 1
     187: iload         9
     189: istore        10
     191: istore        11
     193: iconst_0
     194: istore        12
     196: iconst_0
     197: iload         10
     199: if_icmpge     246
     202: aload_1
     203: iload_3
     204: iload         11
     206: iastore
     207: aload_2
     208: iload         11
     210: aload_2
     211: iload         11
     213: iaload
     214: iconst_m1
     215: iadd
     216: iastore
     217: aload_2
     218: iload         11
     220: iaload
     221: pop
     222: aload_0
     223: aload_1
     224: aload_2
     225: iload_3
     226: iconst_1
     227: iadd
     228: invokestatic  #127                // Method dfs:([I[I[II)V
     231: aload_2
     232: iload         11
     234: aload_2
     235: iload         11
     237: iaload
     238: iconst_1
     239: iadd
     240: iastore
     241: aload_2
     242: iload         11
     244: iaload
     245: pop
     246: nop
     247: nop
     248: iinc          7, 1
     251: goto          168
     254: nop
     255: return

  public static void dfs$default(int[], int[], int[], int, int, java.lang.Object);
    Code:
       0: iload         4
       2: bipush        8
       4: iand
       5: ifeq          10
       8: iconst_0
       9: istore_3
      10: aload_0
      11: aload_1
      12: aload_2
      13: iload_3
      14: invokestatic  #127                // Method dfs:([I[I[II)V
      17: return

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

  static {};
    Code:
       0: ldc           #144                // int -2147483648
       2: putstatic     #10                 // Field maxValue:I
       5: ldc           #145                // int 2147483647
       7: putstatic     #17                 // Field minValue:I
      10: return
}


package day4

import java.io.File

data class Number(
    val value: Int,
    var marked: Boolean = false
)

data class Board(
    val data: Array<Array<Number>> = Array(5) { Array(5) { Number(0) } }
) {
    override fun equals(other: Any?): Boolean {
        if (other !is Board) return false
        return data.contentEquals(other.data)
    }

    override fun hashCode(): Int {
        return data.contentHashCode()
    }

    override fun toString(): String {
        return data.joinToString("\n") { row ->
            row.joinToString(" ") { number ->
                if (number.marked) "X" else number.value.toString()
            }
        }
    }

    fun mark(value: Int) {
        data.forEach { row ->
            row.forEach { number ->
                if (number.value == value) number.marked = true
            }
        }
    }

    fun sumUnmarkedNumbers(): Int {
        return data.flatten().filter { !it.marked }.sumBy { it.value }
    }

    fun isWinner(): Boolean {
        return isRowWinner() || isColumnWinner()
    }

    private fun isRowWinner(): Boolean {
        for (y in 0 until 5) {
            var winner = true
            for (x in 0 until 5) {
                if (!data[y][x].marked) {
                    winner = false
                }
            }
            if (winner) return true
         }

        return false
    }

    private fun isColumnWinner(): Boolean {
        for (x in 0 until 5) {
            var winner = true
            for (y in 0 until 5) {
                if (!data[y][x].marked) {
                    winner = false
                }
            }
            if (winner) return true
        }

        return false
    }
}

fun readBoard(data: List<String>, position: Int): Board {
    val boardData = data.subList(position, position + 5)
    val board = Board()

    boardData.forEachIndexed { row, line ->
        val rowData = line.split(" ").filter { it.isNotEmpty() }.map { it.toInt() }
        rowData.forEachIndexed { column, value ->
            board.data[row][column] = Number(value)
        }
    }

    return board
}

fun readData(): Pair<List<Int>, List<Board>> {
    val values = File("day4.txt").readLines()

    val numbers = values[0].split(",").map { it.toInt() }
    val boards = mutableListOf<Board>()

    for (i in 2 until values.size step 6) {
        val board = readBoard(values, i)
        boards.add(board)
    }

    return Pair(numbers, boards)
}

fun findWinningBoard(numbers: List<Int>, boards: List<Board>): Pair<Int, Board> {
    for (number in numbers) {
        for (board in boards) {
            board.mark(number)
            if (board.isWinner()) {
                return Pair(number, board)
            }
        }
    }

    throw IllegalStateException("No winning board found")
}

fun part1() {
    val (numbers, boards) = readData()

    val (number, board) = findWinningBoard(numbers, boards)

    println("Winning number: $number")
    println("Winning board:")
    println(board)

    val sum = board.sumUnmarkedNumbers()
    println("Unmarked numbers sum: $sum")

    println()
    println("Result: ${sum * number}")
}

fun part2() {
    val (numbers, boards) = readData()

    val boardCandidates = boards.toMutableList()

    while (boardCandidates.size > 1) {
        // Find the winning board and remove it from the list
        val (number, winningBoard) = findWinningBoard(numbers, boardCandidates)
        boardCandidates.remove(winningBoard)
    }

    val board = boardCandidates[0]

    val (number, winningBoard) = findWinningBoard(numbers, listOf(board))

    println("Last number: $number")

    println("Winning board found:")
    println(winningBoard)

    val sum = winningBoard.sumUnmarkedNumbers()
    println("Unmarked numbers sum: $sum")

    println()
    println("Result: ${sum * number}")
}

fun main() {
    part2()
}

Compiled from "Day4.kt"
public final class day4.Day4Kt {
  public static final day4.Board readBoard(java.util.List<java.lang.String>, int);
    Code:
       0: aload_0
       1: ldc           #10                 // String data
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: iload_1
       8: iload_1
       9: iconst_5
      10: iadd
      11: invokeinterface #22,  3           // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
      16: astore_2
      17: new           #24                 // class day4/Board
      20: dup
      21: aconst_null
      22: iconst_1
      23: aconst_null
      24: invokespecial #28                 // Method day4/Board."<init>":([[Lday4/Number;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
      27: astore_3
      28: aload_2
      29: checkcast     #30                 // class java/lang/Iterable
      32: astore        4
      34: iconst_0
      35: istore        5
      37: iconst_0
      38: istore        6
      40: aload         4
      42: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      47: astore        7
      49: aload         7
      51: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      56: ifeq          442
      59: aload         7
      61: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      66: astore        8
      68: iload         6
      70: iinc          6, 1
      73: istore        9
      75: iload         9
      77: ifge          83
      80: invokestatic  #50                 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
      83: iload         9
      85: aload         8
      87: checkcast     #52                 // class java/lang/String
      90: astore        10
      92: istore        11
      94: iconst_0
      95: istore        12
      97: aload         10
      99: checkcast     #54                 // class java/lang/CharSequence
     102: iconst_1
     103: anewarray     #52                 // class java/lang/String
     106: astore        13
     108: aload         13
     110: iconst_0
     111: ldc           #56                 // String
     113: aastore
     114: aload         13
     116: iconst_0
     117: iconst_0
     118: bipush        6
     120: aconst_null
     121: invokestatic  #62                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     124: checkcast     #30                 // class java/lang/Iterable
     127: astore        13
     129: iconst_0
     130: istore        14
     132: aload         13
     134: astore        15
     136: new           #64                 // class java/util/ArrayList
     139: dup
     140: invokespecial #66                 // Method java/util/ArrayList."<init>":()V
     143: checkcast     #68                 // class java/util/Collection
     146: astore        16
     148: iconst_0
     149: istore        17
     151: aload         15
     153: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     158: astore        18
     160: aload         18
     162: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     167: ifeq          224
     170: aload         18
     172: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     177: astore        19
     179: aload         19
     181: checkcast     #52                 // class java/lang/String
     184: astore        20
     186: iconst_0
     187: istore        21
     189: aload         20
     191: checkcast     #54                 // class java/lang/CharSequence
     194: invokeinterface #72,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     199: ifle          206
     202: iconst_1
     203: goto          207
     206: iconst_0
     207: nop
     208: ifeq          160
     211: aload         16
     213: aload         19
     215: invokeinterface #76,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     220: pop
     221: goto          160
     224: aload         16
     226: checkcast     #18                 // class java/util/List
     229: nop
     230: checkcast     #30                 // class java/lang/Iterable
     233: astore        13
     235: nop
     236: iconst_0
     237: istore        14
     239: aload         13
     241: astore        15
     243: new           #64                 // class java/util/ArrayList
     246: dup
     247: aload         13
     249: bipush        10
     251: invokestatic  #80                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     254: invokespecial #83                 // Method java/util/ArrayList."<init>":(I)V
     257: checkcast     #68                 // class java/util/Collection
     260: astore        16
     262: iconst_0
     263: istore        17
     265: aload         15
     267: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     272: astore        18
     274: aload         18
     276: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     281: ifeq          328
     284: aload         18
     286: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     291: astore        19
     293: aload         16
     295: aload         19
     297: checkcast     #52                 // class java/lang/String
     300: astore        20
     302: astore        22
     304: iconst_0
     305: istore        21
     307: aload         20
     309: invokestatic  #89                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     312: nop
     313: invokestatic  #93                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     316: aload         22
     318: swap
     319: invokeinterface #76,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     324: pop
     325: goto          274
     328: aload         16
     330: checkcast     #18                 // class java/util/List
     333: nop
     334: astore        23
     336: aload         23
     338: checkcast     #30                 // class java/lang/Iterable
     341: astore        13
     343: iconst_0
     344: istore        14
     346: iconst_0
     347: istore        15
     349: aload         13
     351: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     356: astore        16
     358: aload         16
     360: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     365: ifeq          436
     368: aload         16
     370: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     375: astore        17
     377: iload         15
     379: iinc          15, 1
     382: istore        18
     384: iload         18
     386: ifge          392
     389: invokestatic  #50                 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     392: iload         18
     394: aload         17
     396: checkcast     #95                 // class java/lang/Number
     399: invokevirtual #98                 // Method java/lang/Number.intValue:()I
     402: istore        19
     404: istore        20
     406: iconst_0
     407: istore        21
     409: aload_3
     410: invokevirtual #102                // Method day4/Board.getData:()[[Lday4/Number;
     413: iload         11
     415: aaload
     416: iload         20
     418: new           #104                // class day4/Number
     421: dup
     422: iload         19
     424: iconst_0
     425: iconst_2
     426: aconst_null
     427: invokespecial #107                // Method day4/Number."<init>":(IZILkotlin/jvm/internal/DefaultConstructorMarker;)V
     430: aastore
     431: nop
     432: nop
     433: goto          358
     436: nop
     437: nop
     438: nop
     439: goto          49
     442: nop
     443: aload_3
     444: areturn

  public static final kotlin.Pair<java.util.List<java.lang.Integer>, java.util.List<day4.Board>> readData();
    Code:
       0: new           #147                // class java/io/File
       3: dup
       4: ldc           #149                // String day4.txt
       6: invokespecial #152                // Method java/io/File."<init>":(Ljava/lang/String;)V
       9: aconst_null
      10: iconst_1
      11: aconst_null
      12: invokestatic  #158                // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;
      15: astore_0
      16: aload_0
      17: iconst_0
      18: invokeinterface #162,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      23: checkcast     #54                 // class java/lang/CharSequence
      26: iconst_1
      27: anewarray     #52                 // class java/lang/String
      30: astore_2
      31: aload_2
      32: iconst_0
      33: ldc           #164                // String ,
      35: aastore
      36: aload_2
      37: iconst_0
      38: iconst_0
      39: bipush        6
      41: aconst_null
      42: invokestatic  #62                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      45: checkcast     #30                 // class java/lang/Iterable
      48: astore_2
      49: iconst_0
      50: istore_3
      51: aload_2
      52: astore        4
      54: new           #64                 // class java/util/ArrayList
      57: dup
      58: aload_2
      59: bipush        10
      61: invokestatic  #80                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      64: invokespecial #83                 // Method java/util/ArrayList."<init>":(I)V
      67: checkcast     #68                 // class java/util/Collection
      70: astore        5
      72: iconst_0
      73: istore        6
      75: aload         4
      77: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      82: astore        7
      84: aload         7
      86: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      91: ifeq          138
      94: aload         7
      96: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     101: astore        8
     103: aload         5
     105: aload         8
     107: checkcast     #52                 // class java/lang/String
     110: astore        9
     112: astore        11
     114: iconst_0
     115: istore        10
     117: aload         9
     119: invokestatic  #89                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     122: nop
     123: invokestatic  #93                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     126: aload         11
     128: swap
     129: invokeinterface #76,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     134: pop
     135: goto          84
     138: aload         5
     140: checkcast     #18                 // class java/util/List
     143: nop
     144: astore_1
     145: new           #64                 // class java/util/ArrayList
     148: dup
     149: invokespecial #66                 // Method java/util/ArrayList."<init>":()V
     152: checkcast     #18                 // class java/util/List
     155: astore_2
     156: iconst_2
     157: aload_0
     158: invokeinterface #167,  1          // InterfaceMethod java/util/List.size:()I
     163: invokestatic  #173                // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
     166: checkcast     #175                // class kotlin/ranges/IntProgression
     169: bipush        6
     171: invokestatic  #179                // Method kotlin/ranges/RangesKt.step:(Lkotlin/ranges/IntProgression;I)Lkotlin/ranges/IntProgression;
     174: astore_3
     175: aload_3
     176: invokevirtual #182                // Method kotlin/ranges/IntProgression.getFirst:()I
     179: istore        4
     181: aload_3
     182: invokevirtual #185                // Method kotlin/ranges/IntProgression.getLast:()I
     185: istore        5
     187: aload_3
     188: invokevirtual #188                // Method kotlin/ranges/IntProgression.getStep:()I
     191: istore        6
     193: iload         6
     195: ifle          205
     198: iload         4
     200: iload         5
     202: if_icmple     217
     205: iload         6
     207: ifge          251
     210: iload         5
     212: iload         4
     214: if_icmpgt     251
     217: aload_0
     218: iload         4
     220: invokestatic  #190                // Method readBoard:(Ljava/util/List;I)Lday4/Board;
     223: astore        7
     225: aload_2
     226: aload         7
     228: invokeinterface #191,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     233: pop
     234: iload         4
     236: iload         5
     238: if_icmpeq     251
     241: iload         4
     243: iload         6
     245: iadd
     246: istore        4
     248: goto          217
     251: new           #193                // class kotlin/Pair
     254: dup
     255: aload_1
     256: aload_2
     257: invokespecial #196                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     260: areturn

  public static final kotlin.Pair<java.lang.Integer, day4.Board> findWinningBoard(java.util.List<java.lang.Integer>, java.util.List<day4.Board>);
    Code:
       0: aload_0
       1: ldc           #205                // String numbers
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #206                // String boards
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: invokeinterface #207,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
      18: astore_2
      19: aload_2
      20: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      25: ifeq          99
      28: aload_2
      29: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      34: checkcast     #95                 // class java/lang/Number
      37: invokevirtual #98                 // Method java/lang/Number.intValue:()I
      40: istore_3
      41: aload_1
      42: invokeinterface #207,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
      47: astore        4
      49: aload         4
      51: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      56: ifeq          19
      59: aload         4
      61: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      66: checkcast     #24                 // class day4/Board
      69: astore        5
      71: aload         5
      73: iload_3
      74: invokevirtual #210                // Method day4/Board.mark:(I)V
      77: aload         5
      79: invokevirtual #213                // Method day4/Board.isWinner:()Z
      82: ifeq          49
      85: new           #193                // class kotlin/Pair
      88: dup
      89: iload_3
      90: invokestatic  #93                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      93: aload         5
      95: invokespecial #196                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
      98: areturn
      99: new           #215                // class java/lang/IllegalStateException
     102: dup
     103: ldc           #217                // String No winning board found
     105: invokespecial #218                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     108: athrow

  public static final void part1();
    Code:
       0: invokestatic  #222                // Method readData:()Lkotlin/Pair;
       3: astore_0
       4: aload_0
       5: invokevirtual #225                // Method kotlin/Pair.component1:()Ljava/lang/Object;
       8: checkcast     #18                 // class java/util/List
      11: astore_1
      12: aload_0
      13: invokevirtual #228                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      16: checkcast     #18                 // class java/util/List
      19: astore_2
      20: aload_1
      21: aload_2
      22: invokestatic  #230                // Method findWinningBoard:(Ljava/util/List;Ljava/util/List;)Lkotlin/Pair;
      25: astore_3
      26: aload_3
      27: invokevirtual #225                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      30: checkcast     #95                 // class java/lang/Number
      33: invokevirtual #98                 // Method java/lang/Number.intValue:()I
      36: istore        4
      38: aload_3
      39: invokevirtual #228                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      42: checkcast     #24                 // class day4/Board
      45: astore        5
      47: new           #232                // class java/lang/StringBuilder
      50: dup
      51: invokespecial #233                // Method java/lang/StringBuilder."<init>":()V
      54: ldc           #235                // String Winning number:
      56: invokevirtual #239                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      59: iload         4
      61: invokevirtual #242                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      64: invokevirtual #246                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      67: getstatic     #252                // Field java/lang/System.out:Ljava/io/PrintStream;
      70: swap
      71: invokevirtual #258                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      74: ldc_w         #260                // String Winning board:
      77: getstatic     #252                // Field java/lang/System.out:Ljava/io/PrintStream;
      80: swap
      81: invokevirtual #258                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      84: getstatic     #252                // Field java/lang/System.out:Ljava/io/PrintStream;
      87: aload         5
      89: invokevirtual #258                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      92: aload         5
      94: invokevirtual #263                // Method day4/Board.sumUnmarkedNumbers:()I
      97: istore        6
      99: new           #232                // class java/lang/StringBuilder
     102: dup
     103: invokespecial #233                // Method java/lang/StringBuilder."<init>":()V
     106: ldc_w         #265                // String Unmarked numbers sum:
     109: invokevirtual #239                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     112: iload         6
     114: invokevirtual #242                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     117: invokevirtual #246                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     120: getstatic     #252                // Field java/lang/System.out:Ljava/io/PrintStream;
     123: swap
     124: invokevirtual #258                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     127: getstatic     #252                // Field java/lang/System.out:Ljava/io/PrintStream;
     130: invokevirtual #267                // Method java/io/PrintStream.println:()V
     133: new           #232                // class java/lang/StringBuilder
     136: dup
     137: invokespecial #233                // Method java/lang/StringBuilder."<init>":()V
     140: ldc_w         #269                // String Result:
     143: invokevirtual #239                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     146: iload         6
     148: iload         4
     150: imul
     151: invokevirtual #242                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     154: invokevirtual #246                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     157: getstatic     #252                // Field java/lang/System.out:Ljava/io/PrintStream;
     160: swap
     161: invokevirtual #258                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     164: return

  public static final void part2();
    Code:
       0: invokestatic  #222                // Method readData:()Lkotlin/Pair;
       3: astore_0
       4: aload_0
       5: invokevirtual #225                // Method kotlin/Pair.component1:()Ljava/lang/Object;
       8: checkcast     #18                 // class java/util/List
      11: astore_1
      12: aload_0
      13: invokevirtual #228                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      16: checkcast     #18                 // class java/util/List
      19: astore_2
      20: aload_2
      21: checkcast     #68                 // class java/util/Collection
      24: invokestatic  #275                // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;
      27: astore_3
      28: aload_3
      29: invokeinterface #167,  1          // InterfaceMethod java/util/List.size:()I
      34: iconst_1
      35: if_icmple     80
      38: aload_1
      39: aload_3
      40: invokestatic  #230                // Method findWinningBoard:(Ljava/util/List;Ljava/util/List;)Lkotlin/Pair;
      43: astore        4
      45: aload         4
      47: invokevirtual #225                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      50: checkcast     #95                 // class java/lang/Number
      53: invokevirtual #98                 // Method java/lang/Number.intValue:()I
      56: istore        5
      58: aload         4
      60: invokevirtual #228                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      63: checkcast     #24                 // class day4/Board
      66: astore        6
      68: aload_3
      69: aload         6
      71: invokeinterface #278,  2          // InterfaceMethod java/util/List.remove:(Ljava/lang/Object;)Z
      76: pop
      77: goto          28
      80: aload_3
      81: iconst_0
      82: invokeinterface #162,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      87: checkcast     #24                 // class day4/Board
      90: astore        4
      92: aload_1
      93: aload         4
      95: invokestatic  #282                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
      98: invokestatic  #230                // Method findWinningBoard:(Ljava/util/List;Ljava/util/List;)Lkotlin/Pair;
     101: astore        5
     103: aload         5
     105: invokevirtual #225                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     108: checkcast     #95                 // class java/lang/Number
     111: invokevirtual #98                 // Method java/lang/Number.intValue:()I
     114: istore        6
     116: aload         5
     118: invokevirtual #228                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     121: checkcast     #24                 // class day4/Board
     124: astore        7
     126: new           #232                // class java/lang/StringBuilder
     129: dup
     130: invokespecial #233                // Method java/lang/StringBuilder."<init>":()V
     133: ldc_w         #284                // String Last number:
     136: invokevirtual #239                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     139: iload         6
     141: invokevirtual #242                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     144: invokevirtual #246                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     147: getstatic     #252                // Field java/lang/System.out:Ljava/io/PrintStream;
     150: swap
     151: invokevirtual #258                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     154: ldc_w         #286                // String Winning board found:
     157: getstatic     #252                // Field java/lang/System.out:Ljava/io/PrintStream;
     160: swap
     161: invokevirtual #258                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     164: getstatic     #252                // Field java/lang/System.out:Ljava/io/PrintStream;
     167: aload         7
     169: invokevirtual #258                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     172: aload         7
     174: invokevirtual #263                // Method day4/Board.sumUnmarkedNumbers:()I
     177: istore        8
     179: new           #232                // class java/lang/StringBuilder
     182: dup
     183: invokespecial #233                // Method java/lang/StringBuilder."<init>":()V
     186: ldc_w         #265                // String Unmarked numbers sum:
     189: invokevirtual #239                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     192: iload         8
     194: invokevirtual #242                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     197: invokevirtual #246                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     200: getstatic     #252                // Field java/lang/System.out:Ljava/io/PrintStream;
     203: swap
     204: invokevirtual #258                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     207: getstatic     #252                // Field java/lang/System.out:Ljava/io/PrintStream;
     210: invokevirtual #267                // Method java/io/PrintStream.println:()V
     213: new           #232                // class java/lang/StringBuilder
     216: dup
     217: invokespecial #233                // Method java/lang/StringBuilder."<init>":()V
     220: ldc_w         #269                // String Result:
     223: invokevirtual #239                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     226: iload         8
     228: iload         6
     230: imul
     231: invokevirtual #242                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     234: invokevirtual #246                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     237: getstatic     #252                // Field java/lang/System.out:Ljava/io/PrintStream;
     240: swap
     241: invokevirtual #258                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     244: return

  public static final void main();
    Code:
       0: invokestatic  #291                // Method part2:()V
       3: return

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