import kotlin.math.max

/**
 * 1000-digit Fibonacci number
 *
 * The Fibonacci sequence is defined by the recurrence relation:
 *      Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1.
 * Hence the first 12 terms will be:
 *      F1 = 1
 *      F2 = 1
 *      F3 = 2
 *      F4 = 3
 *      F5 = 5
 *      F6 = 8
 *      F7 = 13
 *      F8 = 21
 *      F9 = 34
 *      F10 = 55
 *      F11 = 89
 *      F12 = 144
 *
 * The 12th term, F12, is the first term to contain three digits.
 * What is the index of the first term in the Fibonacci sequence to contain 1000 digits?
 *
 * https://projecteuler.net/problem=25
 */
fun main() {
    println(fibIndexOfDigitsCount(digitsCount = 3))
    println(fibIndexOfDigitsCount(digitsCount = 1_000))
}

private fun fibIndexOfDigitsCount(digitsCount: Int): Int {
    if (digitsCount == 1) return 1
    val f1 = mutableListOf(1)
    val f2 = mutableListOf(1)
    var index = 2
    var turn = true // true for f1, false for f2
    while (f1.size != digitsCount && f2.size != digitsCount) {
        if (turn) {
            sum(f1, f2)
        } else {
            sum(f2, f1)
        }
        turn = !turn
        index++
    }
    return index
}

private fun sum(list1: MutableList<Int>, list2: MutableList<Int>) {
    var acc = 0
    for (i in 0 until max(list1.size, list2.size)) {
        val sum = list1.getOrElse(i) { 0 } + list2.getOrElse(i) { 0 } + acc
        if (i < list1.size) {
            list1[i] = sum % 10
        } else {
            list1.add(sum % 10)
        }
        acc = sum / 10
    }
    while (acc != 0) {
        list1.add(acc % 10)
        acc /= 10
    }
}

Compiled from "Problem25.kt"
public final class Problem25Kt {
  public static final void main();
    Code:
       0: iconst_3
       1: invokestatic  #10                 // Method fibIndexOfDigitsCount:(I)I
       4: istore_0
       5: getstatic     #16                 // Field java/lang/System.out:Ljava/io/PrintStream;
       8: iload_0
       9: invokevirtual #22                 // Method java/io/PrintStream.println:(I)V
      12: sipush        1000
      15: invokestatic  #10                 // Method fibIndexOfDigitsCount:(I)I
      18: istore_0
      19: getstatic     #16                 // Field java/lang/System.out:Ljava/io/PrintStream;
      22: iload_0
      23: invokevirtual #22                 // Method java/io/PrintStream.println:(I)V
      26: return

  private static final int fibIndexOfDigitsCount(int);
    Code:
       0: iload_0
       1: iconst_1
       2: if_icmpne     7
       5: iconst_1
       6: ireturn
       7: iconst_1
       8: anewarray     #24                 // class java/lang/Integer
      11: astore_2
      12: aload_2
      13: iconst_0
      14: iconst_1
      15: invokestatic  #28                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      18: aastore
      19: aload_2
      20: invokestatic  #34                 // Method kotlin/collections/CollectionsKt.mutableListOf:([Ljava/lang/Object;)Ljava/util/List;
      23: astore_1
      24: iconst_1
      25: anewarray     #24                 // class java/lang/Integer
      28: astore_3
      29: aload_3
      30: iconst_0
      31: iconst_1
      32: invokestatic  #28                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      35: aastore
      36: aload_3
      37: invokestatic  #34                 // Method kotlin/collections/CollectionsKt.mutableListOf:([Ljava/lang/Object;)Ljava/util/List;
      40: astore_2
      41: iconst_2
      42: istore_3
      43: iconst_1
      44: istore        4
      46: aload_1
      47: invokeinterface #40,  1           // InterfaceMethod java/util/List.size:()I
      52: iload_0
      53: if_icmpeq     102
      56: aload_2
      57: invokeinterface #40,  1           // InterfaceMethod java/util/List.size:()I
      62: iload_0
      63: if_icmpeq     102
      66: iload         4
      68: ifeq          79
      71: aload_1
      72: aload_2
      73: invokestatic  #44                 // Method sum:(Ljava/util/List;Ljava/util/List;)V
      76: goto          84
      79: aload_2
      80: aload_1
      81: invokestatic  #44                 // Method sum:(Ljava/util/List;Ljava/util/List;)V
      84: iload         4
      86: ifne          93
      89: iconst_1
      90: goto          94
      93: iconst_0
      94: istore        4
      96: iinc          3, 1
      99: goto          46
     102: iload_3
     103: ireturn

  private static final void sum(java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>);
    Code:
       0: iconst_0
       1: istore_2
       2: iconst_0
       3: istore_3
       4: aload_0
       5: invokeinterface #40,  1           // InterfaceMethod java/util/List.size:()I
      10: aload_1
      11: invokeinterface #40,  1           // InterfaceMethod java/util/List.size:()I
      16: invokestatic  #59                 // Method java/lang/Math.max:(II)I
      19: istore        4
      21: iload_3
      22: iload         4
      24: if_icmpge     212
      27: aload_0
      28: astore        6
      30: iconst_0
      31: iload_3
      32: if_icmpgt     54
      35: iload_3
      36: aload         6
      38: invokeinterface #40,  1           // InterfaceMethod java/util/List.size:()I
      43: if_icmpge     50
      46: iconst_1
      47: goto          55
      50: iconst_0
      51: goto          55
      54: iconst_0
      55: ifeq          69
      58: aload         6
      60: iload_3
      61: invokeinterface #63,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      66: goto          79
      69: iload_3
      70: istore        7
      72: iconst_0
      73: istore        8
      75: iconst_0
      76: invokestatic  #28                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      79: checkcast     #65                 // class java/lang/Number
      82: invokevirtual #68                 // Method java/lang/Number.intValue:()I
      85: aload_1
      86: astore        6
      88: iconst_0
      89: iload_3
      90: if_icmpgt     112
      93: iload_3
      94: aload         6
      96: invokeinterface #40,  1           // InterfaceMethod java/util/List.size:()I
     101: if_icmpge     108
     104: iconst_1
     105: goto          113
     108: iconst_0
     109: goto          113
     112: iconst_0
     113: ifeq          127
     116: aload         6
     118: iload_3
     119: invokeinterface #63,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     124: goto          145
     127: iload_3
     128: istore        7
     130: istore        9
     132: iconst_0
     133: istore        8
     135: iconst_0
     136: invokestatic  #28                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     139: astore        10
     141: iload         9
     143: aload         10
     145: checkcast     #65                 // class java/lang/Number
     148: invokevirtual #68                 // Method java/lang/Number.intValue:()I
     151: iadd
     152: iload_2
     153: iadd
     154: istore        5
     156: iload_3
     157: aload_0
     158: invokeinterface #40,  1           // InterfaceMethod java/util/List.size:()I
     163: if_icmpge     185
     166: aload_0
     167: iload_3
     168: iload         5
     170: bipush        10
     172: irem
     173: invokestatic  #28                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     176: invokeinterface #72,  3           // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;
     181: pop
     182: goto          200
     185: aload_0
     186: iload         5
     188: bipush        10
     190: irem
     191: invokestatic  #28                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     194: invokeinterface #76,  2           // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     199: pop
     200: iload         5
     202: bipush        10
     204: idiv
     205: istore_2
     206: iinc          3, 1
     209: goto          21
     212: iload_2
     213: ifeq          238
     216: aload_0
     217: iload_2
     218: bipush        10
     220: irem
     221: invokestatic  #28                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     224: invokeinterface #76,  2           // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     229: pop
     230: iload_2
     231: bipush        10
     233: idiv
     234: istore_2
     235: goto          212
     238: return

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


import kotlin.math.sqrt

/**
 * Largest prime factor
 *
 * The prime factors of 13195 are 5, 7, 13 and 29.
 * What is the largest prime factor of the number 600851475143 ?
 *
 * https://projecteuler.net/problem=3
 */

fun main() {
    println(solution3(600851475143L))
}

private fun solution3(n: Long): Long {
    var num = n
    var lastFactor = if (n % 2 == 0L) {
        num /= 2
        while (num % 2 == 0L) {
            num /= 2
        }
        2L
    } else {
        1L
    }
    var factor = 3L
    var maxFactor = sqrt(num.toDouble()).toLong()
    while (num > 1 && factor <= maxFactor) {
        if (num % factor == 0L) {
            num /= factor
            lastFactor = factor
            while (num % factor == 0L) {
                num /= factor
            }
            maxFactor = sqrt(num.toDouble()).toLong()
        }
        factor += 2
    }

    return if (num == 1L) lastFactor else num
}

Compiled from "Problem3.kt"
public final class Problem3Kt {
  public static final void main();
    Code:
       0: ldc2_w        #7                  // long 600851475143l
       3: invokestatic  #12                 // Method solution3:(J)J
       6: lstore_0
       7: getstatic     #18                 // Field java/lang/System.out:Ljava/io/PrintStream;
      10: lload_0
      11: invokevirtual #24                 // Method java/io/PrintStream.println:(J)V
      14: return

