package day10

import java.io.File

fun main() {
    val data = parse("src/main/kotlin/day10/Day10.txt")

    val answer1 = part1(data)
    val answer2 = part2(data)

    println("🎄 Day 10 🎄")

    println()

    println("[Part 1]")
    println("Answer: $answer1")

    println()

    println("[Part 2]")
    println("Answer: $answer2")
}

private fun parse(path: String) =
    File(path).readLines()

private fun part1(lines: List<String>): Long {
    var sum = 0L
    for (line in lines) {
        val stack = ArrayDeque<Char>()
        for (char in line) {
            when (char) {
                '(' -> stack.addLast(')')
                '[' -> stack.addLast(']')
                '{' -> stack.addLast('}')
                '<' -> stack.addLast('>')
                else -> if (char != stack.removeLast()) {
                    when (char) {
                        ')' -> sum += 3
                        ']' -> sum += 57
                        '}' -> sum += 1197
                        '>' -> sum += 25137
                    }
                    break
                }
            }
        }
    }
    return sum
}

private fun part2(lines: List<String>): Long {
    val scores = mutableListOf<Long>()

    outer@
    for (line in lines) {
        val stack = ArrayDeque<Char>()
        for (char in line) {
            when (char) {
                '(' -> stack.addFirst(')')
                '[' -> stack.addFirst(']')
                '{' -> stack.addFirst('}')
                '<' -> stack.addFirst('>')
                else -> if (char != stack.removeFirst()) {
                    continue@outer
                }
            }
        }
        val score = stack.fold(0) { acc: Long, expected ->
            when (expected) {
                ')' -> acc * 5 + 1
                ']' -> acc * 5 + 2
                '}' -> acc * 5 + 3
                '>' -> acc * 5 + 4
                else -> error("Invalid closing character")
            }
        }
        scores.add(score)
    }

    return scores.sorted().run { this[size / 2] }
}

