import java.util.*
import kotlin.collections.ArrayList

//Write a function that takes in two integers and return their sums
fun sum_numbers(x:Int , y:Int ):Int = x + y

//A function that reverse the value of the string

fun reverse_string(s:String):String = s.reversed()

//take an array of integer and return their average

fun sum_array(a: Array<Int>):Int = a.sum()

//String and Character and Return how many time it appear in String

fun appaerance_of_char(s: String,c: Char):Int{

    var result: Int = 0
    for (i in s){

        if (i == c)
        {
            result =+1
        }
    }

    return result
}

//aaray of string and return the longest string

fun longest_string(s: Array<String>){

    var result:String = " "

    for (i in s )
    {
        if (i.length >  result.length) {

            result = i
        }
    }

    println(result)

}

//Return a list conatining only even numbers
fun even_number(array: Array<Int>){

    var arr = ArrayList<Int>(0)
    for (i in array){

        if(i%2 == 0)
        {
            arr.add(i)
        }
    }

    println(arr)

}

//return the number of word in the string

fun number_of_words(s:String):Int = s.length

//retunr the smallest number

fun smallest_number(s: Array<Int>):Int{

    var result:Int = s[0]

    for (i in s )
    {
        if (i <  result) {

            result = i
        }
    }

    return result

}
//Vowel in the string

fun vowel_string(s: Array<String>){

    var arr = ArrayList<String>()

    var vol = arrayOf('a','e','i','o','u','A','E','I','O','U')
    for (i in s )
    {
        if (vol.contains(i[0])) {

            arr.add(i)
        }
    }

    println(arr)

}

//Main

fun main(){

    var arrs = arrayOf("Iam","Shiza","TunTun","Fasih")
    var arr = arrayOf(1,2,3,4,5,6,7,8,9)
    println(Arrays.toString(arrs))
    println(Arrays.toString(arr))
    println()

    println("Sum of Number 2 and 2")
    println(sum_numbers(2,2))
    println()

    println("Reversing the String 'Fasih'")
    println(reverse_string("Fasih"))
    println()

    println("Printing the sum of the Given Int Array")
    println(sum_array(arr))
    println()

    println("Findin the Occurance of 'F' in Fasih")
    println(appaerance_of_char("Fasih",'F'))
    println()

    println("Printing the Even Number in Int Array")
    even_number(arr)
    println()

    println("Printing the Number of Words in 'Fasih'")
    println(number_of_words("Fasih"))
    println()

    println("Printing the smallest Number in Int Array")
    println(smallest_number(arr))
    println()

    println("Printing the Word Start with Vowel in String Array")
    vowel_string(arrs)
    println()

    println("Printing the Longest String in String Array")
    longest_string(arrs)

}

Compiled from "Function_Exercise.kt"
public final class Function_ExerciseKt {
  public static final int sum_numbers(int, int);
    Code:
       0: iload_0
       1: iload_1
       2: iadd
       3: ireturn