  private static final long solution3(long);
    Code:
       0: lload_0
       1: lstore_2
       2: lload_0
       3: iconst_2
       4: i2l
       5: lrem
       6: lconst_0
       7: lcmp
       8: ifne          39
      11: lload_2
      12: iconst_2
      13: i2l
      14: ldiv
      15: lstore_2
      16: lload_2
      17: iconst_2
      18: i2l
      19: lrem
      20: lconst_0
      21: lcmp
      22: ifne          33
      25: lload_2
      26: iconst_2
      27: i2l
      28: ldiv
      29: lstore_2
      30: goto          16
      33: ldc2_w        #25                 // long 2l
      36: goto          40
      39: lconst_1
      40: lstore        4
      42: ldc2_w        #27                 // long 3l
      45: lstore        6
      47: lload_2
      48: l2d
      49: invokestatic  #34                 // Method java/lang/Math.sqrt:(D)D
      52: d2l
      53: lstore        8
      55: lload_2
      56: lconst_1
      57: lcmp
      58: ifle          122
      61: lload         6
      63: lload         8
      65: lcmp
      66: ifgt          122
      69: lload_2
      70: lload         6
      72: lrem
      73: lconst_0
      74: lcmp
      75: ifne          112
      78: lload_2
      79: lload         6
      81: ldiv
      82: lstore_2
      83: lload         6
      85: lstore        4
      87: lload_2
      88: lload         6
      90: lrem
      91: lconst_0
      92: lcmp
      93: ifne          104
      96: lload_2
      97: lload         6
      99: ldiv
     100: lstore_2
     101: goto          87
     104: lload_2
     105: l2d
     106: invokestatic  #34                 // Method java/lang/Math.sqrt:(D)D
     109: d2l
     110: lstore        8
     112: lload         6
     114: iconst_2
     115: i2l
     116: ladd
     117: lstore        6
     119: goto          55
     122: lload_2
     123: lconst_1
     124: lcmp
     125: ifne          133
     128: lload         4
     130: goto          134
     133: lload_2
     134: lreturn

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


/**
 * Highly divisible triangular number
 *
 * The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be
 * 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:
 *
 * 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
 *
 * Let us list the factors of the first seven triangle numbers:
 *
 * 1: 1
 * 3: 1,3
 * 6: 1,2,3,6
 * 10: 1,2,5,10
 * 15: 1,3,5,15
 * 21: 1,3,7,21
 * 28: 1,2,4,7,14,28
 * We can see that 28 is the first triangle number to have over five divisors.
 *
 * What is the value of the first triangle number to have over five hundred divisors?
 *
 * https://projecteuler.net/problem=12
 */

fun main() {
    println(highlyDivisibleTriangularNumber(5))
    println(highlyDivisibleTriangularNumber(500))
}

private fun highlyDivisibleTriangularNumber(n: Int): Int {
    var num = 1
    while (true) {
        val triangular = (num * (num + 1)) / 2
        val numberOfFactors = primeFactorizationOf(triangular)
            .map { it.value + 1 }
            .fold(1L) { acc, i -> acc * i }

        if (numberOfFactors > n) {
            return triangular
        }

        num++
    }
}

fun primeFactorizationOf(n: Int): Map<Int, Int> = buildMap {
    var num = n
    while (num != 1) {
        primeLoop@ for (i in 1..n) {
            if (primes[i] == 0) {
                primes[i] = findPrime(i).toInt()
            }
            val prime = primes[i]
            if (num % prime == 0) {
                num /= prime
                set(prime, getOrDefault(prime, 0) + 1)
                break@primeLoop
            }
        }
    }
}

private val primes = IntArray(65500) { 0 }

Compiled from "Problem12.kt"
public final class Problem12Kt {
  private static final int[] primes;

  public static final void main();
    Code:
       0: iconst_5
       1: invokestatic  #10                 // Method highlyDivisibleTriangularNumber:(I)I
       4: istore_0
       5: getstatic     #16                 // Field java/lang/System.out:Ljava/io/PrintStream;
       8: iload_0
       9: invokevirtual #22                 // Method java/io/PrintStream.println:(I)V
      12: sipush        500
      15: invokestatic  #10                 // Method highlyDivisibleTriangularNumber:(I)I
      18: istore_0
      19: getstatic     #16                 // Field java/lang/System.out:Ljava/io/PrintStream;
      22: iload_0
      23: invokevirtual #22                 // Method java/io/PrintStream.println:(I)V
      26: return

  private static final int highlyDivisibleTriangularNumber(int);
    Code:
       0: iconst_1
       1: istore_1
       2: nop
       3: iload_1
       4: iload_1
       5: iconst_1
       6: iadd
       7: imul
       8: iconst_2
       9: idiv
      10: istore_2
      11: iload_2
      12: invokestatic  #26                 // Method primeFactorizationOf:(I)Ljava/util/Map;
      15: astore        5
      17: nop
      18: iconst_0
      19: istore        6
      21: aload         5
      23: astore        8
      25: new           #28                 // class java/util/ArrayList
      28: dup
      29: aload         5
      31: invokeinterface #34,  1           // InterfaceMethod java/util/Map.size:()I
      36: invokespecial #37                 // Method java/util/ArrayList."<init>":(I)V
      39: checkcast     #39                 // class java/util/Collection
      42: astore        9
      44: iconst_0
      45: istore        11
      47: aload         8
      49: invokeinterface #43,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
      54: invokeinterface #49,  1           // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
      59: astore        12
      61: aload         12
      63: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      68: ifeq          124
      71: aload         12
      73: invokeinterface #59,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      78: checkcast     #61                 // class java/util/Map$Entry
      81: astore        13
      83: aload         9
      85: aload         13
      87: astore        14
      89: astore        17
      91: iconst_0
      92: istore        15
      94: aload         14
      96: invokeinterface #64,  1           // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     101: checkcast     #66                 // class java/lang/Number
     104: invokevirtual #69                 // Method java/lang/Number.intValue:()I
     107: iconst_1
     108: iadd
     109: invokestatic  #75                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     112: aload         17
     114: swap
     115: invokeinterface #79,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     120: pop
     121: goto          61
     124: aload         9
     126: checkcast     #81                 // class java/util/List
     129: nop
     130: checkcast     #83                 // class java/lang/Iterable
     133: astore        5
     135: lconst_1
     136: lstore        6
     138: iconst_0
     139: istore        8
     141: lload         6
     143: lstore        9
     145: aload         5
     147: invokeinterface #84,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     152: astore        11
     154: aload         11
     156: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     161: ifeq          201
     164: aload         11
     166: invokeinterface #59,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     171: astore        12
     173: lload         9
     175: aload         12
     177: checkcast     #66                 // class java/lang/Number
     180: invokevirtual #69                 // Method java/lang/Number.intValue:()I
     183: istore        13
     185: lstore        14
     187: iconst_0
     188: istore        16
     190: lload         14
     192: iload         13
     194: i2l
     195: lmul
     196: lstore        9
     198: goto          154
     201: lload         9
     203: lstore_3
     204: lload_3
     205: iload_0
     206: i2l
     207: lcmp
     208: ifle          213
     211: iload_2
     212: ireturn
     213: iinc          1, 1
     216: goto          2