Compiled from "Day10.kt"
public final class day10.Day10Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String src/main/kotlin/day10/Day10.txt
       2: invokestatic  #12                 // Method parse:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: aload_0
       7: invokestatic  #16                 // Method part1:(Ljava/util/List;)J
      10: lstore_1
      11: aload_0
      12: invokestatic  #19                 // Method part2:(Ljava/util/List;)J
      15: lstore_3
      16: ldc           #21                 // String 🎄 Day 10 🎄
      18: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
      21: swap
      22: invokevirtual #33                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      25: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
      28: invokevirtual #35                 // Method java/io/PrintStream.println:()V
      31: ldc           #37                 // String [Part 1]
      33: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
      36: swap
      37: invokevirtual #33                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      40: new           #39                 // class java/lang/StringBuilder
      43: dup
      44: invokespecial #42                 // Method java/lang/StringBuilder."<init>":()V
      47: ldc           #44                 // String Answer:
      49: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      52: lload_1
      53: invokevirtual #51                 // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;
      56: invokevirtual #55                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      59: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
      62: swap
      63: invokevirtual #33                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      66: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
      69: invokevirtual #35                 // Method java/io/PrintStream.println:()V
      72: ldc           #57                 // String [Part 2]
      74: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
      77: swap
      78: invokevirtual #33                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      81: new           #39                 // class java/lang/StringBuilder
      84: dup
      85: invokespecial #42                 // Method java/lang/StringBuilder."<init>":()V
      88: ldc           #44                 // String Answer:
      90: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      93: lload_3
      94: invokevirtual #51                 // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;
      97: invokevirtual #55                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     100: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
     103: swap
     104: invokevirtual #33                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     107: return

  private static final java.util.List<java.lang.String> parse(java.lang.String);
    Code:
       0: new           #65                 // class java/io/File
       3: dup
       4: aload_0
       5: invokespecial #68                 // Method java/io/File."<init>":(Ljava/lang/String;)V
       8: aconst_null
       9: iconst_1
      10: aconst_null
      11: invokestatic  #74                 // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;
      14: areturn

  private static final long part1(java.util.List<java.lang.String>);
    Code:
       0: lconst_0
       1: lstore_1
       2: aload_0
       3: invokeinterface #83,  1           // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
       8: astore_3
       9: aload_3
      10: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      15: ifeq          263
      18: aload_3
      19: invokeinterface #93,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      24: checkcast     #95                 // class java/lang/String
      27: astore        4
      29: new           #97                 // class kotlin/collections/ArrayDeque
      32: dup
      33: invokespecial #98                 // Method kotlin/collections/ArrayDeque."<init>":()V
      36: astore        5
      38: iconst_0
      39: istore        6
      41: aload         4
      43: invokevirtual #102                // Method java/lang/String.length:()I
      46: istore        7
      48: iload         6
      50: iload         7
      52: if_icmpge     9
      55: aload         4
      57: iload         6
      59: invokevirtual #106                // Method java/lang/String.charAt:(I)C
      62: istore        8
      64: iload         8
      66: lookupswitch  { // 4
                    40: 108
                    60: 147
                    91: 121
                   123: 134
               default: 160
          }
     108: aload         5
     110: bipush        41
     112: invokestatic  #112                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     115: invokevirtual #115                // Method kotlin/collections/ArrayDeque.addLast:(Ljava/lang/Object;)V
     118: goto          257
     121: aload         5
     123: bipush        93
     125: invokestatic  #112                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     128: invokevirtual #115                // Method kotlin/collections/ArrayDeque.addLast:(Ljava/lang/Object;)V
     131: goto          257
     134: aload         5
     136: bipush        125
     138: invokestatic  #112                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     141: invokevirtual #115                // Method kotlin/collections/ArrayDeque.addLast:(Ljava/lang/Object;)V
     144: goto          257
     147: aload         5
     149: bipush        62
     151: invokestatic  #112                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     154: invokevirtual #115                // Method kotlin/collections/ArrayDeque.addLast:(Ljava/lang/Object;)V
     157: goto          257
     160: iload         8
     162: aload         5
     164: invokevirtual #118                // Method kotlin/collections/ArrayDeque.removeLast:()Ljava/lang/Object;
     167: checkcast     #108                // class java/lang/Character
     170: invokevirtual #122                // Method java/lang/Character.charValue:()C
     173: if_icmpeq     257
     176: iload         8
     178: lookupswitch  { // 4
                    41: 220
                    62: 247
                    93: 228
                   125: 237
               default: 254
          }
     220: lload_1
     221: iconst_3
     222: i2l
     223: ladd
     224: lstore_1
     225: goto          254
     228: lload_1
     229: bipush        57
     231: i2l
     232: ladd
     233: lstore_1
     234: goto          254
     237: lload_1
     238: sipush        1197
     241: i2l
     242: ladd
     243: lstore_1
     244: goto          254
     247: lload_1
     248: sipush        25137
     251: i2l
     252: ladd
     253: lstore_1
     254: goto          9
     257: iinc          6, 1
     260: goto          48
     263: lload_1
     264: lreturn

  private static final long part2(java.util.List<java.lang.String>);
    Code:
       0: new           #131                // class java/util/ArrayList
       3: dup
       4: invokespecial #132                // Method java/util/ArrayList."<init>":()V
       7: checkcast     #79                 // class java/util/List
      10: astore_1
      11: aload_0
      12: invokeinterface #83,  1           // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
      17: astore_2
      18: aload_2
      19: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      24: ifeq          381
      27: aload_2
      28: invokeinterface #93,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      33: checkcast     #95                 // class java/lang/String
      36: astore_3
      37: new           #97                 // class kotlin/collections/ArrayDeque
      40: dup
      41: invokespecial #98                 // Method kotlin/collections/ArrayDeque."<init>":()V
      44: astore        4
      46: iconst_0
      47: istore        5
      49: aload_3
      50: invokevirtual #102                // Method java/lang/String.length:()I
      53: istore        6
      55: iload         5
      57: iload         6
      59: if_icmpge     193
      62: aload_3
      63: iload         5
      65: invokevirtual #106                // Method java/lang/String.charAt:(I)C
      68: istore        7
      70: iload         7
      72: lookupswitch  { // 4
                    40: 116
                    60: 155
                    91: 129
                   123: 142
               default: 168
          }
     116: aload         4
     118: bipush        41
     120: invokestatic  #112                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     123: invokevirtual #135                // Method kotlin/collections/ArrayDeque.addFirst:(Ljava/lang/Object;)V
     126: goto          187
     129: aload         4
     131: bipush        93
     133: invokestatic  #112                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     136: invokevirtual #135                // Method kotlin/collections/ArrayDeque.addFirst:(Ljava/lang/Object;)V
     139: goto          187
     142: aload         4
     144: bipush        125
     146: invokestatic  #112                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     149: invokevirtual #135                // Method kotlin/collections/ArrayDeque.addFirst:(Ljava/lang/Object;)V
     152: goto          187
     155: aload         4
     157: bipush        62
     159: invokestatic  #112                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     162: invokevirtual #135                // Method kotlin/collections/ArrayDeque.addFirst:(Ljava/lang/Object;)V
     165: goto          187
     168: iload         7
     170: aload         4
     172: invokevirtual #138                // Method kotlin/collections/ArrayDeque.removeFirst:()Ljava/lang/Object;
     175: checkcast     #108                // class java/lang/Character
     178: invokevirtual #122                // Method java/lang/Character.charValue:()C
     181: if_icmpeq     187
     184: goto          18
     187: iinc          5, 1
     190: goto          55
     193: aload         4
     195: checkcast     #140                // class java/lang/Iterable
     198: astore        7
     200: lconst_0
     201: lstore        8
     203: iconst_0
     204: istore        10
     206: lload         8
     208: lstore        11
     210: aload         7
     212: invokeinterface #141,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     217: astore        13
     219: aload         13
     221: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     226: ifeq          362
     229: aload         13
     231: invokeinterface #93,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     236: astore        14
     238: lload         11
     240: aload         14
     242: checkcast     #108                // class java/lang/Character
     245: invokevirtual #122                // Method java/lang/Character.charValue:()C
     248: istore        15
     250: lstore        16
     252: iconst_0
     253: istore        18
     255: iload         15
     257: lookupswitch  { // 4
                    41: 300
                    62: 332
                    93: 310
                   125: 321
               default: 343
          }
     300: lload         16
     302: iconst_5
     303: i2l
     304: lmul
     305: lconst_1
     306: ladd
     307: goto          356
     310: lload         16
     312: iconst_5
     313: i2l
     314: lmul
     315: iconst_2
     316: i2l
     317: ladd
     318: goto          356
     321: lload         16
     323: iconst_5
     324: i2l
     325: lmul
     326: iconst_3
     327: i2l
     328: ladd
     329: goto          356
     332: lload         16
     334: iconst_5
     335: i2l
     336: lmul
     337: iconst_4
     338: i2l
     339: ladd
     340: goto          356
     343: new           #143                // class java/lang/IllegalStateException
     346: dup
     347: ldc           #145                // String Invalid closing character
     349: invokevirtual #146                // Method java/lang/Object.toString:()Ljava/lang/String;
     352: invokespecial #147                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     355: athrow
     356: nop
     357: lstore        11
     359: goto          219
     362: lload         11
     364: lstore        5
     366: aload_1
     367: lload         5
     369: invokestatic  #152                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     372: invokeinterface #156,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     377: pop
     378: goto          18
     381: aload_1
     382: checkcast     #140                // class java/lang/Iterable
     385: invokestatic  #162                // Method kotlin/collections/CollectionsKt.sorted:(Ljava/lang/Iterable;)Ljava/util/List;
     388: astore_3
     389: iconst_0
     390: istore        4
     392: aload_3
     393: aload_3
     394: invokeinterface #165,  1          // InterfaceMethod java/util/List.size:()I
     399: iconst_2
     400: idiv
     401: invokeinterface #169,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     406: checkcast     #171                // class java/lang/Number
     409: invokevirtual #175                // Method java/lang/Number.longValue:()J
     412: nop
     413: lreturn

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