  public static final java.lang.String reverse_string(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #14                 // String s
       3: invokestatic  #20                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #22                 // class java/lang/CharSequence
      10: invokestatic  #28                 // Method kotlin/text/StringsKt.reversed:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
      13: invokevirtual #32                 // Method java/lang/Object.toString:()Ljava/lang/String;
      16: areturn

  public static final int sum_array(java.lang.Integer[]);
    Code:
       0: aload_0
       1: ldc           #37                 // String a
       3: invokestatic  #20                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokestatic  #42                 // Method kotlin/collections/ArraysKt.sumOfInt:([Ljava/lang/Integer;)I
      10: ireturn

  public static final int appaerance_of_char(java.lang.String, char);
    Code:
       0: aload_0
       1: ldc           #14                 // String s
       3: invokestatic  #20                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_0
       7: istore_2
       8: iconst_0
       9: istore_3
      10: aload_0
      11: invokevirtual #51                 // Method java/lang/String.length:()I
      14: istore        4
      16: iload_3
      17: iload         4
      19: if_icmpge     43
      22: aload_0
      23: iload_3
      24: invokevirtual #55                 // Method java/lang/String.charAt:(I)C
      27: istore        5
      29: iload         5
      31: iload_1
      32: if_icmpne     37
      35: iconst_1
      36: istore_2
      37: iinc          3, 1
      40: goto          16
      43: iload_2
      44: ireturn

  public static final void longest_string(java.lang.String[]);
    Code:
       0: aload_0
       1: ldc           #14                 // String s
       3: invokestatic  #20                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: ldc           #63                 // String
       8: astore_1
       9: iconst_0
      10: istore_2
      11: aload_0
      12: arraylength
      13: istore_3
      14: iload_2
      15: iload_3
      16: if_icmpge     45
      19: aload_0
      20: iload_2
      21: aaload
      22: astore        4
      24: aload         4
      26: invokevirtual #51                 // Method java/lang/String.length:()I
      29: aload_1
      30: invokevirtual #51                 // Method java/lang/String.length:()I
      33: if_icmple     39
      36: aload         4
      38: astore_1
      39: iinc          2, 1
      42: goto          14
      45: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
      48: aload_1
      49: invokevirtual #75                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      52: return

  public static final void even_number(java.lang.Integer[]);
    Code:
       0: aload_0
       1: ldc           #80                 // String array
       3: invokestatic  #20                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #82                 // class java/util/ArrayList
       9: dup
      10: iconst_0
      11: invokespecial #86                 // Method java/util/ArrayList."<init>":(I)V
      14: astore_1
      15: iconst_0
      16: istore_2
      17: aload_0
      18: arraylength
      19: istore_3
      20: iload_2
      21: iload_3
      22: if_icmpge     56
      25: aload_0
      26: iload_2
      27: aaload
      28: invokevirtual #91                 // Method java/lang/Integer.intValue:()I
      31: istore        4
      33: iload         4
      35: iconst_2
      36: irem
      37: ifne          50
      40: aload_1
      41: iload         4
      43: invokestatic  #95                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      46: invokevirtual #99                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      49: pop
      50: iinc          2, 1
      53: goto          20
      56: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
      59: aload_1
      60: invokevirtual #75                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      63: return

  public static final int number_of_words(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #14                 // String s
       3: invokestatic  #20                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokevirtual #51                 // Method java/lang/String.length:()I
      10: ireturn

  public static final int smallest_number(java.lang.Integer[]);
    Code:
       0: aload_0
       1: ldc           #14                 // String s
       3: invokestatic  #20                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: iconst_0
       8: aaload
       9: invokevirtual #91                 // Method java/lang/Integer.intValue:()I
      12: istore_1
      13: iconst_0
      14: istore_2
      15: aload_0
      16: arraylength
      17: istore_3
      18: iload_2
      19: iload_3
      20: if_icmpge     46
      23: aload_0
      24: iload_2
      25: aaload
      26: invokevirtual #91                 // Method java/lang/Integer.intValue:()I
      29: istore        4
      31: iload         4
      33: iload_1
      34: if_icmpge     40
      37: iload         4
      39: istore_1
      40: iinc          2, 1
      43: goto          18
      46: iload_1
      47: ireturn

  public static final void vowel_string(java.lang.String[]);
    Code:
       0: aload_0
       1: ldc           #14                 // String s
       3: invokestatic  #20                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #82                 // class java/util/ArrayList
       9: dup
      10: invokespecial #108                // Method java/util/ArrayList."<init>":()V
      13: astore_1
      14: bipush        10
      16: anewarray     #110                // class java/lang/Character
      19: astore_3
      20: aload_3
      21: iconst_0
      22: bipush        97
      24: invokestatic  #113                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      27: aastore
      28: aload_3
      29: iconst_1
      30: bipush        101
      32: invokestatic  #113                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      35: aastore
      36: aload_3
      37: iconst_2
      38: bipush        105
      40: invokestatic  #113                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      43: aastore
      44: aload_3
      45: iconst_3
      46: bipush        111
      48: invokestatic  #113                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      51: aastore
      52: aload_3
      53: iconst_4
      54: bipush        117
      56: invokestatic  #113                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      59: aastore
      60: aload_3
      61: iconst_5
      62: bipush        65
      64: invokestatic  #113                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      67: aastore
      68: aload_3
      69: bipush        6
      71: bipush        69
      73: invokestatic  #113                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      76: aastore
      77: aload_3
      78: bipush        7
      80: bipush        73
      82: invokestatic  #113                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      85: aastore
      86: aload_3
      87: bipush        8
      89: bipush        79
      91: invokestatic  #113                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      94: aastore
      95: aload_3
      96: bipush        9
      98: bipush        85
     100: invokestatic  #113                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     103: aastore
     104: aload_3
     105: astore_2
     106: iconst_0
     107: istore_3
     108: aload_0
     109: arraylength
     110: istore        4
     112: iload_3
     113: iload         4
     115: if_icmpge     152
     118: aload_0
     119: iload_3
     120: aaload
     121: astore        5
     123: aload_2
     124: aload         5
     126: iconst_0
     127: invokevirtual #55                 // Method java/lang/String.charAt:(I)C
     130: invokestatic  #113                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     133: invokestatic  #117                // Method kotlin/collections/ArraysKt.contains:([Ljava/lang/Object;Ljava/lang/Object;)Z
     136: ifeq          146
     139: aload_1
     140: aload         5
     142: invokevirtual #99                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     145: pop
     146: iinc          3, 1
     149: goto          112
     152: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     155: aload_1
     156: invokevirtual #75                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     159: return

  public static final void main();
    Code:
       0: iconst_4
       1: anewarray     #47                 // class java/lang/String
       4: astore_1
       5: aload_1
       6: iconst_0
       7: ldc           #124                // String Iam
       9: aastore
      10: aload_1
      11: iconst_1
      12: ldc           #126                // String Shiza
      14: aastore
      15: aload_1
      16: iconst_2
      17: ldc           #128                // String TunTun
      19: aastore
      20: aload_1
      21: iconst_3
      22: ldc           #130                // String Fasih
      24: aastore
      25: aload_1
      26: astore_0
      27: bipush        9
      29: anewarray     #88                 // class java/lang/Integer
      32: astore_2
      33: aload_2
      34: iconst_0
      35: iconst_1
      36: invokestatic  #95                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      39: aastore
      40: aload_2
      41: iconst_1
      42: iconst_2
      43: invokestatic  #95                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      46: aastore
      47: aload_2
      48: iconst_2
      49: iconst_3
      50: invokestatic  #95                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      53: aastore
      54: aload_2
      55: iconst_3
      56: iconst_4
      57: invokestatic  #95                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      60: aastore
      61: aload_2
      62: iconst_4
      63: iconst_5
      64: invokestatic  #95                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      67: aastore
      68: aload_2
      69: iconst_5
      70: bipush        6
      72: invokestatic  #95                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      75: aastore
      76: aload_2
      77: bipush        6
      79: bipush        7
      81: invokestatic  #95                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      84: aastore
      85: aload_2
      86: bipush        7
      88: bipush        8
      90: invokestatic  #95                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      93: aastore
      94: aload_2
      95: bipush        8
      97: bipush        9
      99: invokestatic  #95                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     102: aastore
     103: aload_2
     104: astore_1
     105: aload_0
     106: invokestatic  #135                // Method java/util/Arrays.toString:([Ljava/lang/Object;)Ljava/lang/String;
     109: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     112: swap
     113: invokevirtual #75                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     116: aload_1
     117: invokestatic  #135                // Method java/util/Arrays.toString:([Ljava/lang/Object;)Ljava/lang/String;
     120: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     123: swap
     124: invokevirtual #75                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     127: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     130: invokevirtual #137                // Method java/io/PrintStream.println:()V
     133: ldc           #139                // String Sum of Number 2 and 2
     135: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     138: swap
     139: invokevirtual #75                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     142: iconst_2
     143: iconst_2
     144: invokestatic  #141                // Method sum_numbers:(II)I
     147: istore_2
     148: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     151: iload_2
     152: invokevirtual #143                // Method java/io/PrintStream.println:(I)V
     155: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     158: invokevirtual #137                // Method java/io/PrintStream.println:()V
     161: ldc           #145                // String Reversing the String \'Fasih\'
     163: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     166: swap
     167: invokevirtual #75                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     170: ldc           #130                // String Fasih
     172: invokestatic  #147                // Method reverse_string:(Ljava/lang/String;)Ljava/lang/String;
     175: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     178: swap
     179: invokevirtual #75                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     182: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     185: invokevirtual #137                // Method java/io/PrintStream.println:()V
     188: ldc           #149                // String Printing the sum of the Given Int Array
     190: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     193: swap
     194: invokevirtual #75                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     197: aload_1
     198: invokestatic  #151                // Method sum_array:([Ljava/lang/Integer;)I
     201: istore_2
     202: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     205: iload_2
     206: invokevirtual #143                // Method java/io/PrintStream.println:(I)V
     209: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     212: invokevirtual #137                // Method java/io/PrintStream.println:()V
     215: ldc           #153                // String Findin the Occurance of \'F\' in Fasih
     217: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     220: swap
     221: invokevirtual #75                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     224: ldc           #130                // String Fasih
     226: bipush        70
     228: invokestatic  #155                // Method appaerance_of_char:(Ljava/lang/String;C)I
     231: istore_2
     232: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     235: iload_2
     236: invokevirtual #143                // Method java/io/PrintStream.println:(I)V
     239: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     242: invokevirtual #137                // Method java/io/PrintStream.println:()V
     245: ldc           #157                // String Printing the Even Number in Int Array
     247: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     250: swap
     251: invokevirtual #75                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     254: aload_1
     255: invokestatic  #159                // Method even_number:([Ljava/lang/Integer;)V
     258: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     261: invokevirtual #137                // Method java/io/PrintStream.println:()V
     264: ldc           #161                // String Printing the Number of Words in \'Fasih\'
     266: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     269: swap
     270: invokevirtual #75                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     273: ldc           #130                // String Fasih
     275: invokestatic  #163                // Method number_of_words:(Ljava/lang/String;)I
     278: istore_2
     279: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     282: iload_2
     283: invokevirtual #143                // Method java/io/PrintStream.println:(I)V
     286: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     289: invokevirtual #137                // Method java/io/PrintStream.println:()V
     292: ldc           #165                // String Printing the smallest Number in Int Array
     294: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     297: swap
     298: invokevirtual #75                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     301: aload_1
     302: invokestatic  #167                // Method smallest_number:([Ljava/lang/Integer;)I
     305: istore_2
     306: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     309: iload_2
     310: invokevirtual #143                // Method java/io/PrintStream.println:(I)V
     313: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     316: invokevirtual #137                // Method java/io/PrintStream.println:()V
     319: ldc           #169                // String Printing the Word Start with Vowel in String Array
     321: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     324: swap
     325: invokevirtual #75                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     328: aload_0
     329: invokestatic  #171                // Method vowel_string:([Ljava/lang/String;)V
     332: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     335: invokevirtual #137                // Method java/io/PrintStream.println:()V
     338: ldc           #173                // String Printing the Longest String in String Array
     340: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     343: swap
     344: invokevirtual #75                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     347: aload_0
     348: invokestatic  #175                // Method longest_string:([Ljava/lang/String;)V
     351: return

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


import java.util.*

fun <K, C : MutableCollection<K>> Collection<K>.partitionTo(
    one: C,
    two: C,
    pred: Collection<K>.(K) -> Boolean,
): Pair<MutableCollection<K>, MutableCollection<K>> {
    // * solution 1
//    this.forEach {
//        if (pred(it)) {
//            one += it
//        } else {
//            two += it
//        }
//    }

    // * solution 2
    val (a, b) = this.partition { pred(it) }
    one.addAll(a)
    two.addAll(b)

    return Pair(one, two)
}

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 <K, C extends java.util.Collection<K>> kotlin.Pair<java.util.Collection<K>, java.util.Collection<K>> partitionTo(java.util.Collection<? extends K>, C, C, kotlin.jvm.functions.Function2<? super java.util.Collection<? extends K>, ? super K, 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 one
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_2
      13: ldc           #20                 // String two
      15: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: aload_3
      19: ldc           #22                 // String pred
      21: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      24: aload_0
      25: checkcast     #24                 // class java/lang/Iterable
      28: astore        5
      30: iconst_0
      31: istore        6
      33: new           #26                 // class java/util/ArrayList
      36: dup
      37: invokespecial #30                 // Method java/util/ArrayList."<init>":()V
      40: astore        7
      42: new           #26                 // class java/util/ArrayList
      45: dup
      46: invokespecial #30                 // Method java/util/ArrayList."<init>":()V
      49: astore        8
      51: aload         5
      53: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      58: astore        9
      60: aload         9
      62: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      67: ifeq          125
      70: aload         9
      72: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      77: astore        10
      79: aload         10
      81: astore        11
      83: iconst_0
      84: istore        12
      86: aload_3
      87: aload_0
      88: aload         11
      90: invokeinterface #50,  3           // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      95: checkcast     #52                 // class java/lang/Boolean
      98: invokevirtual #55                 // Method java/lang/Boolean.booleanValue:()Z
     101: ifeq          114
     104: aload         7
     106: aload         10
     108: invokevirtual #59                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     111: goto          121
     114: aload         8
     116: aload         10
     118: invokevirtual #59                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     121: pop
     122: goto          60
     125: new           #61                 // class kotlin/Pair
     128: dup
     129: aload         7
     131: aload         8
     133: invokespecial #64                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     136: astore        4
     138: aload         4
     140: invokevirtual #67                 // Method kotlin/Pair.component1:()Ljava/lang/Object;
     143: checkcast     #69                 // class java/util/List
     146: astore        5
     148: aload         4
     150: invokevirtual #72                 // Method kotlin/Pair.component2:()Ljava/lang/Object;
     153: checkcast     #69                 // class java/util/List
     156: astore        6
     158: aload_1
     159: aload         5
     161: checkcast     #74                 // class java/util/Collection
     164: invokeinterface #78,  2           // InterfaceMethod java/util/Collection.addAll:(Ljava/util/Collection;)Z
     169: pop
     170: aload_2
     171: aload         6
     173: checkcast     #74                 // class java/util/Collection
     176: invokeinterface #78,  2           // InterfaceMethod java/util/Collection.addAll:(Ljava/util/Collection;)Z
     181: pop
     182: new           #61                 // class kotlin/Pair
     185: dup
     186: aload_1
     187: aload_2
     188: invokespecial #64                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     191: areturn

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

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

  private static final boolean partitionWordsAndLines$lambda$1(java.util.Collection, java.lang.String);
    Code:
       0: aload_0
       1: ldc           #175                // String $this$partitionTo
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #177                // String s
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_1
      13: checkcast     #179                // class java/lang/CharSequence
      16: ldc           #181                // String
      18: checkcast     #179                // class java/lang/CharSequence
      21: iconst_0
      22: iconst_2
      23: aconst_null
      24: invokestatic  #187                // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z
      27: ifne          34
      30: iconst_1
      31: goto          35
      34: iconst_0
      35: ireturn

  private static final boolean partitionLettersAndOtherSymbols$lambda$2(java.util.Collection, char);
    Code:
       0: aload_0
       1: ldc           #175                // String $this$partitionTo
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: bipush        97
       8: iload_1
       9: if_icmpgt     26
      12: iload_1
      13: bipush        123
      15: if_icmpge     22
      18: iconst_1
      19: goto          27
      22: iconst_0
      23: goto          27
      26: iconst_0
      27: ifne          54
      30: bipush        65
      32: iload_1
      33: if_icmpgt     50
      36: iload_1
      37: bipush        91
      39: if_icmpge     46
      42: iconst_1
      43: goto          51
      46: iconst_0
      47: goto          51
      50: iconst_0
      51: ifeq          58
      54: iconst_1
      55: goto          59
      58: iconst_0
      59: ireturn
}


fun main(){

    var (a, b, c) = readLine()!!.split(' ')
    var testCases = a.toInt()
    var numOfElemnts = b.toInt()
    var numOfQueries = c.toInt()
    while(testCases > 0){
        if(!medianSort(numOfElemnts, numOfQueries))
        return
    }
    testCases = testCases - 1
}

    // Median Sort
    fun medianSort( nE: Int, nQ: Int): Boolean{
        var nQL = nQ
        var numbers = intArrayOf(1,2)
        for (i in 3..nE+1){
            var left = 0
            var right = numbers.size-1
            while (right - left >= 1 && nQL > 0){
                var leftP = left + ((right-left)/3)
                var rightP = right - ((right-left)/3)
                println(" ${numbers[leftP]} ${numbers[rightP]} ${i}")
                System.out.flush()
                var med = readLine()!!.toInt()
                nQL = nQL-1
                if(med == numbers[leftP]){
                    right = leftP - 1
                    if(left == right){
                        right += 1
                    }
                }else if(med == numbers[rightP]){
                    left = rightP + 1
                    if(left == right){
                        left -= 1
                    }
                }else{
                    left = leftP + 1
                    right = rightP - 1
                    if(left == right){
                        left -= 1
                    }
                }
            }
            numbers = insertAt(numbers, i, left)
        }
        return output(numbers)
    }

fun output(numbers: IntArray): Boolean{
    println(numbers.contentToString())
    System.out.flush()
    var response = readLine()!!.toInt()
    return response == 1
}

fun insertAt(arr: IntArray, key: Int, index: Int): IntArray{
    val array = arr.copyOf(arr.size + 1)
    for(i in 0 until index){
        array[i] = arr[i]
    }
    array[index] = key
    for(i in index+1..arr.size){
        array[i] = arr[i-1]
    }
    return array
}

Compiled from "medianSort.kt"
public final class MedianSortKt {
  public static final void main();
    Code:
       0: invokestatic  #12                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       3: dup
       4: invokestatic  #18                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       7: checkcast     #20                 // class java/lang/CharSequence
      10: iconst_1
      11: newarray       char
      13: astore_1
      14: aload_1
      15: iconst_0
      16: bipush        32
      18: castore
      19: aload_1
      20: iconst_0
      21: iconst_0
      22: bipush        6
      24: aconst_null
      25: invokestatic  #26                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[CZIILjava/lang/Object;)Ljava/util/List;
      28: astore_0
      29: aload_0
      30: iconst_0
      31: invokeinterface #32,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      36: checkcast     #34                 // class java/lang/String
      39: astore_1
      40: aload_0
      41: iconst_1
      42: invokeinterface #32,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      47: checkcast     #34                 // class java/lang/String
      50: astore_2
      51: aload_0
      52: iconst_2
      53: invokeinterface #32,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      58: checkcast     #34                 // class java/lang/String
      61: astore_3
      62: aload_1
      63: invokestatic  #40                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      66: istore        4
      68: aload_2
      69: invokestatic  #40                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      72: istore        5
      74: aload_3
      75: invokestatic  #40                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      78: istore        6
      80: iload         4
      82: ifle          96
      85: iload         5
      87: iload         6
      89: invokestatic  #44                 // Method medianSort:(II)Z
      92: ifne          80
      95: return
      96: iinc          4, -1
      99: return

  public static final boolean medianSort(int, int);
    Code:
       0: iload_1
       1: istore_2
       2: iconst_2
       3: newarray       int
       5: astore        4
       7: aload         4
       9: iconst_0
      10: iconst_1
      11: iastore
      12: aload         4
      14: iconst_1
      15: iconst_2
      16: iastore
      17: aload         4
      19: astore_3
      20: iconst_3
      21: istore        4
      23: iload_0
      24: iconst_1
      25: iadd
      26: istore        5
      28: iload         4
      30: iload         5
      32: if_icmpgt     256
      35: iconst_0
      36: istore        6
      38: aload_3
      39: arraylength
      40: iconst_1
      41: isub
      42: istore        7
      44: iload         7
      46: iload         6
      48: isub
      49: iconst_1
      50: if_icmplt     234
      53: iload_2
      54: ifle          234
      57: iload         6
      59: iload         7
      61: iload         6
      63: isub
      64: iconst_3
      65: idiv
      66: iadd
      67: istore        8
      69: iload         7
      71: iload         7
      73: iload         6
      75: isub
      76: iconst_3
      77: idiv
      78: isub
      79: istore        9
      81: new           #54                 // class java/lang/StringBuilder
      84: dup
      85: invokespecial #57                 // Method java/lang/StringBuilder."<init>":()V
      88: bipush        32
      90: invokevirtual #61                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      93: aload_3
      94: iload         8
      96: iaload
      97: invokevirtual #64                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     100: bipush        32
     102: invokevirtual #61                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     105: aload_3
     106: iload         9
     108: iaload
     109: invokevirtual #64                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     112: bipush        32
     114: invokevirtual #61                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     117: iload         4
     119: invokevirtual #64                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     122: invokevirtual #67                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     125: getstatic     #73                 // Field java/lang/System.out:Ljava/io/PrintStream;
     128: swap
     129: invokevirtual #78                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     132: getstatic     #73                 // Field java/lang/System.out:Ljava/io/PrintStream;
     135: invokevirtual #81                 // Method java/io/PrintStream.flush:()V
     138: invokestatic  #12                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
     141: dup
     142: invokestatic  #18                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     145: invokestatic  #40                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     148: istore        10
     150: iinc          2, -1
     153: iload         10
     155: aload_3
     156: iload         8
     158: iaload
     159: if_icmpne     181
     162: iload         8
     164: iconst_1
     165: isub
     166: istore        7
     168: iload         6
     170: iload         7
     172: if_icmpne     44
     175: iinc          7, 1
     178: goto          44
     181: iload         10
     183: aload_3
     184: iload         9
     186: iaload
     187: if_icmpne     209
     190: iload         9
     192: iconst_1
     193: iadd
     194: istore        6
     196: iload         6
     198: iload         7
     200: if_icmpne     44
     203: iinc          6, -1
     206: goto          44
     209: iload         8
     211: iconst_1
     212: iadd
     213: istore        6
     215: iload         9
     217: iconst_1
     218: isub
     219: istore        7
     221: iload         6
     223: iload         7
     225: if_icmpne     44
     228: iinc          6, -1
     231: goto          44
     234: aload_3
     235: iload         4
     237: iload         6
     239: invokestatic  #85                 // Method insertAt:([III)[I
     242: astore_3
     243: iload         4
     245: iload         5
     247: if_icmpeq     256
     250: iinc          4, 1
     253: goto          35
     256: aload_3
     257: invokestatic  #89                 // Method output:([I)Z
     260: ireturn

  public static final boolean output(int[]);
    Code:
       0: aload_0
       1: ldc           #103                // String numbers
       3: invokestatic  #107                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokestatic  #112                // Method java/util/Arrays.toString:([I)Ljava/lang/String;
      10: dup
      11: ldc           #114                // String toString(...)
      13: invokestatic  #117                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      16: astore_1
      17: getstatic     #73                 // Field java/lang/System.out:Ljava/io/PrintStream;
      20: aload_1
      21: invokevirtual #78                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      24: getstatic     #73                 // Field java/lang/System.out:Ljava/io/PrintStream;
      27: invokevirtual #81                 // Method java/io/PrintStream.flush:()V
      30: invokestatic  #12                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
      33: dup
      34: invokestatic  #18                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      37: invokestatic  #40                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      40: istore_1
      41: iload_1
      42: iconst_1
      43: if_icmpne     50
      46: iconst_1
      47: goto          51
      50: iconst_0
      51: ireturn

  public static final int[] insertAt(int[], int, int);
    Code:
       0: aload_0
       1: ldc           #120                // String arr
       3: invokestatic  #107                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_0
       8: arraylength
       9: iconst_1
      10: iadd
      11: invokestatic  #124                // Method java/util/Arrays.copyOf:([II)[I
      14: dup
      15: ldc           #126                // String copyOf(...)
      17: invokestatic  #117                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      20: astore_3
      21: iconst_0
      22: istore        4
      24: iload         4
      26: iload_2
      27: if_icmpge     44
      30: aload_3
      31: iload         4
      33: aload_0
      34: iload         4
      36: iaload
      37: iastore
      38: iinc          4, 1
      41: goto          24
      44: aload_3
      45: iload_2
      46: iload_1
      47: iastore
      48: iload_2
      49: iconst_1
      50: iadd
      51: istore        4
      53: aload_0
      54: arraylength
      55: istore        5
      57: iload         4
      59: iload         5
      61: if_icmpgt     87
      64: aload_3
      65: iload         4
      67: aload_0
      68: iload         4
      70: iconst_1
      71: isub
      72: iaload
      73: iastore
      74: iload         4
      76: iload         5
      78: if_icmpeq     87
      81: iinc          4, 1
      84: goto          64
      87: aload_3
      88: areturn

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


//These values below should be saved since we assume that Q is a constant.
//The Q value for Kyber (ML-KEM). This is a prime number ((2^8 * 13) + 1)
const val Q: Short = 3329
//Negative Modular Inverse of Q base 2^16
const val Q_INV = -62209
//Base 2^16.
const val R_shift = 16
//R
const val R = 1 shl R_shift
//R * R = R^2
const val R_squared = R.toLong() shl R_shift

fun main() {
    println("Short Int Montgomery Arithmetic in Kotlin")
    println("Author: <NAME>\n")

    val a: Short = 3228
    val b: Short = 3228

    val aMont = toMontgomeryForm(a)
    val bMont = toMontgomeryForm(b)

    val mulMont = montgomeryMultiply(aMont, bMont)

    //Simple Test Case
    println("Modulo    : " + (a * b % Q))
    println("Montgomery: " + montgomeryReduce(mulMont.toInt()))

    //Comprehensive Test Case
    comprehensiveTest()
}

fun comprehensiveTest() {
    //0 up to 32768 (excluding 32768).
    println("Running comprehensive test [0, 32768)...")
    var count = 0
    var correct = 0
    for(i in 0..<Short.MAX_VALUE.toInt()) {
        count++

        val certain = (i * (Q - 1) % Q).toShort()

        val aMont = toMontgomeryForm(i.toShort())
        val bMont = toMontgomeryForm((Q - 1).toShort())

        val mulMont = montgomeryMultiply(aMont, bMont)

        val guess = montgomeryReduce(mulMont.toInt())

        if(guess == certain) correct++
        else println("$i/$certain/$guess")
    }

    println("Ratio(Correct/Total/Ratio): $correct/$count/" + (correct/count.toDouble() * 100) + "%")
}

//Convert values to Montgomery Form
fun toMontgomeryForm(a: Short): Short {
    //Here R_squared % Q can be precomputed and Barrett Reduction can be used for a % Q.
    // (a * R_squared) % Q = ((a % Q) * (R_squared % Q)) % Q
    return montgomeryReduce((a * R_squared % Q).toInt())
}

/*
 * Montgomery Reduction (REDC)
 * Source: Montgomery modular multiplication. (2023, November 28). In Wikipedia. https://en.wikipedia.org/wiki/Montgomery_modular_multiplication
 */
fun montgomeryReduce(t: Int): Short {
    //N  = Q
    //N' = Q_INV
    //TN' mod R
    //Modulo for base 2 values is a simple AND operation.
    val m = (t * Q_INV) and ((R shl 1) - 1) //0xFFFF
    //(T + mN) / R
    val u = (t + m * Q) ushr R_shift
    return if (u >= Q) (u - Q).toShort()
    else u.toShort()
}

fun montgomeryMultiply(a: Short, b: Short): Short {
    val t = a * b //Automatically converts to Int

    return montgomeryReduce(t)
}

Compiled from "Main.kt"
public final class MainKt {
  public static final short Q;

  public static final int Q_INV;

  public static final int R_shift;

  public static final int R;

  public static final long R_squared;

  public static final void main();
    Code:
       0: ldc           #8                  // String Short Int Montgomery Arithmetic in Kotlin
       2: getstatic     #14                 // Field java/lang/System.out:Ljava/io/PrintStream;
       5: swap
       6: invokevirtual #20                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
       9: ldc           #22                 // String Author: <NAME>\n
      11: getstatic     #14                 // Field java/lang/System.out:Ljava/io/PrintStream;
      14: swap
      15: invokevirtual #20                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      18: sipush        3228
      21: istore_0
      22: sipush        3228
      25: istore_1
      26: iload_0
      27: invokestatic  #26                 // Method toMontgomeryForm:(S)S
      30: istore_2
      31: iload_1
      32: invokestatic  #26                 // Method toMontgomeryForm:(S)S
      35: istore_3
      36: iload_2
      37: iload_3
      38: invokestatic  #30                 // Method montgomeryMultiply:(SS)S
      41: istore        4
      43: new           #32                 // class java/lang/StringBuilder
      46: dup
      47: invokespecial #35                 // Method java/lang/StringBuilder."<init>":()V
      50: ldc           #37                 // String Modulo    :
      52: invokevirtual #41                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      55: iload_0
      56: iload_1
      57: imul
      58: sipush        3329
      61: irem
      62: invokevirtual #44                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      65: invokevirtual #48                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      68: getstatic     #14                 // Field java/lang/System.out:Ljava/io/PrintStream;
      71: swap
      72: invokevirtual #20                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      75: new           #32                 // class java/lang/StringBuilder
      78: dup
      79: invokespecial #35                 // Method java/lang/StringBuilder."<init>":()V
      82: ldc           #50                 // String Montgomery:
      84: invokevirtual #41                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      87: iload         4
      89: invokestatic  #54                 // Method montgomeryReduce:(I)S
      92: invokevirtual #44                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      95: invokevirtual #48                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      98: getstatic     #14                 // Field java/lang/System.out:Ljava/io/PrintStream;
     101: swap
     102: invokevirtual #20                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     105: invokestatic  #57                 // Method comprehensiveTest:()V
     108: return

  public static final void comprehensiveTest();
    Code:
       0: ldc           #65                 // String Running comprehensive test [0, 32768)...
       2: getstatic     #14                 // Field java/lang/System.out:Ljava/io/PrintStream;
       5: swap
       6: invokevirtual #20                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
       9: iconst_0
      10: istore_0
      11: iconst_0
      12: istore_1
      13: iconst_0
      14: istore_2
      15: iload_2
      16: sipush        32767
      19: if_icmpge     127
      22: iinc          0, 1
      25: iload_2
      26: sipush        3328
      29: imul
      30: sipush        3329
      33: irem
      34: i2s
      35: istore_3
      36: iload_2
      37: i2s
      38: invokestatic  #26                 // Method toMontgomeryForm:(S)S
      41: istore        4
      43: sipush        3328
      46: invokestatic  #26                 // Method toMontgomeryForm:(S)S
      49: istore        5
      51: iload         4
      53: iload         5
      55: invokestatic  #30                 // Method montgomeryMultiply:(SS)S
      58: istore        6
      60: iload         6
      62: invokestatic  #54                 // Method montgomeryReduce:(I)S
      65: istore        7
      67: iload         7
      69: iload_3
      70: if_icmpne     81
      73: iload_1
      74: iinc          1, 1
      77: pop
      78: goto          121
      81: new           #32                 // class java/lang/StringBuilder
      84: dup
      85: invokespecial #35                 // Method java/lang/StringBuilder."<init>":()V
      88: iload_2
      89: invokevirtual #44                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      92: bipush        47
      94: invokevirtual #68                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      97: iload_3
      98: invokevirtual #44                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     101: bipush        47
     103: invokevirtual #68                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     106: iload         7
     108: invokevirtual #44                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     111: invokevirtual #48                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     114: getstatic     #14                 // Field java/lang/System.out:Ljava/io/PrintStream;
     117: swap
     118: invokevirtual #20                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     121: iinc          2, 1
     124: goto          15
     127: new           #32                 // class java/lang/StringBuilder
     130: dup
     131: invokespecial #35                 // Method java/lang/StringBuilder."<init>":()V
     134: ldc           #70                 // String Ratio(Correct/Total/Ratio):
     136: invokevirtual #41                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     139: iload_1
     140: invokevirtual #44                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     143: bipush        47
     145: invokevirtual #68                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     148: iload_0
     149: invokevirtual #44                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     152: bipush        47
     154: invokevirtual #68                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     157: iload_1
     158: i2d
     159: iload_0
     160: i2d
     161: ddiv
     162: bipush        100
     164: i2d
     165: dmul
     166: invokevirtual #73                 // Method java/lang/StringBuilder.append:(D)Ljava/lang/StringBuilder;
     169: bipush        37
     171: invokevirtual #68                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     174: invokevirtual #48                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     177: getstatic     #14                 // Field java/lang/System.out:Ljava/io/PrintStream;
     180: swap
     181: invokevirtual #20                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     184: return

  public static final short toMontgomeryForm(short);
    Code:
       0: iload_0
       1: i2l
       2: ldc2_w        #80                 // long 4294967296l
       5: lmul
       6: sipush        3329
       9: i2l
      10: lrem
      11: l2i
      12: invokestatic  #54                 // Method montgomeryReduce:(I)S
      15: ireturn

  public static final short montgomeryReduce(int);
    Code:
       0: iload_0
       1: ldc           #82                 // int -62209
       3: imul
       4: ldc           #83                 // int 131071
       6: iand
       7: istore_1
       8: iload_0
       9: iload_1
      10: sipush        3329
      13: imul
      14: iadd
      15: bipush        16
      17: iushr
      18: istore_2
      19: iload_2
      20: sipush        3329
      23: if_icmplt     35
      26: iload_2
      27: sipush        3329
      30: isub
      31: i2s
      32: goto          37
      35: iload_2
      36: i2s
      37: ireturn

  public static final short montgomeryMultiply(short, short);
    Code:
       0: iload_0
       1: iload_1
       2: imul
       3: istore_2
       4: iload_2
       5: invokestatic  #54                 // Method montgomeryReduce:(I)S
       8: ireturn

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


import java.io.File
import kotlin.math.min

fun main () {

    fun parseInput(input: String) : List<List<Set<Int>>>{
        return File(input)
        .readLines()
        .map {
            it.split(",")
        }
        .map{
            val set1 = (it[0].split("-")[0].toInt() until it[0].split("-")[1].toInt()+1).map{it}.toSet()
            val set2 = (it[1].split("-")[0].toInt() until it[1].split("-")[1].toInt()+1).map{it}.toSet()
            listOf(set1, set2)
        }
    }

    fun part1(input: String) : Int{

        val overlaps = parseInput(input)
        .map{
            if((it[0].intersect(it[1]).size) == min(it[0].size, it[1].size)){
                1
            } else {
                0
            }
        }
        return overlaps.sum()
    }

    fun part2(input: String) : Int{

        val overlaps = parseInput(input)
        .map{
            if((it[0].intersect(it[1]).size) > 0 ){
                1
            } else {
                0
            }
        }
        return overlaps.sum()
    }

    val testFile = "data/day4_test.txt"
    check(part1(testFile) == 2)
    check(part2(testFile) == 4)

    val inputFile = "data/day4.txt"
    println(part1(inputFile))
    println(part2(inputFile))
}

Compiled from "Day04.kt"
public final class Day04Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String data/day4_test.txt
       2: astore_0
       3: aload_0
       4: invokestatic  #12                 // Method main$part1:(Ljava/lang/String;)I
       7: iconst_2
       8: if_icmpne     15
      11: iconst_1
      12: goto          16
      15: iconst_0
      16: ifne          29
      19: new           #14                 // class java/lang/IllegalStateException
      22: dup
      23: ldc           #16                 // String Check failed.
      25: invokespecial #20                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      28: athrow
      29: aload_0
      30: invokestatic  #23                 // Method main$part2:(Ljava/lang/String;)I
      33: iconst_4
      34: if_icmpne     41
      37: iconst_1
      38: goto          42
      41: iconst_0
      42: ifne          55
      45: new           #14                 // class java/lang/IllegalStateException
      48: dup
      49: ldc           #16                 // String Check failed.
      51: invokespecial #20                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      54: athrow
      55: ldc           #25                 // String data/day4.txt
      57: astore_1
      58: aload_1
      59: invokestatic  #12                 // Method main$part1:(Ljava/lang/String;)I
      62: istore_2
      63: getstatic     #31                 // Field java/lang/System.out:Ljava/io/PrintStream;
      66: iload_2
      67: invokevirtual #37                 // Method java/io/PrintStream.println:(I)V
      70: aload_1
      71: invokestatic  #23                 // Method main$part2:(Ljava/lang/String;)I
      74: istore_2
      75: getstatic     #31                 // Field java/lang/System.out:Ljava/io/PrintStream;
      78: iload_2
      79: invokevirtual #37                 // Method java/io/PrintStream.println:(I)V
      82: return

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

  private static final java.util.List<java.util.List<java.util.Set<java.lang.Integer>>> main$parseInput(java.lang.String);
    Code:
       0: new           #52                 // class java/io/File
       3: dup
       4: aload_0
       5: invokespecial #53                 // Method java/io/File."<init>":(Ljava/lang/String;)V
       8: aconst_null
       9: iconst_1
      10: aconst_null
      11: invokestatic  #59                 // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;
      14: checkcast     #61                 // class java/lang/Iterable
      17: astore_1
      18: nop
      19: iconst_0
      20: istore_2
      21: aload_1
      22: astore_3
      23: new           #63                 // class java/util/ArrayList
      26: dup
      27: aload_1
      28: bipush        10
      30: invokestatic  #69                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      33: invokespecial #71                 // Method java/util/ArrayList."<init>":(I)V
      36: checkcast     #73                 // class java/util/Collection
      39: astore        4
      41: iconst_0
      42: istore        5
      44: aload_3
      45: invokeinterface #77,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      50: astore        6
      52: aload         6
      54: invokeinterface #83,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      59: ifeq          124
      62: aload         6
      64: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      69: astore        7
      71: aload         4
      73: aload         7
      75: checkcast     #42                 // class java/lang/String
      78: astore        8
      80: astore        22
      82: iconst_0
      83: istore        9
      85: aload         8
      87: checkcast     #89                 // class java/lang/CharSequence
      90: iconst_1
      91: anewarray     #42                 // class java/lang/String
      94: astore        10
      96: aload         10
      98: iconst_0
      99: ldc           #91                 // String ,
     101: aastore
     102: aload         10
     104: iconst_0
     105: iconst_0
     106: bipush        6
     108: aconst_null
     109: invokestatic  #97                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     112: aload         22
     114: swap
     115: invokeinterface #101,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     120: pop
     121: goto          52
     124: aload         4
     126: checkcast     #103                // class java/util/List
     129: nop
     130: checkcast     #61                 // class java/lang/Iterable
     133: astore_1
     134: nop
     135: iconst_0
     136: istore_2
     137: aload_1
     138: astore_3
     139: new           #63                 // class java/util/ArrayList
     142: dup
     143: aload_1
     144: bipush        10
     146: invokestatic  #69                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     149: invokespecial #71                 // Method java/util/ArrayList."<init>":(I)V
     152: checkcast     #73                 // class java/util/Collection
     155: astore        4
     157: iconst_0
     158: istore        5
     160: aload_3
     161: invokeinterface #77,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     166: astore        6
     168: aload         6
     170: invokeinterface #83,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     175: ifeq          636
     178: aload         6
     180: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     185: astore        7
     187: aload         4
     189: aload         7
     191: checkcast     #103                // class java/util/List
     194: astore        8
     196: astore        22
     198: iconst_0
     199: istore        9
     201: aload         8
     203: iconst_0
     204: invokeinterface #107,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     209: checkcast     #89                 // class java/lang/CharSequence
     212: iconst_1
     213: anewarray     #42                 // class java/lang/String
     216: astore        10
     218: aload         10
     220: iconst_0
     221: ldc           #109                // String -
     223: aastore
     224: aload         10
     226: iconst_0
     227: iconst_0
     228: bipush        6
     230: aconst_null
     231: invokestatic  #97                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     234: iconst_0
     235: invokeinterface #107,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     240: checkcast     #42                 // class java/lang/String
     243: invokestatic  #114                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     246: aload         8
     248: iconst_0
     249: invokeinterface #107,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     254: checkcast     #89                 // class java/lang/CharSequence
     257: iconst_1
     258: anewarray     #42                 // class java/lang/String
     261: astore        10
     263: aload         10
     265: iconst_0
     266: ldc           #109                // String -
     268: aastore
     269: aload         10
     271: iconst_0
     272: iconst_0
     273: bipush        6
     275: aconst_null
     276: invokestatic  #97                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     279: iconst_1
     280: invokeinterface #107,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     285: checkcast     #42                 // class java/lang/String
     288: invokestatic  #114                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     291: iconst_1
     292: iadd
     293: invokestatic  #120                // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
     296: checkcast     #61                 // class java/lang/Iterable
     299: astore        10
     301: iconst_0
     302: istore        11
     304: aload         10
     306: astore        12
     308: new           #63                 // class java/util/ArrayList
     311: dup
     312: aload         10
     314: bipush        10
     316: invokestatic  #69                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     319: invokespecial #71                 // Method java/util/ArrayList."<init>":(I)V
     322: checkcast     #73                 // class java/util/Collection
     325: astore        13
     327: iconst_0
     328: istore        14
     330: aload         12
     332: invokeinterface #77,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     337: astore        15
     339: aload         15
     341: invokeinterface #83,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     346: ifeq          387
     349: aload         15
     351: checkcast     #122                // class kotlin/collections/IntIterator
     354: invokevirtual #126                // Method kotlin/collections/IntIterator.nextInt:()I
     357: istore        16
     359: aload         13
     361: iload         16
     363: istore        17
     365: astore        18
     367: iconst_0
     368: istore        19
     370: iload         17
     372: invokestatic  #130                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     375: aload         18
     377: swap
     378: invokeinterface #101,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     383: pop
     384: goto          339
     387: aload         13
     389: checkcast     #103                // class java/util/List
     392: nop
     393: checkcast     #61                 // class java/lang/Iterable
     396: invokestatic  #134                // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;
     399: astore        20
     401: aload         8
     403: iconst_1
     404: invokeinterface #107,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     409: checkcast     #89                 // class java/lang/CharSequence
     412: iconst_1
     413: anewarray     #42                 // class java/lang/String
     416: astore        11
     418: aload         11
     420: iconst_0
     421: ldc           #109                // String -
     423: aastore
     424: aload         11
     426: iconst_0
     427: iconst_0
     428: bipush        6
     430: aconst_null
     431: invokestatic  #97                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     434: iconst_0
     435: invokeinterface #107,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     440: checkcast     #42                 // class java/lang/String
     443: invokestatic  #114                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     446: aload         8
     448: iconst_1
     449: invokeinterface #107,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     454: checkcast     #89                 // class java/lang/CharSequence
     457: iconst_1
     458: anewarray     #42                 // class java/lang/String
     461: astore        11
     463: aload         11
     465: iconst_0
     466: ldc           #109                // String -
     468: aastore
     469: aload         11
     471: iconst_0
     472: iconst_0
     473: bipush        6
     475: aconst_null
     476: invokestatic  #97                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     479: iconst_1
     480: invokeinterface #107,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     485: checkcast     #42                 // class java/lang/String
     488: invokestatic  #114                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     491: iconst_1
     492: iadd
     493: invokestatic  #120                // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
     496: checkcast     #61                 // class java/lang/Iterable
     499: astore        11
     501: iconst_0
     502: istore        12
     504: aload         11
     506: astore        13
     508: new           #63                 // class java/util/ArrayList
     511: dup
     512: aload         11
     514: bipush        10
     516: invokestatic  #69                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     519: invokespecial #71                 // Method java/util/ArrayList."<init>":(I)V
     522: checkcast     #73                 // class java/util/Collection
     525: astore        14
     527: iconst_0
     528: istore        15
     530: aload         13
     532: invokeinterface #77,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     537: astore        16
     539: aload         16
     541: invokeinterface #83,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     546: ifeq          587
     549: aload         16
     551: checkcast     #122                // class kotlin/collections/IntIterator
     554: invokevirtual #126                // Method kotlin/collections/IntIterator.nextInt:()I
     557: istore        17
     559: aload         14
     561: iload         17
     563: istore        19
     565: astore        18
     567: iconst_0
     568: istore        21
     570: iload         19
     572: invokestatic  #130                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     575: aload         18
     577: swap
     578: invokeinterface #101,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     583: pop
     584: goto          539
     587: aload         14
     589: checkcast     #103                // class java/util/List
     592: nop
     593: checkcast     #61                 // class java/lang/Iterable
     596: invokestatic  #134                // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;
     599: astore        10
     601: iconst_2
     602: anewarray     #136                // class java/util/Set
     605: astore        11
     607: aload         11
     609: iconst_0
     610: aload         20
     612: aastore
     613: aload         11
     615: iconst_1
     616: aload         10
     618: aastore
     619: aload         11
     621: invokestatic  #140                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     624: aload         22
     626: swap
     627: invokeinterface #101,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     632: pop
     633: goto          168
     636: aload         4
     638: checkcast     #103                // class java/util/List
     641: nop
     642: areturn

  private static final int main$part1(java.lang.String);
    Code:
       0: aload_0
       1: invokestatic  #162                // Method main$parseInput:(Ljava/lang/String;)Ljava/util/List;
       4: checkcast     #61                 // class java/lang/Iterable
       7: astore_2
       8: nop
       9: iconst_0
      10: istore_3
      11: aload_2
      12: astore        4
      14: new           #63                 // class java/util/ArrayList
      17: dup
      18: aload_2
      19: bipush        10
      21: invokestatic  #69                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      24: invokespecial #71                 // Method java/util/ArrayList."<init>":(I)V
      27: checkcast     #73                 // class java/util/Collection
      30: astore        5
      32: iconst_0
      33: istore        6
      35: aload         4
      37: invokeinterface #77,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      42: astore        7
      44: aload         7
      46: invokeinterface #83,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      51: ifeq          166
      54: aload         7
      56: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      61: astore        8
      63: aload         5
      65: aload         8
      67: checkcast     #103                // class java/util/List
      70: astore        9
      72: astore        11
      74: iconst_0
      75: istore        10
      77: aload         9
      79: iconst_0
      80: invokeinterface #107,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      85: checkcast     #61                 // class java/lang/Iterable
      88: aload         9
      90: iconst_1
      91: invokeinterface #107,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      96: checkcast     #61                 // class java/lang/Iterable
      99: invokestatic  #166                // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
     102: invokeinterface #169,  1          // InterfaceMethod java/util/Set.size:()I
     107: aload         9
     109: iconst_0
     110: invokeinterface #107,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     115: checkcast     #136                // class java/util/Set
     118: invokeinterface #169,  1          // InterfaceMethod java/util/Set.size:()I
     123: aload         9
     125: iconst_1
     126: invokeinterface #107,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     131: checkcast     #136                // class java/util/Set
     134: invokeinterface #169,  1          // InterfaceMethod java/util/Set.size:()I
     139: invokestatic  #175                // Method java/lang/Math.min:(II)I
     142: if_icmpne     149
     145: iconst_1
     146: goto          150
     149: iconst_0
     150: nop
     151: invokestatic  #130                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     154: aload         11
     156: swap
     157: invokeinterface #101,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     162: pop
     163: goto          44
     166: aload         5
     168: checkcast     #103                // class java/util/List
     171: nop
     172: astore_1
     173: aload_1
     174: checkcast     #61                 // class java/lang/Iterable
     177: invokestatic  #179                // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
     180: ireturn

  private static final int main$part2(java.lang.String);
    Code:
       0: aload_0
       1: invokestatic  #162                // Method main$parseInput:(Ljava/lang/String;)Ljava/util/List;
       4: checkcast     #61                 // class java/lang/Iterable
       7: astore_2
       8: nop
       9: iconst_0
      10: istore_3
      11: aload_2
      12: astore        4
      14: new           #63                 // class java/util/ArrayList
      17: dup
      18: aload_2
      19: bipush        10
      21: invokestatic  #69                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      24: invokespecial #71                 // Method java/util/ArrayList."<init>":(I)V
      27: checkcast     #73                 // class java/util/Collection
      30: astore        5
      32: iconst_0
      33: istore        6
      35: aload         4
      37: invokeinterface #77,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      42: astore        7
      44: aload         7
      46: invokeinterface #83,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      51: ifeq          131
      54: aload         7
      56: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      61: astore        8
      63: aload         5
      65: aload         8
      67: checkcast     #103                // class java/util/List
      70: astore        9
      72: astore        11
      74: iconst_0
      75: istore        10
      77: aload         9
      79: iconst_0
      80: invokeinterface #107,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      85: checkcast     #61                 // class java/lang/Iterable
      88: aload         9
      90: iconst_1
      91: invokeinterface #107,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      96: checkcast     #61                 // class java/lang/Iterable
      99: invokestatic  #166                // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
     102: invokeinterface #169,  1          // InterfaceMethod java/util/Set.size:()I
     107: ifle          114
     110: iconst_1
     111: goto          115
     114: iconst_0
     115: nop
     116: invokestatic  #130                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     119: aload         11
     121: swap
     122: invokeinterface #101,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     127: pop
     128: goto          44
     131: aload         5
     133: checkcast     #103                // class java/util/List
     136: nop
     137: astore_1
     138: aload_1
     139: checkcast     #61                 // class java/lang/Iterable
     142: invokestatic  #179                // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
     145: ireturn
}