  public static final java.util.Map<java.lang.Integer, java.lang.Integer> primeFactorizationOf(int);
    Code:
       0: invokestatic  #119                // Method kotlin/collections/MapsKt.createMapBuilder:()Ljava/util/Map;
       3: astore_1
       4: aload_1
       5: astore_2
       6: iconst_0
       7: istore_3
       8: iload_0
       9: istore        4
      11: iload         4
      13: iconst_1
      14: if_icmpeq     127
      17: iconst_1
      18: istore        5
      20: iload         5
      22: iload_0
      23: if_icmpgt     11
      26: getstatic     #123                // Field primes:[I
      29: iload         5
      31: iaload
      32: ifne          47
      35: getstatic     #123                // Field primes:[I
      38: iload         5
      40: iload         5
      42: invokestatic  #129                // Method Problem7Kt.findPrime:(I)J
      45: l2i
      46: iastore
      47: getstatic     #123                // Field primes:[I
      50: iload         5
      52: iaload
      53: istore        6
      55: iload         4
      57: iload         6
      59: irem
      60: ifne          115
      63: iload         4
      65: iload         6
      67: idiv
      68: istore        4
      70: iload         6
      72: invokestatic  #75                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      75: astore        7
      77: aload_2
      78: aload         7
      80: aload_2
      81: iload         6
      83: invokestatic  #75                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      86: iconst_0
      87: invokestatic  #75                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      90: invokeinterface #133,  3          // InterfaceMethod java/util/Map.getOrDefault:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      95: checkcast     #66                 // class java/lang/Number
      98: invokevirtual #69                 // Method java/lang/Number.intValue:()I
     101: iconst_1
     102: iadd
     103: invokestatic  #75                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     106: invokeinterface #136,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     111: pop
     112: goto          11
     115: iload         5
     117: iload_0
     118: if_icmpeq     11
     121: iinc          5, 1
     124: goto          26
     127: nop
     128: aload_1
     129: invokestatic  #140                // Method kotlin/collections/MapsKt.build:(Ljava/util/Map;)Ljava/util/Map;
     132: areturn

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