package day17

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

fun main() {
    val data = parse("src/main/kotlin/day17/Day17.txt")

    val answer1 = part1(data)
    val answer2 = part2(data)

    println("🎄 Day 17 🎄")

    println()

    println("[Part 1]")
    println("Answer: $answer1")

    println()

    println("[Part 2]")
    println("Answer: $answer2")
}

private data class Target(
    val x1: Int,
    val x2: Int,
    val y1: Int,
    val y2: Int,
)

private fun parse(path: String): Target {
    val regex = """target area: x=(-?\d+)\.\.(-?\d+), y=(-?\d+)\.\.(-?\d+)""".toRegex()

    val contents = File(path).readText()
    val (x1, x2, y1, y2) = regex.find(contents)!!.destructured

    return Target(x1.toInt(), x2.toInt(), y1.toInt(), y2.toInt())
}

// Frankly, this problem is very confusing to me, and I doubt this solution
// will work for any input that adheres to the description. But it worked for
// me, and I don't feel interested in making this any more flexible ¯\_(ツ)_/¯

private fun part1(target: Target): Int =
    (abs(target.y1) - 1).let { n -> n * (n + 1) / 2 }

private fun Target.isReachedBy(vx: Int, vy: Int): Boolean {
    var (x, y) = 0 to 0
    var (dx, dy) = vx to vy

    while (x <= x2 && y >= y1) {
        x += dx
        y += dy

        if (x in x1..x2 && y in y1..y2) {
            return true
        }

        dx = max(dx - 1, 0)
        dy -= 1
    }

    return false
}

private fun part2(target: Target): Int {
    val (vx0, vx1) = 1 to target.x2
    val (vy0, vy1) = target.y1 to part1(target)

    var counter = 0
    for (vy in vy0..vy1) {
        for (vx in vx0..vx1) {
            if (target.isReachedBy(vx, vy)) {
                ++counter
            }
        }
    }

    return counter
}

Compiled from "Day17.kt"
public final class day17.Day17Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String src/main/kotlin/day17/Day17.txt
       2: invokestatic  #12                 // Method parse:(Ljava/lang/String;)Lday17/Target;
       5: astore_0
       6: aload_0
       7: invokestatic  #16                 // Method part1:(Lday17/Target;)I
      10: istore_1
      11: aload_0
      12: invokestatic  #19                 // Method part2:(Lday17/Target;)I
      15: istore_2
      16: ldc           #21                 // String 🎄 Day 17 🎄
      18: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
      21: swap
      22: invokevirtual #33                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      25: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
      28: invokevirtual #35                 // Method java/io/PrintStream.println:()V
      31: ldc           #37                 // String [Part 1]
      33: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
      36: swap
      37: invokevirtual #33                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      40: new           #39                 // class java/lang/StringBuilder
      43: dup
      44: invokespecial #42                 // Method java/lang/StringBuilder."<init>":()V
      47: ldc           #44                 // String Answer:
      49: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      52: iload_1
      53: invokevirtual #51                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      56: invokevirtual #55                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      59: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
      62: swap
      63: invokevirtual #33                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      66: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
      69: invokevirtual #35                 // Method java/io/PrintStream.println:()V
      72: ldc           #57                 // String [Part 2]
      74: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
      77: swap
      78: invokevirtual #33                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      81: new           #39                 // class java/lang/StringBuilder
      84: dup
      85: invokespecial #42                 // Method java/lang/StringBuilder."<init>":()V
      88: ldc           #44                 // String Answer:
      90: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      93: iload_2
      94: invokevirtual #51                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      97: invokevirtual #55                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     100: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
     103: swap
     104: invokevirtual #33                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     107: return

  private static final day17.Target parse(java.lang.String);
    Code:
       0: new           #64                 // class kotlin/text/Regex
       3: dup
       4: ldc           #66                 // String target area: x=(-?\\d+)\\.\\.(-?\\d+), y=(-?\\d+)\\.\\.(-?\\d+)
       6: invokespecial #69                 // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
       9: astore_1
      10: new           #71                 // class java/io/File
      13: dup
      14: aload_0
      15: invokespecial #72                 // Method java/io/File."<init>":(Ljava/lang/String;)V
      18: aconst_null
      19: iconst_1
      20: aconst_null
      21: invokestatic  #78                 // Method kotlin/io/FilesKt.readText$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/lang/String;
      24: astore_2
      25: aload_1
      26: aload_2
      27: checkcast     #80                 // class java/lang/CharSequence
      30: iconst_0
      31: iconst_2
      32: aconst_null
      33: invokestatic  #84                 // Method kotlin/text/Regex.find$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/text/MatchResult;
      36: dup
      37: invokestatic  #89                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      40: invokeinterface #95,  1           // InterfaceMethod kotlin/text/MatchResult.getDestructured:()Lkotlin/text/MatchResult$Destructured;
      45: astore_3
      46: aload_3
      47: invokevirtual #101                // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
      50: invokeinterface #105,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
      55: iconst_1
      56: invokeinterface #111,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      61: checkcast     #113                // class java/lang/String
      64: astore        4
      66: aload_3
      67: invokevirtual #101                // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
      70: invokeinterface #105,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
      75: iconst_2
      76: invokeinterface #111,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      81: checkcast     #113                // class java/lang/String
      84: astore        5
      86: aload_3
      87: invokevirtual #101                // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
      90: invokeinterface #105,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
      95: iconst_3
      96: invokeinterface #111,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     101: checkcast     #113                // class java/lang/String
     104: astore        6
     106: aload_3
     107: invokevirtual #101                // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     110: invokeinterface #105,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     115: iconst_4
     116: invokeinterface #111,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     121: checkcast     #113                // class java/lang/String
     124: astore        7
     126: new           #115                // class day17/Target
     129: dup
     130: aload         4
     132: invokestatic  #121                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     135: aload         5
     137: invokestatic  #121                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     140: aload         6
     142: invokestatic  #121                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     145: aload         7
     147: invokestatic  #121                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     150: invokespecial #124                // Method day17/Target."<init>":(IIII)V
     153: areturn

  private static final int part1(day17.Target);
    Code:
       0: aload_0
       1: invokevirtual #137                // Method day17/Target.getY1:()I
       4: invokestatic  #143                // Method java/lang/Math.abs:(I)I
       7: iconst_1
       8: isub
       9: istore_1
      10: iconst_0
      11: istore_2
      12: iload_1
      13: iload_1
      14: iconst_1
      15: iadd
      16: imul
      17: iconst_2
      18: idiv
      19: nop
      20: ireturn

  private static final boolean isReachedBy(day17.Target, int, int);
    Code:
       0: iconst_0
       1: invokestatic  #152                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
       4: iconst_0
       5: invokestatic  #152                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
       8: invokestatic  #158                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      11: astore_3
      12: aload_3
      13: invokevirtual #164                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      16: checkcast     #166                // class java/lang/Number
      19: invokevirtual #169                // Method java/lang/Number.intValue:()I
      22: istore        4
      24: aload_3
      25: invokevirtual #172                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      28: checkcast     #166                // class java/lang/Number
      31: invokevirtual #169                // Method java/lang/Number.intValue:()I
      34: istore        5
      36: iload_1
      37: invokestatic  #152                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      40: iload_2
      41: invokestatic  #152                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      44: invokestatic  #158                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      47: astore        6
      49: aload         6
      51: invokevirtual #164                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      54: checkcast     #166                // class java/lang/Number
      57: invokevirtual #169                // Method java/lang/Number.intValue:()I
      60: istore        7
      62: aload         6
      64: invokevirtual #172                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      67: checkcast     #166                // class java/lang/Number
      70: invokevirtual #169                // Method java/lang/Number.intValue:()I
      73: istore        8
      75: iload         4
      77: aload_0
      78: invokevirtual #175                // Method day17/Target.getX2:()I
      81: if_icmpgt     193
      84: iload         5
      86: aload_0
      87: invokevirtual #137                // Method day17/Target.getY1:()I
      90: if_icmplt     193
      93: iload         4
      95: iload         7
      97: iadd
      98: istore        4
     100: iload         5
     102: iload         8
     104: iadd
     105: istore        5
     107: aload_0
     108: invokevirtual #178                // Method day17/Target.getX1:()I
     111: istore        9
     113: iload         4
     115: aload_0
     116: invokevirtual #175                // Method day17/Target.getX2:()I
     119: if_icmpgt     137
     122: iload         9
     124: iload         4
     126: if_icmpgt     133
     129: iconst_1
     130: goto          138
     133: iconst_0
     134: goto          138
     137: iconst_0
     138: ifeq          177
     141: aload_0
     142: invokevirtual #137                // Method day17/Target.getY1:()I
     145: istore        9
     147: iload         5
     149: aload_0
     150: invokevirtual #181                // Method day17/Target.getY2:()I
     153: if_icmpgt     171
     156: iload         9
     158: iload         5
     160: if_icmpgt     167
     163: iconst_1
     164: goto          172
     167: iconst_0
     168: goto          172
     171: iconst_0
     172: ifeq          177
     175: iconst_1
     176: ireturn
     177: iload         7
     179: iconst_1
     180: isub
     181: iconst_0
     182: invokestatic  #185                // Method java/lang/Math.max:(II)I
     185: istore        7
     187: iinc          8, -1
     190: goto          75
     193: iconst_0
     194: ireturn

  private static final int part2(day17.Target);
    Code:
       0: iconst_1
       1: invokestatic  #152                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
       4: aload_0
       5: invokevirtual #175                // Method day17/Target.getX2:()I
       8: invokestatic  #152                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      11: invokestatic  #158                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      14: astore_1
      15: aload_1
      16: invokevirtual #164                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      19: checkcast     #166                // class java/lang/Number
      22: invokevirtual #169                // Method java/lang/Number.intValue:()I
      25: istore_2
      26: aload_1
      27: invokevirtual #172                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      30: checkcast     #166                // class java/lang/Number
      33: invokevirtual #169                // Method java/lang/Number.intValue:()I
      36: istore_3
      37: aload_0
      38: invokevirtual #137                // Method day17/Target.getY1:()I
      41: invokestatic  #152                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      44: aload_0
      45: invokestatic  #16                 // Method part1:(Lday17/Target;)I
      48: invokestatic  #152                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      51: invokestatic  #158                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      54: astore        4
      56: aload         4
      58: invokevirtual #164                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      61: checkcast     #166                // class java/lang/Number
      64: invokevirtual #169                // Method java/lang/Number.intValue:()I
      67: istore        5
      69: aload         4
      71: invokevirtual #172                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      74: checkcast     #166                // class java/lang/Number
      77: invokevirtual #169                // Method java/lang/Number.intValue:()I
      80: istore        6
      82: iconst_0
      83: istore        7
      85: iload         5
      87: istore        8
      89: iload         8
      91: iload         6
      93: if_icmpgt     144
      96: iload_2
      97: istore        9
      99: iload         9
     101: iload_3
     102: if_icmpgt     131
     105: aload_0
     106: iload         9
     108: iload         8
     110: invokestatic  #194                // Method isReachedBy:(Lday17/Target;II)Z
     113: ifeq          119
     116: iinc          7, 1
     119: iload         9
     121: iload_3
     122: if_icmpeq     131
     125: iinc          9, 1
     128: goto          105
     131: iload         8
     133: iload         6
     135: if_icmpeq     144
     138: iinc          8, 1
     141: goto          96
     144: iload         7
     146: ireturn

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