  static {};
    Code:
       0: iconst_0
       1: istore_0
       2: ldc           #150                // int 65500
       4: newarray       int
       6: astore_1
       7: iload_0
       8: ldc           #150                // int 65500
      10: if_icmpge     25
      13: iload_0
      14: istore_2
      15: aload_1
      16: iload_2
      17: iconst_0
      18: iastore
      19: iinc          0, 1
      22: goto          7
      25: aload_1
      26: putstatic     #123                // Field primes:[I
      29: return
}


/**
 * Lexicographic permutations
 *
 * A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2,
 * 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The
 * lexicographic permutations of 0, 1 and 2 are:
 *
 * 012   021   102   120   201   210
 *
 * What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?
 *
 * https://projecteuler.net/problem=24
 */
fun main() {
    println(lexicographicPermutations(listOf('0', '1', '2')))
    println(lexicographicPermutationsAt(listOf('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), 1_000_000))
}

private fun lexicographicPermutations(digits: List<Char>): List<String> = buildList {
    val arr = digits.toCharArray()
    while (true) {
        add(String(arr))

        if (!arr.nextPermutation()) break
    }
}

private fun lexicographicPermutationsAt(digits: List<Char>, n: Int): String {
    val arr = digits.toCharArray()
    var count = 0
    while (true) {
        count++
        if (count == n) {
            return String(arr)
        }

        if (!arr.nextPermutation()) break
    }
    return ""
}

private fun CharArray.nextPermutation(): Boolean {
    // Find the rightmost character which is smaller than its next character.
    val i = ((lastIndex - 1) downTo 0).firstOrNull { this[it] < this[it + 1] } ?: return false

    // Find the ceil of 'first char' in right of first character. Ceil of a character is the smallest character
    // greater than it.
    val ceilIndex = findCeil(this[i], i + 1, lastIndex)

    // Swap first and second characters
    swap(i, ceilIndex)

    // reverse the string on right of 'first  char'
    reverse(i + 1, lastIndex)
    return true
}

// This function finds the index of the smallest
// character which is greater than 'first' and is
// present in str[l..h]
private fun CharArray.findCeil(first: Char, l: Int, h: Int): Int {
    // initialize index of ceiling element
    var ceilIndex = l

    // Now iterate through rest of the elements and find
    // the smallest character greater than 'first'
    for (i in l + 1..h) {
        if (this[i] > first && this[i] < this[ceilIndex]) {
            ceilIndex = i
        }
    }
    return ceilIndex
}

// A utility function two swap two characters a and b
private fun CharArray.swap(i: Int, j: Int) {
    val t = this[i]
    this[i] = this[j]
    this[j] = t
}

// A utility function to reverse a string str[l..h]
private fun CharArray.reverse(l: Int, h: Int) {
    var low = l
    var high = h
    while (low < high) {
        swap(low, high)
        low++
        high--
    }
}

Compiled from "Problem24.kt"
public final class Problem24Kt {
  public static final void main();
    Code:
       0: iconst_3
       1: anewarray     #8                  // class java/lang/Character
       4: astore_0
       5: aload_0
       6: iconst_0
       7: bipush        48
       9: invokestatic  #12                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      12: aastore
      13: aload_0
      14: iconst_1
      15: bipush        49
      17: invokestatic  #12                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      20: aastore
      21: aload_0
      22: iconst_2
      23: bipush        50
      25: invokestatic  #12                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      28: aastore
      29: aload_0
      30: invokestatic  #18                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      33: invokestatic  #22                 // Method lexicographicPermutations:(Ljava/util/List;)Ljava/util/List;
      36: getstatic     #28                 // Field java/lang/System.out:Ljava/io/PrintStream;
      39: swap
      40: invokevirtual #34                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      43: bipush        10
      45: anewarray     #8                  // class java/lang/Character
      48: astore_0
      49: aload_0
      50: iconst_0
      51: bipush        48
      53: invokestatic  #12                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      56: aastore
      57: aload_0
      58: iconst_1
      59: bipush        49
      61: invokestatic  #12                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      64: aastore
      65: aload_0
      66: iconst_2
      67: bipush        50
      69: invokestatic  #12                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      72: aastore
      73: aload_0
      74: iconst_3
      75: bipush        51
      77: invokestatic  #12                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      80: aastore
      81: aload_0
      82: iconst_4
      83: bipush        52
      85: invokestatic  #12                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      88: aastore
      89: aload_0
      90: iconst_5
      91: bipush        53
      93: invokestatic  #12                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      96: aastore
      97: aload_0
      98: bipush        6
     100: bipush        54
     102: invokestatic  #12                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     105: aastore
     106: aload_0
     107: bipush        7
     109: bipush        55
     111: invokestatic  #12                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     114: aastore
     115: aload_0
     116: bipush        8
     118: bipush        56
     120: invokestatic  #12                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     123: aastore
     124: aload_0
     125: bipush        9
     127: bipush        57
     129: invokestatic  #12                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     132: aastore
     133: aload_0
     134: invokestatic  #18                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     137: ldc           #35                 // int 1000000
     139: invokestatic  #39                 // Method lexicographicPermutationsAt:(Ljava/util/List;I)Ljava/lang/String;
     142: getstatic     #28                 // Field java/lang/System.out:Ljava/io/PrintStream;
     145: swap
     146: invokevirtual #34                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     149: return

  private static final java.util.List<java.lang.String> lexicographicPermutations(java.util.List<java.lang.Character>);
    Code:
       0: invokestatic  #44                 // Method kotlin/collections/CollectionsKt.createListBuilder:()Ljava/util/List;
       3: astore_1
       4: aload_1
       5: astore_2
       6: iconst_0
       7: istore_3
       8: aload_0
       9: checkcast     #46                 // class java/util/Collection
      12: invokestatic  #50                 // Method kotlin/collections/CollectionsKt.toCharArray:(Ljava/util/Collection;)[C
      15: astore        4
      17: nop
      18: aload_2
      19: new           #52                 // class java/lang/String
      22: dup
      23: aload         4
      25: invokespecial #56                 // Method java/lang/String."<init>":([C)V
      28: invokeinterface #62,  2           // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
      33: pop
      34: aload         4
      36: invokestatic  #66                 // Method nextPermutation:([C)Z
      39: ifne          17
      42: goto          45
      45: nop
      46: aload_1
      47: invokestatic  #69                 // Method kotlin/collections/CollectionsKt.build:(Ljava/util/List;)Ljava/util/List;
      50: areturn

  private static final java.lang.String lexicographicPermutationsAt(java.util.List<java.lang.Character>, int);
    Code:
       0: aload_0
       1: checkcast     #46                 // class java/util/Collection
       4: invokestatic  #50                 // Method kotlin/collections/CollectionsKt.toCharArray:(Ljava/util/Collection;)[C
       7: astore_2
       8: iconst_0
       9: istore_3
      10: nop
      11: iinc          3, 1
      14: iload_3
      15: iload_1
      16: if_icmpne     28
      19: new           #52                 // class java/lang/String
      22: dup
      23: aload_2
      24: invokespecial #56                 // Method java/lang/String."<init>":([C)V
      27: areturn
      28: aload_2
      29: invokestatic  #66                 // Method nextPermutation:([C)Z
      32: ifne          10
      35: goto          38
      38: ldc           #80                 // String
      40: areturn

  private static final boolean nextPermutation(char[]);
    Code:
       0: aload_0
       1: invokestatic  #88                 // Method kotlin/collections/ArraysKt.getLastIndex:([C)I
       4: iconst_1
       5: isub
       6: iconst_0
       7: invokestatic  #94                 // Method kotlin/ranges/RangesKt.downTo:(II)Lkotlin/ranges/IntProgression;
      10: checkcast     #96                 // class java/lang/Iterable
      13: astore_3
      14: iconst_0
      15: istore        4
      17: aload_3
      18: invokeinterface #100,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      23: astore        5
      25: aload         5
      27: invokeinterface #106,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      32: ifeq          86
      35: aload         5
      37: invokeinterface #110,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      42: astore        6
      44: aload         6
      46: checkcast     #112                // class java/lang/Number
      49: invokevirtual #116                // Method java/lang/Number.intValue:()I
      52: istore        7
      54: iconst_0
      55: istore        8
      57: aload_0
      58: iload         7
      60: caload
      61: aload_0
      62: iload         7
      64: iconst_1
      65: iadd
      66: caload
      67: invokestatic  #122                // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      70: ifge          77
      73: iconst_1
      74: goto          78
      77: iconst_0
      78: ifeq          25
      81: aload         6
      83: goto          87
      86: aconst_null
      87: checkcast     #124                // class java/lang/Integer
      90: dup
      91: ifnull        100
      94: invokevirtual #125                // Method java/lang/Integer.intValue:()I
      97: goto          103
     100: pop
     101: iconst_0
     102: ireturn
     103: istore_1
     104: aload_0
     105: aload_0
     106: iload_1
     107: caload
     108: iload_1
     109: iconst_1
     110: iadd
     111: aload_0
     112: invokestatic  #88                 // Method kotlin/collections/ArraysKt.getLastIndex:([C)I
     115: invokestatic  #129                // Method findCeil:([CCII)I
     118: istore_2
     119: aload_0
     120: iload_1
     121: iload_2
     122: invokestatic  #133                // Method swap:([CII)V
     125: aload_0
     126: iload_1
     127: iconst_1
     128: iadd
     129: aload_0
     130: invokestatic  #88                 // Method kotlin/collections/ArraysKt.getLastIndex:([C)I
     133: invokestatic  #136                // Method reverse:([CII)V
     136: iconst_1
     137: ireturn

  private static final int findCeil(char[], char, int, int);
    Code:
       0: iload_2
       1: istore        4
       3: iload_2
       4: iconst_1
       5: iadd
       6: istore        5
       8: iload         5
      10: iload_3
      11: if_icmpgt     55
      14: aload_0
      15: iload         5
      17: caload
      18: iload_1
      19: invokestatic  #122                // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      22: ifle          43
      25: aload_0
      26: iload         5
      28: caload
      29: aload_0
      30: iload         4
      32: caload
      33: invokestatic  #122                // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      36: ifge          43
      39: iload         5
      41: istore        4
      43: iload         5
      45: iload_3
      46: if_icmpeq     55
      49: iinc          5, 1
      52: goto          14
      55: iload         4
      57: ireturn

  private static final void swap(char[], int, int);
    Code:
       0: aload_0
       1: iload_1
       2: caload
       3: istore_3
       4: aload_0
       5: iload_1
       6: aload_0
       7: iload_2
       8: caload
       9: castore
      10: aload_0
      11: iload_2
      12: iload_3
      13: castore
      14: return

  private static final void reverse(char[], int, int);
    Code:
       0: iload_1
       1: istore_3
       2: iload_2
       3: istore        4
       5: iload_3
       6: iload         4
       8: if_icmpge     27
      11: aload_0
      12: iload_3
      13: iload         4
      15: invokestatic  #133                // Method swap:([CII)V
      18: iinc          3, 1
      21: iinc          4, -1
      24: goto          5
      27: return

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


/**
 * Digit factorials
 *
 * 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
 *
 * Find the sum of all numbers which are equal to the sum of the factorial of their digits.
 *
 * Note: As 1! = 1 and 2! = 2 are not sums they are not included.
 *
 * https://projecteuler.net/problem=34
 */
fun main() {
	check(145.isDigitFactorial())
	println(sumOfDigitFactorials())
}

private fun sumOfDigitFactorials(from: Int = 10, to: Int = 99999): Int =
	(from..to).filter(Int::isDigitFactorial).sum()

private fun Int.isDigitFactorial(): Boolean = digits().sumOf(Int::factorial) == this

private fun Int.factorial(): Int = (1..this).fold(1) { x, y -> x * y }

Compiled from "Problem34.kt"
public final class Problem34Kt {
  public static final void main();
    Code:
       0: sipush        145
       3: invokestatic  #10                 // Method isDigitFactorial:(I)Z
       6: ifne          19
       9: new           #12                 // class java/lang/IllegalStateException
      12: dup
      13: ldc           #14                 // String Check failed.
      15: invokespecial #18                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      18: athrow
      19: iconst_0
      20: iconst_0
      21: iconst_3
      22: aconst_null
      23: invokestatic  #22                 // Method sumOfDigitFactorials$default:(IIILjava/lang/Object;)I
      26: istore_0
      27: getstatic     #28                 // Field java/lang/System.out:Ljava/io/PrintStream;
      30: iload_0
      31: invokevirtual #34                 // Method java/io/PrintStream.println:(I)V
      34: return

  private static final int sumOfDigitFactorials(int, int);
    Code:
       0: new           #38                 // class kotlin/ranges/IntRange
       3: dup
       4: iload_0
       5: iload_1
       6: invokespecial #41                 // Method kotlin/ranges/IntRange."<init>":(II)V
       9: checkcast     #43                 // class java/lang/Iterable
      12: astore_2
      13: iconst_0
      14: istore_3
      15: aload_2
      16: astore        4
      18: new           #45                 // class java/util/ArrayList
      21: dup
      22: invokespecial #47                 // Method java/util/ArrayList."<init>":()V
      25: checkcast     #49                 // class java/util/Collection
      28: astore        5
      30: iconst_0
      31: istore        6
      33: aload         4
      35: invokeinterface #53,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      40: astore        7
      42: aload         7
      44: invokeinterface #59,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      49: ifeq          95
      52: aload         7
      54: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      59: astore        8
      61: aload         8
      63: checkcast     #65                 // class java/lang/Number
      66: invokevirtual #69                 // Method java/lang/Number.intValue:()I
      69: istore        9
      71: iconst_0
      72: istore        10
      74: iload         9
      76: invokestatic  #10                 // Method isDigitFactorial:(I)Z
      79: ifeq          42
      82: aload         5
      84: aload         8
      86: invokeinterface #73,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      91: pop
      92: goto          42
      95: aload         5
      97: checkcast     #75                 // class java/util/List
     100: nop
     101: checkcast     #43                 // class java/lang/Iterable
     104: invokestatic  #81                 // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
     107: ireturn

  static int sumOfDigitFactorials$default(int, int, int, java.lang.Object);
    Code:
       0: iload_2
       1: iconst_1
       2: iand
       3: ifeq          9
       6: bipush        10
       8: istore_0
       9: iload_2
      10: iconst_2
      11: iand
      12: ifeq          18
      15: ldc           #96                 // int 99999
      17: istore_1
      18: iload_0
      19: iload_1
      20: invokestatic  #98                 // Method sumOfDigitFactorials:(II)I
      23: ireturn

  private static final boolean isDigitFactorial(int);
    Code:
       0: iload_0
       1: invokestatic  #104                // Method Problem32Kt.digits:(I)Ljava/util/List;
       4: checkcast     #43                 // class java/lang/Iterable
       7: astore_1
       8: iconst_0
       9: istore_2
      10: aload_1
      11: invokeinterface #53,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      16: astore_3
      17: aload_3
      18: invokeinterface #59,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      23: ifeq          66
      26: aload_3
      27: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      32: astore        4
      34: iload_2
      35: aload         4
      37: checkcast     #65                 // class java/lang/Number
      40: invokevirtual #69                 // Method java/lang/Number.intValue:()I
      43: istore        5
      45: istore        7
      47: iconst_0
      48: istore        6
      50: iload         5
      52: invokestatic  #108                // Method factorial:(I)I
      55: istore        8
      57: iload         7
      59: iload         8
      61: iadd
      62: istore_2
      63: goto          17
      66: iload_2
      67: iload_0
      68: if_icmpne     75
      71: iconst_1
      72: goto          76
      75: iconst_0
      76: ireturn

  private static final int factorial(int);
    Code:
       0: new           #38                 // class kotlin/ranges/IntRange
       3: dup
       4: iconst_1
       5: iload_0
       6: invokespecial #41                 // Method kotlin/ranges/IntRange."<init>":(II)V
       9: checkcast     #43                 // class java/lang/Iterable
      12: astore_1
      13: iconst_1
      14: istore_2
      15: iconst_0
      16: istore_3
      17: iload_2
      18: istore        4
      20: aload_1
      21: invokeinterface #53,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      26: astore        5
      28: aload         5
      30: invokeinterface #59,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      35: ifeq          69
      38: aload         5
      40: checkcast     #112                // class kotlin/collections/IntIterator
      43: invokevirtual #115                // Method kotlin/collections/IntIterator.nextInt:()I
      46: istore        6
      48: iload         4
      50: iload         6
      52: istore        7
      54: istore        8
      56: iconst_0
      57: istore        9
      59: iload         8
      61: iload         7
      63: imul
      64: istore        4
      66: goto          28
      69: iload         4
      71: ireturn

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


import kotlin.system.measureNanoTime

/**
 * Even Fibonacci numbers
 *
 * Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the
 * first 10 terms will be:
 *
 *                                  1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
 *
 * By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the
 * even-valued terms.
 *
 * https://projecteuler.net/problem=2
 */
fun main() {
    val limit = 4_000_000
    val solution1Time = measureNanoTime {
        solution1(limit)
    }
    val solution2Time = measureNanoTime {
        solution2(limit)
    }

    println(solution1Time)
    println(solution2Time)
}

private fun solution1(limit: Int) {
    var n1 = 1
    var n2 = 1
    var sum = 0

    while (n2 < limit) {
        if (n2 % 2 == 0) {
            sum += n2
        }
        val fib = n1 + n2
        n1 = n2
        n2 = fib
    }
    println(sum)
}

private fun solution2(limit: Int) {
    // 1 1 2 3 5 8 13 21 34 55 89 144
    // a b c a b c a  b  c  a  b   c
    var a = 1
    var b = 1
    var c = a + b
    var sum = 0

    while (c < limit) {
        sum += c
        a = b + c
        b = c + a
        c = a + b
    }
    println(sum)
}

Compiled from "Problem2.kt"
public final class Problem2Kt {
  public static final void main();
    Code:
       0: ldc           #7                  // int 4000000
       2: istore_0
       3: iconst_0
       4: istore_3
       5: invokestatic  #13                 // Method java/lang/System.nanoTime:()J
       8: lstore        4
      10: iconst_0
      11: istore        6
      13: iload_0
      14: invokestatic  #17                 // Method solution1:(I)V
      17: nop
      18: nop
      19: invokestatic  #13                 // Method java/lang/System.nanoTime:()J
      22: lload         4
      24: lsub
      25: lstore_1
      26: iconst_0
      27: istore        5
      29: invokestatic  #13                 // Method java/lang/System.nanoTime:()J
      32: lstore        6
      34: iconst_0
      35: istore        8
      37: iload_0
      38: invokestatic  #20                 // Method solution2:(I)V
      41: nop
      42: nop
      43: invokestatic  #13                 // Method java/lang/System.nanoTime:()J
      46: lload         6
      48: lsub
      49: lstore_3
      50: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      53: lload_1
      54: invokevirtual #30                 // Method java/io/PrintStream.println:(J)V
      57: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      60: lload_3
      61: invokevirtual #30                 // Method java/io/PrintStream.println:(J)V
      64: return

  private static final void solution1(int);
    Code:
       0: iconst_1
       1: istore_1
       2: iconst_1
       3: istore_2
       4: iconst_0
       5: istore_3
       6: iload_2
       7: iload_0
       8: if_icmpge     34
      11: iload_2
      12: iconst_2
      13: irem
      14: ifne          21
      17: iload_3
      18: iload_2
      19: iadd
      20: istore_3
      21: iload_1
      22: iload_2
      23: iadd
      24: istore        4
      26: iload_2
      27: istore_1
      28: iload         4
      30: istore_2
      31: goto          6
      34: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      37: iload_3
      38: invokevirtual #41                 // Method java/io/PrintStream.println:(I)V
      41: return

  private static final void solution2(int);
    Code:
       0: iconst_1
       1: istore_1
       2: iconst_1
       3: istore_2
       4: iload_1
       5: iload_2
       6: iadd
       7: istore_3
       8: iconst_0
       9: istore        4
      11: iload_3
      12: iload_0
      13: if_icmpge     37
      16: iload         4
      18: iload_3
      19: iadd
      20: istore        4
      22: iload_2
      23: iload_3
      24: iadd
      25: istore_1
      26: iload_3
      27: iload_1
      28: iadd
      29: istore_2
      30: iload_1
      31: iload_2
      32: iadd
      33: istore_3
      34: goto          11
      37: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      40: iload         4
      42: invokevirtual #41                 // Method java/io/PrintStream.println:(I)V
      45: return

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


import java.util.*

public fun <T, C : MutableCollection<in T>> Collection<T>.partitionTo(col1: C, col2: C, predicate: (T)-> Boolean): Pair<C,C> {
    //T-n itemi tesak, C-n` Collectioni mejini
    //greladzevy` toCollectioni pes
    for( item in this){
        if(predicate(item)){
            col1.add(item)
        }
        else{
            col2.add(item)
        }
    }
    return Pair(col1,col2) // qanzi partition()-y sl-um pair er veradardznum
}
fun partitionWordsAndLines() {
    val (words, lines) = listOf("a", "a b", "c", "d e")
            .partitionTo(ArrayList(), ArrayList()) { s -> !s.contains(" ") }
    check(words == listOf("a", "c"))
    check(lines == listOf("a b", "d e"))
}

fun partitionLettersAndOtherSymbols() {
    val (letters, other) = setOf('a', '%', 'r', '}')
            .partitionTo(HashSet(), HashSet()) { c -> c in 'a'..'z' || c in 'A'..'Z' }
    check(letters == setOf('a', 'r'))
    check(other == setOf('%', '}'))
}

Compiled from "Task.kt"
public final class TaskKt {
  public static final <T, C extends java.util.Collection<? super T>> kotlin.Pair<C, C> partitionTo(java.util.Collection<? extends T>, C, C, kotlin.jvm.functions.Function1<? super T, java.lang.Boolean>);
    Code:
       0: aload_0
       1: ldc           #10                 // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #18                 // String col1
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_2
      13: ldc           #20                 // String col2
      15: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: aload_3
      19: ldc           #22                 // String predicate
      21: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      24: aload_0
      25: invokeinterface #28,  1           // InterfaceMethod java/util/Collection.iterator:()Ljava/util/Iterator;
      30: astore        4
      32: aload         4
      34: invokeinterface #34,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      39: ifeq          91
      42: aload         4
      44: invokeinterface #38,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      49: astore        5
      51: aload_3
      52: aload         5
      54: invokeinterface #44,  2           // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
      59: checkcast     #46                 // class java/lang/Boolean
      62: invokevirtual #49                 // Method java/lang/Boolean.booleanValue:()Z
      65: ifeq          79
      68: aload_1
      69: aload         5
      71: invokeinterface #53,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      76: goto          87
      79: aload_2
      80: aload         5
      82: invokeinterface #53,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      87: pop
      88: goto          32
      91: new           #55                 // class kotlin/Pair
      94: dup
      95: aload_1
      96: aload_2
      97: invokespecial #59                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     100: areturn

  public static final void partitionWordsAndLines();
    Code:
       0: iconst_4
       1: anewarray     #68                 // class java/lang/String
       4: astore_1
       5: aload_1
       6: iconst_0
       7: ldc           #70                 // String a
       9: aastore
      10: aload_1
      11: iconst_1
      12: ldc           #72                 // String a b
      14: aastore
      15: aload_1
      16: iconst_2
      17: ldc           #74                 // String c
      19: aastore
      20: aload_1
      21: iconst_3
      22: ldc           #76                 // String d e
      24: aastore
      25: aload_1
      26: invokestatic  #82                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      29: checkcast     #24                 // class java/util/Collection
      32: new           #84                 // class java/util/ArrayList
      35: dup
      36: invokespecial #86                 // Method java/util/ArrayList."<init>":()V
      39: checkcast     #24                 // class java/util/Collection
      42: new           #84                 // class java/util/ArrayList
      45: dup
      46: invokespecial #86                 // Method java/util/ArrayList."<init>":()V
      49: checkcast     #24                 // class java/util/Collection
      52: invokedynamic #104,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      57: invokestatic  #106                // Method partitionTo:(Ljava/util/Collection;Ljava/util/Collection;Ljava/util/Collection;Lkotlin/jvm/functions/Function1;)Lkotlin/Pair;
      60: astore_0
      61: aload_0
      62: invokevirtual #109                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      65: checkcast     #84                 // class java/util/ArrayList
      68: astore_1
      69: aload_0
      70: invokevirtual #112                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      73: checkcast     #84                 // class java/util/ArrayList
      76: astore_2
      77: aload_1
      78: iconst_2
      79: anewarray     #68                 // class java/lang/String
      82: astore_3
      83: aload_3
      84: iconst_0
      85: ldc           #70                 // String a
      87: aastore
      88: aload_3
      89: iconst_1
      90: ldc           #74                 // String c
      92: aastore
      93: aload_3
      94: invokestatic  #82                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      97: invokestatic  #116                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     100: ifne          113
     103: new           #118                // class java/lang/IllegalStateException
     106: dup
     107: ldc           #120                // String Check failed.
     109: invokespecial #123                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     112: athrow
     113: aload_2
     114: iconst_2
     115: anewarray     #68                 // class java/lang/String
     118: astore_3
     119: aload_3
     120: iconst_0
     121: ldc           #72                 // String a b
     123: aastore
     124: aload_3
     125: iconst_1
     126: ldc           #76                 // String d e
     128: aastore
     129: aload_3
     130: invokestatic  #82                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     133: invokestatic  #116                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     136: ifne          149
     139: new           #118                // class java/lang/IllegalStateException
     142: dup
     143: ldc           #120                // String Check failed.
     145: invokespecial #123                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     148: athrow
     149: return

  public static final void partitionLettersAndOtherSymbols();
    Code:
       0: iconst_4
       1: anewarray     #131                // class java/lang/Character
       4: astore_1
       5: aload_1
       6: iconst_0
       7: bipush        97
       9: invokestatic  #135                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      12: aastore
      13: aload_1
      14: iconst_1
      15: bipush        37
      17: invokestatic  #135                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      20: aastore
      21: aload_1
      22: iconst_2
      23: bipush        114
      25: invokestatic  #135                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      28: aastore
      29: aload_1
      30: iconst_3
      31: bipush        125
      33: invokestatic  #135                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      36: aastore
      37: aload_1
      38: invokestatic  #141                // Method kotlin/collections/SetsKt.setOf:([Ljava/lang/Object;)Ljava/util/Set;
      41: checkcast     #24                 // class java/util/Collection
      44: new           #143                // class java/util/HashSet
      47: dup
      48: invokespecial #144                // Method java/util/HashSet."<init>":()V
      51: checkcast     #24                 // class java/util/Collection
      54: new           #143                // class java/util/HashSet
      57: dup
      58: invokespecial #144                // Method java/util/HashSet."<init>":()V
      61: checkcast     #24                 // class java/util/Collection
      64: invokedynamic #152,  0            // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function1;
      69: invokestatic  #106                // Method partitionTo:(Ljava/util/Collection;Ljava/util/Collection;Ljava/util/Collection;Lkotlin/jvm/functions/Function1;)Lkotlin/Pair;
      72: astore_0
      73: aload_0
      74: invokevirtual #109                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      77: checkcast     #143                // class java/util/HashSet
      80: astore_1
      81: aload_0
      82: invokevirtual #112                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      85: checkcast     #143                // class java/util/HashSet
      88: astore_2
      89: aload_1
      90: iconst_2
      91: anewarray     #131                // class java/lang/Character
      94: astore_3
      95: aload_3
      96: iconst_0
      97: bipush        97
      99: invokestatic  #135                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     102: aastore
     103: aload_3
     104: iconst_1
     105: bipush        114
     107: invokestatic  #135                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     110: aastore
     111: aload_3
     112: invokestatic  #141                // Method kotlin/collections/SetsKt.setOf:([Ljava/lang/Object;)Ljava/util/Set;
     115: invokestatic  #116                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     118: ifne          131
     121: new           #118                // class java/lang/IllegalStateException
     124: dup
     125: ldc           #120                // String Check failed.
     127: invokespecial #123                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     130: athrow
     131: aload_2
     132: iconst_2
     133: anewarray     #131                // class java/lang/Character
     136: astore_3
     137: aload_3
     138: iconst_0
     139: bipush        37
     141: invokestatic  #135                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     144: aastore
     145: aload_3
     146: iconst_1
     147: bipush        125
     149: invokestatic  #135                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     152: aastore
     153: aload_3
     154: invokestatic  #141                // Method kotlin/collections/SetsKt.setOf:([Ljava/lang/Object;)Ljava/util/Set;
     157: invokestatic  #116                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     160: ifne          173
     163: new           #118                // class java/lang/IllegalStateException
     166: dup
     167: ldc           #120                // String Check failed.
     169: invokespecial #123                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     172: athrow
     173: return

  private static final boolean partitionWordsAndLines$lambda$0(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #159                // String s
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #161                // class java/lang/CharSequence
      10: ldc           #163                // String
      12: checkcast     #161                // class java/lang/CharSequence
      15: iconst_0
      16: iconst_2
      17: aconst_null
      18: invokestatic  #169                // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z
      21: ifne          28
      24: iconst_1
      25: goto          29
      28: iconst_0
      29: ireturn

  private static final boolean partitionLettersAndOtherSymbols$lambda$1(char);
    Code:
       0: bipush        97
       2: iload_0
       3: if_icmpgt     20
       6: iload_0
       7: bipush        123
       9: if_icmpge     16
      12: iconst_1
      13: goto          21
      16: iconst_0
      17: goto          21
      20: iconst_0
      21: ifne          48
      24: bipush        65
      26: iload_0
      27: if_icmpgt     44
      30: iload_0
      31: bipush        91
      33: if_icmpge     40
      36: iconst_1
      37: goto          45
      40: iconst_0
      41: goto          45
      44: iconst_0
      45: ifeq          52
      48: iconst_1
      49: goto          53
      52: iconst_0
      53: ireturn
}


import java.io.File

fun main() {
  println(Calibration.readCalibrationDigitsAndWords("aoc/inputs/calibration.txt").sum())
}

object Calibration {
  fun readCalibrationDigits(): List<Int> = buildList {
    File("aoc/inputs/calibration.txt").forEachLine { line ->
      val allDigits = Regex("[1-9]").findAll(line).map { it.value }
      val twoDigits = (allDigits.first() + allDigits.last()).toInt()
      add(twoDigits)
    }
  }

  fun readCalibrationDigitsAndWords(fileLocation: String): List<Int> = buildList {
    File(fileLocation).forEachLine { line ->
      add(digitAndWordLineToNumber(line))
    }
  }

  fun digitAndWordLineToNumber(line: String): Int {
    val allDigits = Regex("(?=([1-9]|one|two|three|four|five|six|seven|eight|nine)).")
      .findAll(line)
      .mapNotNull { it.groups[1]?.value }
      .map(::numberToDigit)
      .toList()
    return (allDigits.first() + allDigits.last()).toInt()
  }

  private fun numberToDigit(number: String) = when (number) {
    // No zeros here!
    "one" -> "1"
    "two" -> "2"
    "three" -> "3"
    "four" -> "4"
    "five" -> "5"
    "six" -> "6"
    "seven" -> "7"
    "eight" -> "8"
    "nine" -> "9"
    else -> number
  }
}

Compiled from "Calibration.kt"
public final class CalibrationKt {
  public static final void main();
    Code:
       0: getstatic     #12                 // Field Calibration.INSTANCE:LCalibration;
       3: ldc           #14                 // String aoc/inputs/calibration.txt
       5: invokevirtual #18                 // Method Calibration.readCalibrationDigitsAndWords:(Ljava/lang/String;)Ljava/util/List;
       8: checkcast     #20                 // class java/lang/Iterable
      11: invokestatic  #26                 // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
      14: istore_0
      15: getstatic     #32                 // Field java/lang/System.out:Ljava/io/PrintStream;
      18: iload_0
      19: invokevirtual #38                 // Method java/io/PrintStream.println:(I)V
      22: return

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

Compiled from "Calibration.kt"
final class Calibration$digitAndWordLineToNumber$allDigits$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.lang.String, java.lang.String> {
  Calibration$digitAndWordLineToNumber$allDigits$2(java.lang.Object);
    Code:
       0: aload_0
       1: iconst_1
       2: aload_1
       3: ldc           #11                 // class Calibration
       5: ldc           #13                 // String numberToDigit
       7: ldc           #15                 // String numberToDigit(Ljava/lang/String;)Ljava/lang/String;
       9: iconst_0
      10: invokespecial #18                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Object;Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      13: return

  public final java.lang.String invoke(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #26                 // String p0
       3: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getfield      #34                 // Field receiver:Ljava/lang/Object;
      10: checkcast     #11                 // class Calibration
      13: aload_1
      14: invokestatic  #38                 // Method Calibration.access$numberToDigit:(LCalibration;Ljava/lang/String;)Ljava/lang/String;
      17: areturn

  public java.lang.Object invoke(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #42                 // class java/lang/String
       5: invokevirtual #44                 // Method invoke:(Ljava/lang/String;)Ljava/lang/String;
       8: areturn
}

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

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

  public final java.util.List<java.lang.Integer> readCalibrationDigits();
    Code:
       0: invokestatic  #19                 // Method kotlin/collections/CollectionsKt.createListBuilder:()Ljava/util/List;
       3: astore_1
       4: aload_1
       5: astore_2
       6: iconst_0
       7: istore_3
       8: new           #21                 // class java/io/File
      11: dup
      12: ldc           #23                 // String aoc/inputs/calibration.txt
      14: invokespecial #26                 // Method java/io/File."<init>":(Ljava/lang/String;)V
      17: aconst_null
      18: aload_2
      19: invokedynamic #46,  0             // InvokeDynamic #0:invoke:(Ljava/util/List;)Lkotlin/jvm/functions/Function1;
      24: iconst_1
      25: aconst_null
      26: invokestatic  #52                 // Method kotlin/io/FilesKt.forEachLine$default:(Ljava/io/File;Ljava/nio/charset/Charset;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
      29: nop
      30: aload_1
      31: invokestatic  #56                 // Method kotlin/collections/CollectionsKt.build:(Ljava/util/List;)Ljava/util/List;
      34: areturn

  public final java.util.List<java.lang.Integer> readCalibrationDigitsAndWords(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #65                 // String fileLocation
       3: invokestatic  #71                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: invokestatic  #19                 // Method kotlin/collections/CollectionsKt.createListBuilder:()Ljava/util/List;
       9: astore_2
      10: aload_2
      11: astore_3
      12: iconst_0
      13: istore        4
      15: new           #21                 // class java/io/File
      18: dup
      19: aload_1
      20: invokespecial #26                 // Method java/io/File."<init>":(Ljava/lang/String;)V
      23: aconst_null
      24: aload_3
      25: invokedynamic #76,  0             // InvokeDynamic #1:invoke:(Ljava/util/List;)Lkotlin/jvm/functions/Function1;
      30: iconst_1
      31: aconst_null
      32: invokestatic  #52                 // Method kotlin/io/FilesKt.forEachLine$default:(Ljava/io/File;Ljava/nio/charset/Charset;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
      35: nop
      36: aload_2
      37: invokestatic  #56                 // Method kotlin/collections/CollectionsKt.build:(Ljava/util/List;)Ljava/util/List;
      40: areturn

  public final int digitAndWordLineToNumber(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #83                 // String line
       3: invokestatic  #71                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #85                 // class kotlin/text/Regex
       9: dup
      10: ldc           #87                 // String (?=([1-9]|one|two|three|four|five|six|seven|eight|nine)).
      12: invokespecial #88                 // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      15: aload_1
      16: checkcast     #90                 // class java/lang/CharSequence
      19: iconst_0
      20: iconst_2
      21: aconst_null
      22: invokestatic  #94                 // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;
      25: invokedynamic #103,  0            // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function1;
      30: invokestatic  #109                // Method kotlin/sequences/SequencesKt.mapNotNull:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      33: new           #111                // class Calibration$digitAndWordLineToNumber$allDigits$2
      36: dup
      37: aload_0
      38: invokespecial #114                // Method Calibration$digitAndWordLineToNumber$allDigits$2."<init>":(Ljava/lang/Object;)V
      41: checkcast     #116                // class kotlin/jvm/functions/Function1
      44: invokestatic  #119                // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      47: invokestatic  #123                // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;
      50: astore_2
      51: new           #125                // class java/lang/StringBuilder
      54: dup
      55: invokespecial #126                // Method java/lang/StringBuilder."<init>":()V
      58: aload_2
      59: invokestatic  #130                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
      62: checkcast     #132                // class java/lang/String
      65: invokevirtual #136                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      68: aload_2
      69: invokestatic  #139                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
      72: checkcast     #132                // class java/lang/String
      75: invokevirtual #136                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      78: invokevirtual #143                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      81: invokestatic  #148                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      84: ireturn

  private final java.lang.String numberToDigit(java.lang.String);
    Code:
       0: aload_1
       1: astore_2
       2: aload_2
       3: invokevirtual #155                // Method java/lang/String.hashCode:()I
       6: lookupswitch  { // 9
                110182: 124
                113890: 100
                115276: 148
               3143346: 172
               3149094: 112
               3381426: 88
              96505999: 184
             109330445: 136
             110339486: 160
               default: 241
          }
      88: aload_2
      89: ldc           #157                // String nine
      91: invokevirtual #161                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
      94: ifne          236
      97: goto          241
     100: aload_2
     101: ldc           #163                // String six
     103: invokevirtual #161                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     106: ifne          221
     109: goto          241
     112: aload_2
     113: ldc           #165                // String four
     115: invokevirtual #161                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     118: ifne          211
     121: goto          241
     124: aload_2
     125: ldc           #167                // String one
     127: invokevirtual #161                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     130: ifne          196
     133: goto          241
     136: aload_2
     137: ldc           #169                // String seven
     139: invokevirtual #161                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     142: ifne          226
     145: goto          241
     148: aload_2
     149: ldc           #171                // String two
     151: invokevirtual #161                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     154: ifne          201
     157: goto          241
     160: aload_2
     161: ldc           #173                // String three
     163: invokevirtual #161                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     166: ifne          206
     169: goto          241
     172: aload_2
     173: ldc           #175                // String five
     175: invokevirtual #161                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     178: ifne          216
     181: goto          241
     184: aload_2
     185: ldc           #177                // String eight
     187: invokevirtual #161                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     190: ifne          231
     193: goto          241
     196: ldc           #179                // String 1
     198: goto          242
     201: ldc           #181                // String 2
     203: goto          242
     206: ldc           #183                // String 3
     208: goto          242
     211: ldc           #185                // String 4
     213: goto          242
     216: ldc           #187                // String 5
     218: goto          242
     221: ldc           #189                // String 6
     223: goto          242
     226: ldc           #191                // String 7
     228: goto          242
     231: ldc           #193                // String 8
     233: goto          242
     236: ldc           #195                // String 9
     238: goto          242
     241: aload_1
     242: areturn

  private static final java.lang.String readCalibrationDigits$lambda$2$lambda$1$lambda$0(kotlin.text.MatchResult);
    Code:
       0: aload_0
       1: ldc           #199                // String it
       3: invokestatic  #71                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokeinterface #204,  1          // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;
      12: areturn

  private static final kotlin.Unit readCalibrationDigits$lambda$2$lambda$1(java.util.List, java.lang.String);
    Code:
       0: aload_1
       1: ldc           #83                 // String line
       3: invokestatic  #71                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #85                 // class kotlin/text/Regex
       9: dup
      10: ldc           #207                // String [1-9]
      12: invokespecial #88                 // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      15: aload_1
      16: checkcast     #90                 // class java/lang/CharSequence
      19: iconst_0
      20: iconst_2
      21: aconst_null
      22: invokestatic  #94                 // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;
      25: invokedynamic #211,  0            // InvokeDynamic #3:invoke:()Lkotlin/jvm/functions/Function1;
      30: invokestatic  #119                // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      33: astore_2
      34: new           #125                // class java/lang/StringBuilder
      37: dup
      38: invokespecial #126                // Method java/lang/StringBuilder."<init>":()V
      41: aload_2
      42: invokestatic  #214                // Method kotlin/sequences/SequencesKt.first:(Lkotlin/sequences/Sequence;)Ljava/lang/Object;
      45: checkcast     #132                // class java/lang/String
      48: invokevirtual #136                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      51: aload_2
      52: invokestatic  #216                // Method kotlin/sequences/SequencesKt.last:(Lkotlin/sequences/Sequence;)Ljava/lang/Object;
      55: checkcast     #132                // class java/lang/String
      58: invokevirtual #136                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      61: invokevirtual #143                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      64: invokestatic  #148                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      67: istore_3
      68: aload_0
      69: iload_3
      70: invokestatic  #220                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      73: invokeinterface #225,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
      78: pop
      79: getstatic     #231                // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
      82: areturn

  private static final kotlin.Unit readCalibrationDigitsAndWords$lambda$4$lambda$3(java.util.List, java.lang.String);
    Code:
       0: aload_1
       1: ldc           #83                 // String line
       3: invokestatic  #71                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getstatic     #236                // Field INSTANCE:LCalibration;
      10: aload_1
      11: invokevirtual #238                // Method digitAndWordLineToNumber:(Ljava/lang/String;)I
      14: invokestatic  #220                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      17: invokeinterface #225,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
      22: pop
      23: getstatic     #231                // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
      26: areturn

  private static final java.lang.String digitAndWordLineToNumber$lambda$5(kotlin.text.MatchResult);
    Code:
       0: aload_0
       1: ldc           #199                // String it
       3: invokestatic  #71                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokeinterface #242,  1          // InterfaceMethod kotlin/text/MatchResult.getGroups:()Lkotlin/text/MatchGroupCollection;
      12: iconst_1
      13: invokeinterface #248,  2          // InterfaceMethod kotlin/text/MatchGroupCollection.get:(I)Lkotlin/text/MatchGroup;
      18: dup
      19: ifnull        28
      22: invokevirtual #251                // Method kotlin/text/MatchGroup.getValue:()Ljava/lang/String;
      25: goto          30
      28: pop
      29: aconst_null
      30: areturn

  public static final java.lang.String access$numberToDigit(Calibration, java.lang.String);
    Code:
       0: aload_0
       1: aload_1
       2: invokespecial #255                // Method numberToDigit:(Ljava/lang/String;)Ljava/lang/String;
       5: areturn

  static {};
    Code:
       0: new           #2                  // class Calibration
       3: dup
       4: invokespecial #258                // Method "<init>":()V
       7: putstatic     #236                // Field INSTANCE:LCalibration;
      10: return
}