package course.kotlin.functions

fun <T> max(collection: Collection<T>, comparatorFn: (T, T) -> Int): T? {
    var maxElem: T? = null
    for (e in collection) {
        if (maxElem == null) {
            maxElem = e
        } else if (e != null && comparatorFn(e, maxElem) > 0)
            maxElem = e
    }
    return maxElem
}

fun compare(a: String, b: String): Int = a.length - b.length

fun main() {
    val strings = listOf("Orange", "Banana", "Pineapple", "Papaya", "Apple", "Plum")
    println(max(strings) { a, b -> a.length - b.length })

    val sum1: (Int, Int) -> Int = { x: Int, y: Int -> x + y }
    val sum = { x: Int, y: Int -> x + y }
    val ints = listOf(1, 2, 3)
    val product = ints.fold(1) { acc, e -> acc * e }
    run { println("...") }
    ints.filter { it > 0 } // this literal is of type '(it: Int) -> Boolean'

    ints.filter {
        val shouldFilter = it > 0
        shouldFilter
    }

    ints.filter {
        val shouldFilter = it > 0
        return@filter shouldFilter
    }

    strings.filter { it.length == 5 }.sortedBy { it }.map { it.uppercase() }

    val map = mapOf(1 to "x", 2 to "y", 3 to "z")
    map.forEach { _, value -> println("$value!") }

//    // destructuring
//    map.mapValues { entry -> "${entry.value}!" }
//    map.mapValues { (key, value) -> "$value!" }
//    map.mapValues { (_, value) -> "$value!" }
//    map.mapValues { (_, value): Map.Entry<Int, String> -> "$value!" }
//    map.mapValues { (_, value: String) -> "$value!" }
//
//    //anonimous functions
//    fun(x: Int, y: Int): Int = x + y
//    fun(x: Int, y: Int): Int {
//        return x + y
//    }
//    ints.filter(fun(item) = item > 0)
//
    //with receiver
    val sum2: Int.(Int) -> Int = { other -> plus(other) }
    val sum3 = fun Int.(other: Int): Int = this + other
    println(sum2(1, 2))
    println(sum3(1, 2))
}

Compiled from "Comparisons.kt"
public final class course.kotlin.functions.LambdasKt$main$$inlined$sortedBy$1<T> implements java.util.Comparator {
  public course.kotlin.functions.LambdasKt$main$$inlined$sortedBy$1();
    Code:
       0: aload_0
       1: invokespecial #16                 // Method java/lang/Object."<init>":()V
       4: return

  public final int compare(T, T);
    Code:
       0: aload_1
       1: checkcast     #23                 // class java/lang/String
       4: astore_3
       5: iconst_0
       6: istore        4
       8: aload_3
       9: checkcast     #25                 // class java/lang/Comparable
      12: aload_2
      13: checkcast     #23                 // class java/lang/String
      16: astore_3
      17: astore        5
      19: iconst_0
      20: istore        4
      22: aload_3
      23: aload         5
      25: swap
      26: checkcast     #25                 // class java/lang/Comparable
      29: invokestatic  #31                 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I
      32: ireturn
}

Compiled from "lambdas.kt"
public final class course.kotlin.functions.LambdasKt {
  public static final <T> T max(java.util.Collection<? extends T>, kotlin.jvm.functions.Function2<? super T, ? super T, java.lang.Integer>);
    Code:
       0: aload_0
       1: ldc           #11                 // String collection
       3: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #19                 // String comparatorFn
       9: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aconst_null
      13: astore_2
      14: aload_0
      15: invokeinterface #25,  1           // InterfaceMethod java/util/Collection.iterator:()Ljava/util/Iterator;
      20: astore_3
      21: aload_3
      22: invokeinterface #31,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      27: ifeq          77
      30: aload_3
      31: invokeinterface #35,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      36: astore        4
      38: aload_2
      39: ifnonnull     48
      42: aload         4
      44: astore_2
      45: goto          21
      48: aload         4
      50: ifnull        21
      53: aload_1
      54: aload         4
      56: aload_2
      57: invokeinterface #41,  3           // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      62: checkcast     #43                 // class java/lang/Number
      65: invokevirtual #47                 // Method java/lang/Number.intValue:()I
      68: ifle          21
      71: aload         4
      73: astore_2
      74: goto          21
      77: aload_2
      78: areturn

  public static final int compare(java.lang.String, java.lang.String);
    Code:
       0: aload_0
       1: ldc           #56                 // String a
       3: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #58                 // String b
       9: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: invokevirtual #63                 // Method java/lang/String.length:()I
      16: aload_1
      17: invokevirtual #63                 // Method java/lang/String.length:()I
      20: isub
      21: ireturn

  public static final void main();
    Code:
       0: bipush        6
       2: anewarray     #60                 // class java/lang/String
       5: astore_1
       6: aload_1
       7: iconst_0
       8: ldc           #68                 // String Orange
      10: aastore
      11: aload_1
      12: iconst_1
      13: ldc           #70                 // String Banana
      15: aastore
      16: aload_1
      17: iconst_2
      18: ldc           #72                 // String Pineapple
      20: aastore
      21: aload_1
      22: iconst_3
      23: ldc           #74                 // String Papaya
      25: aastore
      26: aload_1
      27: iconst_4
      28: ldc           #76                 // String Apple
      30: aastore
      31: aload_1
      32: iconst_5
      33: ldc           #78                 // String Plum
      35: aastore
      36: aload_1
      37: invokestatic  #84                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      40: astore_0
      41: aload_0
      42: checkcast     #21                 // class java/util/Collection
      45: invokedynamic #101,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function2;
      50: invokestatic  #103                // Method max:(Ljava/util/Collection;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object;
      53: getstatic     #109                // Field java/lang/System.out:Ljava/io/PrintStream;
      56: swap
      57: invokevirtual #115                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      60: invokedynamic #123,  0            // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function2;
      65: astore_1
      66: invokedynamic #128,  0            // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function2;
      71: astore_2
      72: iconst_3
      73: anewarray     #130                // class java/lang/Integer
      76: astore        4
      78: aload         4
      80: iconst_0
      81: iconst_1
      82: invokestatic  #134                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      85: aastore
      86: aload         4
      88: iconst_1
      89: iconst_2
      90: invokestatic  #134                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      93: aastore
      94: aload         4
      96: iconst_2
      97: iconst_3
      98: invokestatic  #134                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     101: aastore
     102: aload         4
     104: invokestatic  #84                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     107: astore_3
     108: aload_3
     109: checkcast     #136                // class java/lang/Iterable
     112: astore        5
     114: iconst_1
     115: istore        6
     117: iconst_0
     118: istore        7
     120: iload         6
     122: istore        8
     124: aload         5
     126: invokeinterface #137,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     131: astore        9
     133: aload         9
     135: invokeinterface #31,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     140: ifeq          179
     143: aload         9
     145: invokeinterface #35,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     150: astore        10
     152: iload         8
     154: aload         10
     156: checkcast     #43                 // class java/lang/Number
     159: invokevirtual #47                 // Method java/lang/Number.intValue:()I
     162: istore        11
     164: istore        12
     166: iconst_0
     167: istore        13
     169: iload         12
     171: iload         11
     173: imul
     174: istore        8
     176: goto          133
     179: iload         8
     181: istore        4
     183: nop
     184: iconst_0
     185: istore        5
     187: ldc           #139                // String ...
     189: getstatic     #109                // Field java/lang/System.out:Ljava/io/PrintStream;
     192: swap
     193: invokevirtual #115                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     196: nop
     197: nop
     198: aload_3
     199: checkcast     #136                // class java/lang/Iterable
     202: astore        5
     204: iconst_0
     205: istore        6
     207: aload         5
     209: astore        7
     211: new           #141                // class java/util/ArrayList
     214: dup
     215: invokespecial #144                // Method java/util/ArrayList."<init>":()V
     218: checkcast     #21                 // class java/util/Collection
     221: astore        8
     223: iconst_0
     224: istore        9
     226: aload         7
     228: invokeinterface #137,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     233: astore        10
     235: aload         10
     237: invokeinterface #31,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     242: ifeq          293
     245: aload         10
     247: invokeinterface #35,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     252: astore        11
     254: aload         11
     256: checkcast     #43                 // class java/lang/Number
     259: invokevirtual #47                 // Method java/lang/Number.intValue:()I
     262: istore        12
     264: iconst_0
     265: istore        13
     267: iload         12
     269: ifle          276
     272: iconst_1
     273: goto          277
     276: iconst_0
     277: ifeq          235
     280: aload         8
     282: aload         11
     284: invokeinterface #148,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     289: pop
     290: goto          235
     293: aload         8
     295: checkcast     #150                // class java/util/List
     298: nop
     299: pop
     300: aload_3
     301: checkcast     #136                // class java/lang/Iterable
     304: astore        5
     306: iconst_0
     307: istore        6
     309: aload         5
     311: astore        7
     313: new           #141                // class java/util/ArrayList
     316: dup
     317: invokespecial #144                // Method java/util/ArrayList."<init>":()V
     320: checkcast     #21                 // class java/util/Collection
     323: astore        8
     325: iconst_0
     326: istore        9
     328: aload         7
     330: invokeinterface #137,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     335: astore        10
     337: aload         10
     339: invokeinterface #31,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     344: ifeq          399
     347: aload         10
     349: invokeinterface #35,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     354: astore        11
     356: aload         11
     358: checkcast     #43                 // class java/lang/Number
     361: invokevirtual #47                 // Method java/lang/Number.intValue:()I
     364: istore        12
     366: iconst_0
     367: istore        13
     369: iload         12
     371: ifle          378
     374: iconst_1
     375: goto          379
     378: iconst_0
     379: istore        14
     381: iload         14
     383: ifeq          337
     386: aload         8
     388: aload         11
     390: invokeinterface #148,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     395: pop
     396: goto          337
     399: aload         8
     401: checkcast     #150                // class java/util/List
     404: nop
     405: pop
     406: aload_3
     407: checkcast     #136                // class java/lang/Iterable
     410: astore        5
     412: iconst_0
     413: istore        6
     415: aload         5
     417: astore        7
     419: new           #141                // class java/util/ArrayList
     422: dup
     423: invokespecial #144                // Method java/util/ArrayList."<init>":()V
     426: checkcast     #21                 // class java/util/Collection
     429: astore        8
     431: iconst_0
     432: istore        9
     434: aload         7
     436: invokeinterface #137,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     441: astore        10
     443: aload         10
     445: invokeinterface #31,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     450: ifeq          505
     453: aload         10
     455: invokeinterface #35,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     460: astore        11
     462: aload         11
     464: checkcast     #43                 // class java/lang/Number
     467: invokevirtual #47                 // Method java/lang/Number.intValue:()I
     470: istore        12
     472: iconst_0
     473: istore        13
     475: iload         12
     477: ifle          484
     480: iconst_1
     481: goto          485
     484: iconst_0
     485: istore        14
     487: iload         14
     489: ifeq          443
     492: aload         8
     494: aload         11
     496: invokeinterface #148,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     501: pop
     502: goto          443
     505: aload         8
     507: checkcast     #150                // class java/util/List
     510: nop
     511: pop
     512: aload_0
     513: checkcast     #136                // class java/lang/Iterable
     516: astore        5
     518: iconst_0
     519: istore        6
     521: aload         5
     523: astore        7
     525: new           #141                // class java/util/ArrayList
     528: dup
     529: invokespecial #144                // Method java/util/ArrayList."<init>":()V
     532: checkcast     #21                 // class java/util/Collection
     535: astore        8
     537: iconst_0
     538: istore        9
     540: aload         7
     542: invokeinterface #137,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     547: astore        10
     549: aload         10
     551: invokeinterface #31,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     556: ifeq          608
     559: aload         10
     561: invokeinterface #35,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     566: astore        11
     568: aload         11
     570: checkcast     #60                 // class java/lang/String
     573: astore        12
     575: iconst_0
     576: istore        13
     578: aload         12
     580: invokevirtual #63                 // Method java/lang/String.length:()I
     583: iconst_5
     584: if_icmpne     591
     587: iconst_1
     588: goto          592
     591: iconst_0
     592: ifeq          549
     595: aload         8
     597: aload         11
     599: invokeinterface #148,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     604: pop
     605: goto          549
     608: aload         8
     610: checkcast     #150                // class java/util/List
     613: nop
     614: checkcast     #136                // class java/lang/Iterable
     617: astore        5
     619: nop
     620: iconst_0
     621: istore        6
     623: aload         5
     625: new           #152                // class course/kotlin/functions/LambdasKt$main$$inlined$sortedBy$1
     628: dup
     629: invokespecial #153                // Method course/kotlin/functions/LambdasKt$main$$inlined$sortedBy$1."<init>":()V
     632: checkcast     #155                // class java/util/Comparator
     635: invokestatic  #159                // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
     638: checkcast     #136                // class java/lang/Iterable
     641: astore        5
     643: nop
     644: iconst_0
     645: istore        6
     647: aload         5
     649: astore        7
     651: new           #141                // class java/util/ArrayList
     654: dup
     655: aload         5
     657: bipush        10
     659: invokestatic  #163                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     662: invokespecial #166                // Method java/util/ArrayList."<init>":(I)V
     665: checkcast     #21                 // class java/util/Collection
     668: astore        8
     670: iconst_0
     671: istore        9
     673: aload         7
     675: invokeinterface #137,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     680: astore        10
     682: aload         10
     684: invokeinterface #31,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     689: ifeq          742
     692: aload         10
     694: invokeinterface #35,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     699: astore        11
     701: aload         8
     703: aload         11
     705: checkcast     #60                 // class java/lang/String
     708: astore        12
     710: astore        15
     712: iconst_0
     713: istore        13
     715: aload         12
     717: getstatic     #172                // Field java/util/Locale.ROOT:Ljava/util/Locale;
     720: invokevirtual #176                // Method java/lang/String.toUpperCase:(Ljava/util/Locale;)Ljava/lang/String;
     723: dup
     724: ldc           #178                // String toUpperCase(...)
     726: invokestatic  #181                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     729: nop
     730: aload         15
     732: swap
     733: invokeinterface #148,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     738: pop
     739: goto          682
     742: aload         8
     744: checkcast     #150                // class java/util/List
     747: nop
     748: pop
     749: iconst_3
     750: anewarray     #183                // class kotlin/Pair
     753: astore        6
     755: aload         6
     757: iconst_0
     758: iconst_1
     759: invokestatic  #134                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     762: ldc           #185                // String x
     764: invokestatic  #191                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     767: aastore
     768: aload         6
     770: iconst_1
     771: iconst_2
     772: invokestatic  #134                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     775: ldc           #193                // String y
     777: invokestatic  #191                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     780: aastore
     781: aload         6
     783: iconst_2
     784: iconst_3
     785: invokestatic  #134                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     788: ldc           #195                // String z
     790: invokestatic  #191                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     793: aastore
     794: aload         6
     796: invokestatic  #201                // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;
     799: astore        5
     801: aload         5
     803: invokedynamic #208,  0            // InvokeDynamic #3:invoke:()Lkotlin/jvm/functions/Function2;
     808: invokedynamic #219,  0            // InvokeDynamic #4:accept:(Lkotlin/jvm/functions/Function2;)Ljava/util/function/BiConsumer;
     813: invokeinterface #225,  2          // InterfaceMethod java/util/Map.forEach:(Ljava/util/function/BiConsumer;)V
     818: invokedynamic #230,  0            // InvokeDynamic #5:invoke:()Lkotlin/jvm/functions/Function2;
     823: astore        6
     825: invokedynamic #235,  0            // InvokeDynamic #6:invoke:()Lkotlin/jvm/functions/Function2;
     830: astore        7
     832: aload         6
     834: iconst_1
     835: invokestatic  #134                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     838: iconst_2
     839: invokestatic  #134                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     842: invokeinterface #41,  3           // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     847: checkcast     #43                 // class java/lang/Number
     850: invokevirtual #47                 // Method java/lang/Number.intValue:()I
     853: istore        8
     855: getstatic     #109                // Field java/lang/System.out:Ljava/io/PrintStream;
     858: iload         8
     860: invokevirtual #237                // Method java/io/PrintStream.println:(I)V
     863: aload         7
     865: iconst_1
     866: invokestatic  #134                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     869: iconst_2
     870: invokestatic  #134                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     873: invokeinterface #41,  3           // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     878: checkcast     #43                 // class java/lang/Number
     881: invokevirtual #47                 // Method java/lang/Number.intValue:()I
     884: istore        8
     886: getstatic     #109                // Field java/lang/System.out:Ljava/io/PrintStream;
     889: iload         8
     891: invokevirtual #237                // Method java/io/PrintStream.println:(I)V
     894: return

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

  private static final int main$lambda$0(java.lang.String, java.lang.String);
    Code:
       0: aload_0
       1: ldc           #56                 // String a
       3: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #58                 // String b
       9: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: invokevirtual #63                 // Method java/lang/String.length:()I
      16: aload_1
      17: invokevirtual #63                 // Method java/lang/String.length:()I
      20: isub
      21: ireturn

  private static final int main$lambda$1(int, int);
    Code:
       0: iload_0
       1: iload_1
       2: iadd
       3: ireturn

  private static final int main$lambda$2(int, int);
    Code:
       0: iload_0
       1: iload_1
       2: iadd
       3: ireturn

  private static final kotlin.Unit main$lambda$11(java.lang.Integer, java.lang.String);
    Code:
       0: aload_0
       1: ldc_w         #287                // String <unused var>
       4: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_1
       8: ldc_w         #289                // String value
      11: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      14: new           #291                // class java/lang/StringBuilder
      17: dup
      18: invokespecial #292                // Method java/lang/StringBuilder."<init>":()V
      21: aload_1
      22: invokevirtual #296                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      25: bipush        33
      27: invokevirtual #299                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      30: invokevirtual #303                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      33: getstatic     #109                // Field java/lang/System.out:Ljava/io/PrintStream;
      36: swap
      37: invokevirtual #115                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      40: getstatic     #309                // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
      43: areturn

  private static final void main$lambda$12(kotlin.jvm.functions.Function2, java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokeinterface #41,  3           // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
       8: pop
       9: return

  private static final int main$lambda$13(int, int);
    Code:
       0: iload_0
       1: iload_1
       2: iadd
       3: ireturn

  private static final int main$lambda$14(int, int);
    Code:
       0: iload_0
       1: iload_1
       2: iadd
       3: ireturn
}