fun main(args: Array<String>) {
    val intComrades = listOf(0, 2, 1, 4, 3, 6, 5).sortComrades()

    val charComrades = listOf('A', 'C', 'B', 'E', 'D').sortComrades()

    val redArmyRanks =  listOf(
        RedArmyRank.SOLDIER,
        RedArmyRank.ASSISTANT_PLATOON_LEADER,
        RedArmyRank.SQUAD_LEADER).sortComrades()

    val dickwads = listOf(
        RedArmyDickwad("Stalin", RedArmyRank.SUPREME_COMMANDER),
        RedArmyDickwad("Pablo", RedArmyRank.NOT_EVEN_RUSSIAN),
        RedArmyDickwad("Putin", RedArmyRank.BEAR_RIDER)).sortComrades()

    println("$intComrades\n$charComrades\n$redArmyRanks\n$dickwads")
}

fun <T: Comparable<T>> Iterable<T>.sortComrades(): List<T> {
    var max = firstOrNull() ?: return emptyList()
    return mapIndexedNotNull { index, comrade ->
        if (index == 0 || comrade >= max) {
            max = comrade
            comrade
        } else {
            null
        }
    }
}

enum class RedArmyRank {
    NOT_EVEN_RUSSIAN,
    SOLDIER,
    SQUAD_LEADER,
    ASSISTANT_PLATOON_LEADER,
    COMPANY_SERGEANT,
    BEAR_RIDER,
    SUPREME_COMMANDER
}

data class RedArmyDickwad(
    val name: String,
    val rank: RedArmyRank
) : Comparable<RedArmyDickwad> {
    override operator fun compareTo(other: RedArmyDickwad) = rank.compareTo(other.rank)
}

Compiled from "StalinSort.kt"
public final class StalinSortKt {
  public static final void main(java.lang.String[]);
    Code:
       0: aload_0
       1: ldc           #9                  // String args
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: bipush        7
       8: anewarray     #17                 // class java/lang/Integer
      11: astore_2
      12: aload_2
      13: iconst_0
      14: iconst_0
      15: invokestatic  #21                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      18: aastore
      19: aload_2
      20: iconst_1
      21: iconst_2
      22: invokestatic  #21                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      25: aastore
      26: aload_2
      27: iconst_2
      28: iconst_1
      29: invokestatic  #21                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      32: aastore
      33: aload_2
      34: iconst_3
      35: iconst_4
      36: invokestatic  #21                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      39: aastore
      40: aload_2
      41: iconst_4
      42: iconst_3
      43: invokestatic  #21                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      46: aastore
      47: aload_2
      48: iconst_5
      49: bipush        6
      51: invokestatic  #21                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      54: aastore
      55: aload_2
      56: bipush        6
      58: iconst_5
      59: invokestatic  #21                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      62: aastore
      63: aload_2
      64: invokestatic  #27                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      67: checkcast     #29                 // class java/lang/Iterable
      70: invokestatic  #33                 // Method sortComrades:(Ljava/lang/Iterable;)Ljava/util/List;
      73: astore_1
      74: iconst_5
      75: anewarray     #35                 // class java/lang/Character
      78: astore_3
      79: aload_3
      80: iconst_0
      81: bipush        65
      83: invokestatic  #38                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      86: aastore
      87: aload_3
      88: iconst_1
      89: bipush        67
      91: invokestatic  #38                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      94: aastore
      95: aload_3
      96: iconst_2
      97: bipush        66
      99: invokestatic  #38                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     102: aastore
     103: aload_3
     104: iconst_3
     105: bipush        69
     107: invokestatic  #38                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     110: aastore
     111: aload_3
     112: iconst_4
     113: bipush        68
     115: invokestatic  #38                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     118: aastore
     119: aload_3
     120: invokestatic  #27                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     123: checkcast     #29                 // class java/lang/Iterable
     126: invokestatic  #33                 // Method sortComrades:(Ljava/lang/Iterable;)Ljava/util/List;
     129: astore_2
     130: iconst_3
     131: anewarray     #40                 // class RedArmyRank
     134: astore        4
     136: aload         4
     138: iconst_0
     139: getstatic     #44                 // Field RedArmyRank.SOLDIER:LRedArmyRank;
     142: aastore
     143: aload         4
     145: iconst_1
     146: getstatic     #47                 // Field RedArmyRank.ASSISTANT_PLATOON_LEADER:LRedArmyRank;
     149: aastore
     150: aload         4
     152: iconst_2
     153: getstatic     #50                 // Field RedArmyRank.SQUAD_LEADER:LRedArmyRank;
     156: aastore
     157: aload         4
     159: invokestatic  #27                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     162: checkcast     #29                 // class java/lang/Iterable
     165: invokestatic  #33                 // Method sortComrades:(Ljava/lang/Iterable;)Ljava/util/List;
     168: astore_3
     169: iconst_3
     170: anewarray     #52                 // class RedArmyDickwad
     173: astore        5
     175: aload         5
     177: iconst_0
     178: new           #52                 // class RedArmyDickwad
     181: dup
     182: ldc           #54                 // String Stalin
     184: getstatic     #57                 // Field RedArmyRank.SUPREME_COMMANDER:LRedArmyRank;
     187: invokespecial #61                 // Method RedArmyDickwad."<init>":(Ljava/lang/String;LRedArmyRank;)V
     190: aastore
     191: aload         5
     193: iconst_1
     194: new           #52                 // class RedArmyDickwad
     197: dup
     198: ldc           #63                 // String Pablo
     200: getstatic     #66                 // Field RedArmyRank.NOT_EVEN_RUSSIAN:LRedArmyRank;
     203: invokespecial #61                 // Method RedArmyDickwad."<init>":(Ljava/lang/String;LRedArmyRank;)V
     206: aastore
     207: aload         5
     209: iconst_2
     210: new           #52                 // class RedArmyDickwad
     213: dup
     214: ldc           #68                 // String Putin
     216: getstatic     #71                 // Field RedArmyRank.BEAR_RIDER:LRedArmyRank;
     219: invokespecial #61                 // Method RedArmyDickwad."<init>":(Ljava/lang/String;LRedArmyRank;)V
     222: aastore
     223: aload         5
     225: invokestatic  #27                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     228: checkcast     #29                 // class java/lang/Iterable
     231: invokestatic  #33                 // Method sortComrades:(Ljava/lang/Iterable;)Ljava/util/List;
     234: astore        4
     236: new           #73                 // class java/lang/StringBuilder
     239: dup
     240: invokespecial #76                 // Method java/lang/StringBuilder."<init>":()V
     243: aload_1
     244: invokevirtual #80                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     247: bipush        10
     249: invokevirtual #83                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     252: aload_2
     253: invokevirtual #80                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     256: bipush        10
     258: invokevirtual #83                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     261: aload_3
     262: invokevirtual #80                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     265: bipush        10
     267: invokevirtual #83                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     270: aload         4
     272: invokevirtual #80                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     275: invokevirtual #87                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     278: getstatic     #93                 // Field java/lang/System.out:Ljava/io/PrintStream;
     281: swap
     282: invokevirtual #99                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     285: return

  public static final <T extends java.lang.Comparable<? super T>> java.util.List<T> sortComrades(java.lang.Iterable<? extends T>);
    Code:
       0: aload_0
       1: ldc           #108                // String <this>
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aconst_null
       7: astore_1
       8: aload_0
       9: invokestatic  #112                // Method kotlin/collections/CollectionsKt.firstOrNull:(Ljava/lang/Iterable;)Ljava/lang/Object;
      12: checkcast     #114                // class java/lang/Comparable
      15: dup
      16: ifnonnull     24
      19: pop
      20: invokestatic  #118                // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;
      23: areturn
      24: astore_1
      25: aload_0
      26: astore_2
      27: iconst_0
      28: istore_3
      29: aload_2
      30: astore        4
      32: new           #120                // class java/util/ArrayList
      35: dup
      36: invokespecial #121                // Method java/util/ArrayList."<init>":()V
      39: checkcast     #123                // class java/util/Collection
      42: astore        5
      44: iconst_0
      45: istore        6
      47: aload         4
      49: astore        7
      51: iconst_0
      52: istore        8
      54: iconst_0
      55: istore        9
      57: aload         7
      59: invokeinterface #127,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      64: astore        10
      66: aload         10
      68: invokeinterface #133,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      73: ifeq          178
      76: aload         10
      78: invokeinterface #137,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      83: astore        11
      85: iload         9
      87: iinc          9, 1
      90: istore        12
      92: iload         12
      94: ifge          100
      97: invokestatic  #140                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     100: iload         12
     102: aload         11
     104: astore        13
     106: istore        14
     108: iconst_0
     109: istore        15
     111: iload         14
     113: aload         13
     115: checkcast     #114                // class java/lang/Comparable
     118: astore        16
     120: istore        17
     122: iconst_0
     123: istore        18
     125: iload         17
     127: ifeq          141
     130: aload         16
     132: aload_1
     133: invokeinterface #144,  2          // InterfaceMethod java/lang/Comparable.compareTo:(Ljava/lang/Object;)I
     138: iflt          149
     141: aload         16
     143: astore_1
     144: aload         16
     146: goto          150
     149: aconst_null
     150: nop
     151: dup
     152: ifnull        173
     155: astore        19
     157: iconst_0
     158: istore        20
     160: aload         5
     162: aload         19
     164: invokeinterface #148,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     169: pop
     170: goto          174
     173: pop
     174: nop
     175: goto          66
     178: nop
     179: aload         5
     181: checkcast     #150                // class java/util/List
     184: nop
     185: areturn
}


import java.util.*

fun main(args: Array<String>) {
    abc000X()
}

fun abc000X() {
    System.err.println("！！！！！！！！！！！テスト！！！！！！！！！")

    val N = readLine()!!
    val As = readLine()!!.split(" ").map { it.toInt() }.sorted()

    System.err.println(As)

    val sets = mutableListOf<kakeru>()
    for (k in 0 until As.count() - 2)
        for (j in k + 1 until As.count() - 1)
            for (i in j + 1 until As.count())
                if (As[i] == As[j] * As[k])
                    sets.add(kakeru(As[i], As[j], As[k]))

    sets.forEach { System.err.println(it) }

//    System.err.println(Ws)

    println(sets.count() * 2)

}

data class kakeru(val i: Int, val j: Int, val k: Int)
data class waru(val i: Int, val j: Int, val k: Int)

fun ng() {
    println("No")
}

fun ok() {
    println("Yes")
}

// 約数のList
fun divisor(value: Long): List<Long> {
    val max = Math.sqrt(value.toDouble()).toLong()
    return (1..max)
        .filter { value % it == 0L }
        .map { listOf(it, value / it) }
        .flatten()
        .sorted()
}

// 範囲内の素数を取得
// fromだけ指定すると戻り値の個数で素数判定ができる
fun prime(from: Long, to: Long = from): List<Long> {
    return (from..to).filter { i ->
        val max = Math.sqrt(i.toDouble()).toLong()
        (2..max).all { j -> i % j != 0L }
    }
}

// 渡された値が素数か判定
fun isPrime(source: Int): Boolean {
    return prime(source.toLong()).any()
}

// 素因数分解
fun decom(value: Long): List<Long> {
    if (value == 1L) return listOf(1)
    val max = Math.sqrt(value.toDouble()).toLong()
    return prime(2, max).filter { value % it == 0L }
}

// 最大公約数
fun gcd(a: Long, b: Long): Long {
    return if (a % b == 0L) b else gcd(b, a % b)
}

// 文字列を入れ替え
fun swap(base: String, a: String, b: String): String {
    return base.map {
        when (it) {
            a.toCharArray()[0] -> b
            b.toCharArray()[0] -> a
            else -> it.toString()
        }
    }.joinToString()
}

/**
 * リストをスタックに変換する
 * @param list リスト
 * @return スタック
 */
fun listToStack(list: List<Int>): Stack<Int> {
    // スタック
    val stack = Stack<Int>()

    for (e in list) {
        stack.push(e)
    }

    return stack
}

/**
 * ユークリッドの互除法を用いて、最大公約数を導出する
 * @param list 最大公約数を求める対象となる数が格納されたリスト
 * @return 最大公約数
 */
fun gcd(list: List<Int>): Int {
    // 最大公約数を求める対象となる数が格納されたスタック
    val stack = listToStack(list)

    // ユークリッドの互除法を用いて、最大公約数を導出する
    // (最終的にスタック内に1つだけ数が残り、それが最大公約数となる)
    while (1 < stack.size) {
        // スタックから2つの数をpop
        val pops = (0 until 2).map {
            stack.pop()
        }

        // スタックからpopした2つの数のうち、小さい方の数のインデックス
        val minIndex = if (pops[1] < pops[0]) {
            1
        } else {
            0
        }

        // スタックからpopした2つの数のうち、小さい方の数をpush
        stack.push(pops[minIndex])

        // スタックからpopした2つの数の剰余
        val r = pops[(minIndex + 1) % 2] % pops[minIndex]

        // スタックからpopした2つの数に剰余があるならば、それをpush
        if (0 < r) {
            stack.push(r)
        }
    }

    // 最大公約数を返す
    return stack.pop()
}

/**
 * 最小公倍数を導出する
 * @param list 最小公倍数を求める対象となる数が格納されたリスト
 * @return 最小公倍数
 */
fun lcm(list: List<Int>): Int {
    // 最大公約数を求める対象となる数が格納されたスタック
    val stack = listToStack(list)

    // 最小公倍数を導出する
    // (最終的にスタック内に1つだけ数が残り、それが最小公倍数となる)
    while (1 < stack.size) {
        // スタックから2つの数をpop
        val pops = (0 until 2).map {
            stack.pop()
        }

        // スタックからpopした2つの数の最小公倍数をpush
        stack.push(pops[0] * pops[1] / gcd(pops))
    }

    // 最小公倍数を返す
    return stack.pop()
}

Compiled from "Main.kt"
public final class MainKt {
  public static final void main(java.lang.String[]);
    Code:
       0: aload_0
       1: ldc           #9                  // String args
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: invokestatic  #19                 // Method abc000X:()V
       9: return

  public static final void abc000X();
    Code:
       0: getstatic     #26                 // Field java/lang/System.err:Ljava/io/PrintStream;
       3: ldc           #28                 // String ！！！！！！！！！！！テスト！！！！！！！！！
       5: invokevirtual #34                 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
       8: invokestatic  #40                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
      11: dup
      12: invokestatic  #44                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      15: astore_0
      16: invokestatic  #40                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
      19: dup
      20: invokestatic  #44                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      23: checkcast     #46                 // class java/lang/CharSequence
      26: iconst_1
      27: anewarray     #48                 // class java/lang/String
      30: astore_2
      31: aload_2
      32: iconst_0
      33: ldc           #50                 // String
      35: aastore
      36: aload_2
      37: iconst_0
      38: iconst_0
      39: bipush        6
      41: aconst_null
      42: invokestatic  #56                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      45: checkcast     #58                 // class java/lang/Iterable
      48: astore_2
      49: iconst_0
      50: istore_3
      51: aload_2
      52: astore        4
      54: new           #60                 // class java/util/ArrayList
      57: dup
      58: aload_2
      59: bipush        10
      61: invokestatic  #66                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      64: invokespecial #70                 // Method java/util/ArrayList."<init>":(I)V
      67: checkcast     #72                 // class java/util/Collection
      70: astore        5
      72: iconst_0
      73: istore        6
      75: aload         4
      77: invokeinterface #76,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      82: astore        7
      84: aload         7
      86: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      91: ifeq          138
      94: aload         7
      96: invokeinterface #86,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     101: astore        8
     103: aload         5
     105: aload         8
     107: checkcast     #48                 // class java/lang/String
     110: astore        9
     112: astore        11
     114: iconst_0
     115: istore        10
     117: aload         9
     119: invokestatic  #92                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     122: nop
     123: invokestatic  #96                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     126: aload         11
     128: swap
     129: invokeinterface #100,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     134: pop
     135: goto          84
     138: aload         5
     140: checkcast     #102                // class java/util/List
     143: nop
     144: checkcast     #58                 // class java/lang/Iterable
     147: invokestatic  #106                // Method kotlin/collections/CollectionsKt.sorted:(Ljava/lang/Iterable;)Ljava/util/List;
     150: astore_1
     151: getstatic     #26                 // Field java/lang/System.err:Ljava/io/PrintStream;
     154: aload_1
     155: invokevirtual #108                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     158: new           #60                 // class java/util/ArrayList
     161: dup
     162: invokespecial #110                // Method java/util/ArrayList."<init>":()V
     165: checkcast     #102                // class java/util/List
     168: astore_2
     169: iconst_0
     170: istore_3
     171: aload_1
     172: checkcast     #72                 // class java/util/Collection
     175: invokeinterface #114,  1          // InterfaceMethod java/util/Collection.size:()I
     180: iconst_2
     181: isub
     182: istore        4
     184: iload_3
     185: iload         4
     187: if_icmpge     357
     190: iload_3
     191: iconst_1
     192: iadd
     193: istore        5
     195: aload_1
     196: checkcast     #72                 // class java/util/Collection
     199: invokeinterface #114,  1          // InterfaceMethod java/util/Collection.size:()I
     204: iconst_1
     205: isub
     206: istore        6
     208: iload         5
     210: iload         6
     212: if_icmpge     351
     215: iload         5
     217: iconst_1
     218: iadd
     219: istore        7
     221: aload_1
     222: checkcast     #72                 // class java/util/Collection
     225: invokeinterface #114,  1          // InterfaceMethod java/util/Collection.size:()I
     230: istore        8
     232: iload         7
     234: iload         8
     236: if_icmpge     345
     239: aload_1
     240: iload         7
     242: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     247: checkcast     #120                // class java/lang/Number
     250: invokevirtual #123                // Method java/lang/Number.intValue:()I
     253: aload_1
     254: iload         5
     256: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     261: checkcast     #120                // class java/lang/Number
     264: invokevirtual #123                // Method java/lang/Number.intValue:()I
     267: aload_1
     268: iload_3
     269: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     274: checkcast     #120                // class java/lang/Number
     277: invokevirtual #123                // Method java/lang/Number.intValue:()I
     280: imul
     281: if_icmpne     339
     284: aload_2
     285: new           #125                // class kakeru
     288: dup
     289: aload_1
     290: iload         7
     292: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     297: checkcast     #120                // class java/lang/Number
     300: invokevirtual #123                // Method java/lang/Number.intValue:()I
     303: aload_1
     304: iload         5
     306: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     311: checkcast     #120                // class java/lang/Number
     314: invokevirtual #123                // Method java/lang/Number.intValue:()I
     317: aload_1
     318: iload_3
     319: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     324: checkcast     #120                // class java/lang/Number
     327: invokevirtual #123                // Method java/lang/Number.intValue:()I
     330: invokespecial #128                // Method kakeru."<init>":(III)V
     333: invokeinterface #129,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     338: pop
     339: iinc          7, 1
     342: goto          232
     345: iinc          5, 1
     348: goto          208
     351: iinc          3, 1
     354: goto          184
     357: aload_2
     358: checkcast     #58                 // class java/lang/Iterable
     361: astore_3
     362: iconst_0
     363: istore        4
     365: aload_3
     366: invokeinterface #76,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     371: astore        5
     373: aload         5
     375: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     380: ifeq          414
     383: aload         5
     385: invokeinterface #86,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     390: astore        6
     392: aload         6
     394: checkcast     #125                // class kakeru
     397: astore        7
     399: iconst_0
     400: istore        8
     402: getstatic     #26                 // Field java/lang/System.err:Ljava/io/PrintStream;
     405: aload         7
     407: invokevirtual #108                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     410: nop
     411: goto          373
     414: nop
     415: aload_2
     416: checkcast     #72                 // class java/util/Collection
     419: invokeinterface #114,  1          // InterfaceMethod java/util/Collection.size:()I
     424: iconst_2
     425: imul
     426: istore_3
     427: getstatic     #132                // Field java/lang/System.out:Ljava/io/PrintStream;
     430: iload_3
     431: invokevirtual #134                // Method java/io/PrintStream.println:(I)V
     434: return

  public static final void ng();
    Code:
       0: ldc           #162                // String No
       2: getstatic     #132                // Field java/lang/System.out:Ljava/io/PrintStream;
       5: swap
       6: invokevirtual #108                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
       9: return

  public static final void ok();
    Code:
       0: ldc           #165                // String Yes
       2: getstatic     #132                // Field java/lang/System.out:Ljava/io/PrintStream;
       5: swap
       6: invokevirtual #108                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
       9: return

  public static final java.util.List<java.lang.Long> divisor(long);
    Code:
       0: lload_0
       1: l2d
       2: invokestatic  #174                // Method java/lang/Math.sqrt:(D)D
       5: d2l
       6: lstore_2
       7: new           #176                // class kotlin/ranges/LongRange
      10: dup
      11: lconst_1
      12: lload_2
      13: invokespecial #179                // Method kotlin/ranges/LongRange."<init>":(JJ)V
      16: checkcast     #58                 // class java/lang/Iterable
      19: astore        4
      21: nop
      22: iconst_0
      23: istore        5
      25: aload         4
      27: astore        6
      29: new           #60                 // class java/util/ArrayList
      32: dup
      33: invokespecial #110                // Method java/util/ArrayList."<init>":()V
      36: checkcast     #72                 // class java/util/Collection
      39: astore        7
      41: iconst_0
      42: istore        8
      44: aload         6
      46: invokeinterface #76,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      51: astore        9
      53: aload         9
      55: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      60: ifeq          115
      63: aload         9
      65: invokeinterface #86,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      70: astore        10
      72: aload         10
      74: checkcast     #120                // class java/lang/Number
      77: invokevirtual #183                // Method java/lang/Number.longValue:()J
      80: lstore        11
      82: iconst_0
      83: istore        13
      85: lload_0
      86: lload         11
      88: lrem
      89: lconst_0
      90: lcmp
      91: ifne          98
      94: iconst_1
      95: goto          99
      98: iconst_0
      99: ifeq          53
     102: aload         7
     104: aload         10
     106: invokeinterface #100,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     111: pop
     112: goto          53
     115: aload         7
     117: checkcast     #102                // class java/util/List
     120: nop
     121: checkcast     #58                 // class java/lang/Iterable
     124: astore        4
     126: nop
     127: iconst_0
     128: istore        5
     130: aload         4
     132: astore        6
     134: new           #60                 // class java/util/ArrayList
     137: dup
     138: aload         4
     140: bipush        10
     142: invokestatic  #66                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     145: invokespecial #70                 // Method java/util/ArrayList."<init>":(I)V
     148: checkcast     #72                 // class java/util/Collection
     151: astore        7
     153: iconst_0
     154: istore        8
     156: aload         6
     158: invokeinterface #76,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     163: astore        9
     165: aload         9
     167: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     172: ifeq          244
     175: aload         9
     177: invokeinterface #86,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     182: astore        10
     184: aload         7
     186: aload         10
     188: checkcast     #120                // class java/lang/Number
     191: invokevirtual #183                // Method java/lang/Number.longValue:()J
     194: lstore        11
     196: astore        15
     198: iconst_0
     199: istore        13
     201: iconst_2
     202: anewarray     #185                // class java/lang/Long
     205: astore        14
     207: aload         14
     209: iconst_0
     210: lload         11
     212: invokestatic  #188                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     215: aastore
     216: aload         14
     218: iconst_1
     219: lload_0
     220: lload         11
     222: ldiv
     223: invokestatic  #188                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     226: aastore
     227: aload         14
     229: invokestatic  #192                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     232: aload         15
     234: swap
     235: invokeinterface #100,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     240: pop
     241: goto          165
     244: aload         7
     246: checkcast     #102                // class java/util/List
     249: nop
     250: checkcast     #58                 // class java/lang/Iterable
     253: invokestatic  #195                // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;
     256: checkcast     #58                 // class java/lang/Iterable
     259: invokestatic  #106                // Method kotlin/collections/CollectionsKt.sorted:(Ljava/lang/Iterable;)Ljava/util/List;
     262: areturn

  public static final java.util.List<java.lang.Long> prime(long, long);
    Code:
       0: new           #176                // class kotlin/ranges/LongRange
       3: dup
       4: lload_0
       5: lload_2
       6: invokespecial #179                // Method kotlin/ranges/LongRange."<init>":(JJ)V
       9: checkcast     #58                 // class java/lang/Iterable
      12: astore        4
      14: iconst_0
      15: istore        5
      17: aload         4
      19: astore        6
      21: new           #60                 // class java/util/ArrayList
      24: dup
      25: invokespecial #110                // Method java/util/ArrayList."<init>":()V
      28: checkcast     #72                 // class java/util/Collection
      31: astore        7
      33: iconst_0
      34: istore        8
      36: aload         6
      38: invokeinterface #76,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      43: astore        9
      45: aload         9
      47: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      52: ifeq          206
      55: aload         9
      57: invokeinterface #86,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      62: astore        10
      64: aload         10
      66: checkcast     #120                // class java/lang/Number
      69: invokevirtual #183                // Method java/lang/Number.longValue:()J
      72: lstore        11
      74: iconst_0
      75: istore        13
      77: lload         11
      79: l2d
      80: invokestatic  #174                // Method java/lang/Math.sqrt:(D)D
      83: d2l
      84: lstore        14
      86: new           #176                // class kotlin/ranges/LongRange
      89: dup
      90: iconst_2
      91: i2l
      92: lload         14
      94: invokespecial #179                // Method kotlin/ranges/LongRange."<init>":(JJ)V
      97: checkcast     #58                 // class java/lang/Iterable
     100: astore        16
     102: iconst_0
     103: istore        17
     105: aload         16
     107: instanceof    #72                 // class java/util/Collection
     110: ifeq          130
     113: aload         16
     115: checkcast     #72                 // class java/util/Collection
     118: invokeinterface #211,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
     123: ifeq          130
     126: iconst_1
     127: goto          189
     130: aload         16
     132: invokeinterface #76,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     137: astore        18
     139: aload         18
     141: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     146: ifeq          188
     149: aload         18
     151: checkcast     #213                // class kotlin/collections/LongIterator
     154: invokevirtual #216                // Method kotlin/collections/LongIterator.nextLong:()J
     157: lstore        19
     159: lload         19
     161: lstore        21
     163: iconst_0
     164: istore        23
     166: lload         11
     168: lload         21
     170: lrem
     171: lconst_0
     172: lcmp
     173: ifeq          180
     176: iconst_1
     177: goto          181
     180: iconst_0
     181: ifne          139
     184: iconst_0
     185: goto          189
     188: iconst_1
     189: nop
     190: ifeq          45
     193: aload         7
     195: aload         10
     197: invokeinterface #100,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     202: pop
     203: goto          45
     206: aload         7
     208: checkcast     #102                // class java/util/List
     211: nop
     212: areturn

  public static java.util.List prime$default(long, long, int, java.lang.Object);
    Code:
       0: iload         4
       2: iconst_2
       3: iand
       4: ifeq          9
       7: lload_0
       8: lstore_2
       9: lload_0
      10: lload_2
      11: invokestatic  #226                // Method prime:(JJ)Ljava/util/List;
      14: areturn

  public static final boolean isPrime(int);
    Code:
       0: iload_0
       1: i2l
       2: lconst_0
       3: iconst_2
       4: aconst_null
       5: invokestatic  #230                // Method prime$default:(JJILjava/lang/Object;)Ljava/util/List;
       8: checkcast     #58                 // class java/lang/Iterable
      11: invokestatic  #234                // Method kotlin/collections/CollectionsKt.any:(Ljava/lang/Iterable;)Z
      14: ireturn

  public static final java.util.List<java.lang.Long> decom(long);
    Code:
       0: lload_0
       1: lconst_1
       2: lcmp
       3: ifne          14
       6: lconst_1
       7: invokestatic  #188                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      10: invokestatic  #239                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
      13: areturn
      14: lload_0
      15: l2d
      16: invokestatic  #174                // Method java/lang/Math.sqrt:(D)D
      19: d2l
      20: lstore_2
      21: ldc2_w        #240                // long 2l
      24: lload_2
      25: invokestatic  #226                // Method prime:(JJ)Ljava/util/List;
      28: checkcast     #58                 // class java/lang/Iterable
      31: astore        4
      33: iconst_0
      34: istore        5
      36: aload         4
      38: astore        6
      40: new           #60                 // class java/util/ArrayList
      43: dup
      44: invokespecial #110                // Method java/util/ArrayList."<init>":()V
      47: checkcast     #72                 // class java/util/Collection
      50: astore        7
      52: iconst_0
      53: istore        8
      55: aload         6
      57: invokeinterface #76,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      62: astore        9
      64: aload         9
      66: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      71: ifeq          126
      74: aload         9
      76: invokeinterface #86,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      81: astore        10
      83: aload         10
      85: checkcast     #120                // class java/lang/Number
      88: invokevirtual #183                // Method java/lang/Number.longValue:()J
      91: lstore        11
      93: iconst_0
      94: istore        13
      96: lload_0
      97: lload         11
      99: lrem
     100: lconst_0
     101: lcmp
     102: ifne          109
     105: iconst_1
     106: goto          110
     109: iconst_0
     110: ifeq          64
     113: aload         7
     115: aload         10
     117: invokeinterface #100,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     122: pop
     123: goto          64
     126: aload         7
     128: checkcast     #102                // class java/util/List
     131: nop
     132: areturn

  public static final long gcd(long, long);
    Code:
       0: lload_0
       1: lload_2
       2: lrem
       3: lconst_0
       4: lcmp
       5: ifne          12
       8: lload_2
       9: goto          19
      12: lload_2
      13: lload_0
      14: lload_2
      15: lrem
      16: invokestatic  #246                // Method gcd:(JJ)J
      19: lreturn

  public static final java.lang.String swap(java.lang.String, java.lang.String, java.lang.String);
    Code:
       0: aload_0
       1: ldc           #252                // String base
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #253                // String a
       9: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_2
      13: ldc           #254                // String b
      15: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: aload_0
      19: checkcast     #46                 // class java/lang/CharSequence
      22: astore_3
      23: iconst_0
      24: istore        4
      26: aload_3
      27: astore        5
      29: new           #60                 // class java/util/ArrayList
      32: dup
      33: aload_3
      34: invokeinterface #257,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      39: invokespecial #70                 // Method java/util/ArrayList."<init>":(I)V
      42: checkcast     #72                 // class java/util/Collection
      45: astore        6
      47: iconst_0
      48: istore        7
      50: iconst_0
      51: istore        8
      53: iload         8
      55: aload         5
      57: invokeinterface #257,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      62: if_icmpge     156
      65: aload         5
      67: iload         8
      69: invokeinterface #261,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
      74: istore        9
      76: aload         6
      78: iload         9
      80: istore        10
      82: astore        13
      84: iconst_0
      85: istore        11
      87: iload         10
      89: istore        12
      91: iload         12
      93: aload_1
      94: invokevirtual #265                // Method java/lang/String.toCharArray:()[C
      97: dup
      98: ldc_w         #267                // String toCharArray(...)
     101: invokestatic  #270                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     104: iconst_0
     105: caload
     106: if_icmpne     113
     109: aload_2
     110: goto          140
     113: iload         12
     115: aload_2
     116: invokevirtual #265                // Method java/lang/String.toCharArray:()[C
     119: dup
     120: ldc_w         #267                // String toCharArray(...)
     123: invokestatic  #270                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     126: iconst_0
     127: caload
     128: if_icmpne     135
     131: aload_1
     132: goto          140
     135: iload         10
     137: invokestatic  #273                // Method java/lang/String.valueOf:(C)Ljava/lang/String;
     140: nop
     141: aload         13
     143: swap
     144: invokeinterface #100,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     149: pop
     150: iinc          8, 1
     153: goto          53
     156: aload         6
     158: checkcast     #102                // class java/util/List
     161: nop
     162: checkcast     #58                 // class java/lang/Iterable
     165: aconst_null
     166: aconst_null
     167: aconst_null
     168: iconst_0
     169: aconst_null
     170: aconst_null
     171: bipush        63
     173: aconst_null
     174: invokestatic  #277                // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
     177: areturn

  public static final java.util.Stack<java.lang.Integer> listToStack(java.util.List<java.lang.Integer>);
    Code:
       0: aload_0
       1: ldc_w         #285                // String list
       4: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: new           #287                // class java/util/Stack
      10: dup
      11: invokespecial #288                // Method java/util/Stack."<init>":()V
      14: astore_1
      15: aload_0
      16: invokeinterface #289,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
      21: astore_2
      22: aload_2
      23: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      28: ifeq          56
      31: aload_2
      32: invokeinterface #86,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      37: checkcast     #120                // class java/lang/Number
      40: invokevirtual #123                // Method java/lang/Number.intValue:()I
      43: istore_3
      44: aload_1
      45: iload_3
      46: invokestatic  #96                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      49: invokevirtual #293                // Method java/util/Stack.push:(Ljava/lang/Object;)Ljava/lang/Object;
      52: pop
      53: goto          22
      56: aload_1
      57: areturn

  public static final int gcd(java.util.List<java.lang.Integer>);
    Code:
       0: aload_0
       1: ldc_w         #285                // String list
       4: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: invokestatic  #300                // Method listToStack:(Ljava/util/List;)Ljava/util/Stack;
      11: astore_1
      12: iconst_1
      13: aload_1
      14: invokevirtual #301                // Method java/util/Stack.size:()I
      17: if_icmpge     228
      20: iconst_0
      21: iconst_2
      22: invokestatic  #307                // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
      25: checkcast     #58                 // class java/lang/Iterable
      28: astore_3
      29: iconst_0
      30: istore        4
      32: aload_3
      33: astore        5
      35: new           #60                 // class java/util/ArrayList
      38: dup
      39: aload_3
      40: bipush        10
      42: invokestatic  #66                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      45: invokespecial #70                 // Method java/util/ArrayList."<init>":(I)V
      48: checkcast     #72                 // class java/util/Collection
      51: astore        6
      53: iconst_0
      54: istore        7
      56: aload         5
      58: invokeinterface #76,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      63: astore        8
      65: aload         8
      67: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      72: ifeq          115
      75: aload         8
      77: checkcast     #309                // class kotlin/collections/IntIterator
      80: invokevirtual #312                // Method kotlin/collections/IntIterator.nextInt:()I
      83: istore        9
      85: aload         6
      87: iload         9
      89: istore        10
      91: astore        12
      93: iconst_0
      94: istore        11
      96: aload_1
      97: invokevirtual #315                // Method java/util/Stack.pop:()Ljava/lang/Object;
     100: checkcast     #88                 // class java/lang/Integer
     103: aload         12
     105: swap
     106: invokeinterface #100,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     111: pop
     112: goto          65
     115: aload         6
     117: checkcast     #102                // class java/util/List
     120: nop
     121: astore_2
     122: aload_2
     123: iconst_1
     124: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     129: checkcast     #120                // class java/lang/Number
     132: invokevirtual #123                // Method java/lang/Number.intValue:()I
     135: aload_2
     136: iconst_0
     137: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     142: checkcast     #120                // class java/lang/Number
     145: invokevirtual #123                // Method java/lang/Number.intValue:()I
     148: if_icmpge     155
     151: iconst_1
     152: goto          156
     155: iconst_0
     156: istore_3
     157: aload_1
     158: aload_2
     159: iload_3
     160: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     165: invokevirtual #293                // Method java/util/Stack.push:(Ljava/lang/Object;)Ljava/lang/Object;
     168: pop
     169: aload_2
     170: iload_3
     171: iconst_1
     172: iadd
     173: iconst_2
     174: irem
     175: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     180: checkcast     #120                // class java/lang/Number
     183: invokevirtual #123                // Method java/lang/Number.intValue:()I
     186: aload_2
     187: iload_3
     188: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     193: dup
     194: ldc_w         #317                // String get(...)
     197: invokestatic  #270                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     200: checkcast     #120                // class java/lang/Number
     203: invokevirtual #123                // Method java/lang/Number.intValue:()I
     206: irem
     207: istore        4
     209: iconst_0
     210: iload         4
     212: if_icmpge     12
     215: aload_1
     216: iload         4
     218: invokestatic  #96                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     221: invokevirtual #293                // Method java/util/Stack.push:(Ljava/lang/Object;)Ljava/lang/Object;
     224: pop
     225: goto          12
     228: aload_1
     229: invokevirtual #315                // Method java/util/Stack.pop:()Ljava/lang/Object;
     232: dup
     233: ldc_w         #319                // String pop(...)
     236: invokestatic  #270                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     239: checkcast     #120                // class java/lang/Number
     242: invokevirtual #123                // Method java/lang/Number.intValue:()I
     245: ireturn

  public static final int lcm(java.util.List<java.lang.Integer>);
    Code:
       0: aload_0
       1: ldc_w         #285                // String list
       4: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: invokestatic  #300                // Method listToStack:(Ljava/util/List;)Ljava/util/Stack;
      11: astore_1
      12: iconst_1
      13: aload_1
      14: invokevirtual #301                // Method java/util/Stack.size:()I
      17: if_icmpge     172
      20: iconst_0
      21: iconst_2
      22: invokestatic  #307                // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
      25: checkcast     #58                 // class java/lang/Iterable
      28: astore_3
      29: iconst_0
      30: istore        4
      32: aload_3
      33: astore        5
      35: new           #60                 // class java/util/ArrayList
      38: dup
      39: aload_3
      40: bipush        10
      42: invokestatic  #66                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      45: invokespecial #70                 // Method java/util/ArrayList."<init>":(I)V
      48: checkcast     #72                 // class java/util/Collection
      51: astore        6
      53: iconst_0
      54: istore        7
      56: aload         5
      58: invokeinterface #76,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      63: astore        8
      65: aload         8
      67: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      72: ifeq          115
      75: aload         8
      77: checkcast     #309                // class kotlin/collections/IntIterator
      80: invokevirtual #312                // Method kotlin/collections/IntIterator.nextInt:()I
      83: istore        9
      85: aload         6
      87: iload         9
      89: istore        10
      91: astore        12
      93: iconst_0
      94: istore        11
      96: aload_1
      97: invokevirtual #315                // Method java/util/Stack.pop:()Ljava/lang/Object;
     100: checkcast     #88                 // class java/lang/Integer
     103: aload         12
     105: swap
     106: invokeinterface #100,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     111: pop
     112: goto          65
     115: aload         6
     117: checkcast     #102                // class java/util/List
     120: nop
     121: astore_2
     122: aload_1
     123: aload_2
     124: iconst_0
     125: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     130: checkcast     #120                // class java/lang/Number
     133: invokevirtual #123                // Method java/lang/Number.intValue:()I
     136: aload_2
     137: iconst_1
     138: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     143: dup
     144: ldc_w         #317                // String get(...)
     147: invokestatic  #270                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     150: checkcast     #120                // class java/lang/Number
     153: invokevirtual #123                // Method java/lang/Number.intValue:()I
     156: imul
     157: aload_2
     158: invokestatic  #326                // Method gcd:(Ljava/util/List;)I
     161: idiv
     162: invokestatic  #96                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     165: invokevirtual #293                // Method java/util/Stack.push:(Ljava/lang/Object;)Ljava/lang/Object;
     168: pop
     169: goto          12
     172: aload_1
     173: invokevirtual #315                // Method java/util/Stack.pop:()Ljava/lang/Object;
     176: dup
     177: ldc_w         #319                // String pop(...)
     180: invokestatic  #270                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     183: checkcast     #120                // class java/lang/Number
     186: invokevirtual #123                // Method java/lang/Number.intValue:()I
     189: ireturn
}


import java.lang.StringBuilder

private fun IntArray.toNiceString(): String {

    val sb = StringBuilder().append("[")
    this.forEach { sb.append(it).append(",") }
    if (sb.length > 1) sb.deleteCharAt(sb.lastIndex).append("]")
    return sb.toString()
}

private val IntRange.size: Int
    get() = this.last - this.first

private val IntRange.half: Int
    get() = this.first + (this.size / 2)

fun main() {

    val queries = readLine().orEmpty().trim().toInt()
    val arrays =  Array(queries) {
        readLine() // ignore first line
        readLine().orEmpty().trim().split(" ").map { l -> l.toInt() }.toIntArray()
    }

    arrays.forEach {
        println(countSwaps(it))
    }
}

fun countSwaps(array: IntArray): Long {

    return sort(array, 0 .. array.size, IntArray(array.size))
}

fun sort(array: IntArray, range: IntRange, temp: IntArray): Long {

    if (range.size <= 1) return 0
    val leftHalf = range.first .. range.half
    val rightHalf = range.half .. range.last
    return sort(array, leftHalf, temp) + sort(array, rightHalf, temp) + merge(array, leftHalf, rightHalf, temp)
}

fun merge(array: IntArray, leftHalf: IntRange, rightHalf: IntRange, temp: IntArray): Long {

    var left = leftHalf.first
    var right = rightHalf.first
    var index = left
    var swaps = 0L
    while (left < leftHalf.last && right < rightHalf.last) {

        if (array[left] <= array[right]) temp[index] = array[left++]
        else {
            swaps += right - index
            temp[index] = array[right++]
        }
        index++
    }

    while (left < leftHalf.last) temp[index++] = array[left++]
    while (right < rightHalf.last) temp[index++] = array[right++]
    for (i in leftHalf.first until rightHalf.last) array[i] = temp[i]
    return swaps
}

Compiled from "MergeSortCountingInversions.kt"
public final class MergeSortCountingInversionsKt {
  private static final java.lang.String toNiceString(int[]);
    Code:
       0: new           #8                  // class java/lang/StringBuilder
       3: dup
       4: invokespecial #12                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #14                 // String [
       9: invokevirtual #18                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: astore_1
      13: aload_0
      14: astore_2
      15: iconst_0
      16: istore_3
      17: iconst_0
      18: istore        4
      20: aload_2
      21: arraylength
      22: istore        5
      24: iload         4
      26: iload         5
      28: if_icmpge     63
      31: aload_2
      32: iload         4
      34: iaload
      35: istore        6
      37: iload         6
      39: istore        7
      41: iconst_0
      42: istore        8
      44: aload_1
      45: iload         7
      47: invokevirtual #21                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      50: ldc           #23                 // String ,
      52: invokevirtual #18                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      55: pop
      56: nop
      57: iinc          4, 1
      60: goto          24
      63: nop
      64: aload_1
      65: invokevirtual #27                 // Method java/lang/StringBuilder.length:()I
      68: iconst_1
      69: if_icmple     93
      72: aload_1
      73: aload_1
      74: invokestatic  #33                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      77: aload_1
      78: checkcast     #35                 // class java/lang/CharSequence
      81: invokestatic  #41                 // Method kotlin/text/StringsKt.getLastIndex:(Ljava/lang/CharSequence;)I
      84: invokevirtual #44                 // Method java/lang/StringBuilder.deleteCharAt:(I)Ljava/lang/StringBuilder;
      87: ldc           #46                 // String ]
      89: invokevirtual #18                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      92: pop
      93: aload_1
      94: invokevirtual #50                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      97: dup
      98: ldc           #52                 // String toString(...)
     100: invokestatic  #56                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     103: areturn

  private static final int getSize(kotlin.ranges.IntRange);
    Code:
       0: aload_0
       1: invokevirtual #74                 // Method kotlin/ranges/IntRange.getLast:()I
       4: aload_0
       5: invokevirtual #77                 // Method kotlin/ranges/IntRange.getFirst:()I
       8: isub
       9: ireturn

  private static final int getHalf(kotlin.ranges.IntRange);
    Code:
       0: aload_0
       1: invokevirtual #77                 // Method kotlin/ranges/IntRange.getFirst:()I
       4: aload_0
       5: invokestatic  #82                 // Method getSize:(Lkotlin/ranges/IntRange;)I
       8: iconst_2
       9: idiv
      10: iadd
      11: ireturn

  public static final void main();
    Code:
       0: nop
       1: nop
       2: invokestatic  #89                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       5: dup
       6: ifnonnull     12
       9: pop
      10: ldc           #91                 // String
      12: checkcast     #35                 // class java/lang/CharSequence
      15: invokestatic  #95                 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
      18: invokevirtual #96                 // Method java/lang/Object.toString:()Ljava/lang/String;
      21: invokestatic  #102                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      24: istore_0
      25: iconst_0
      26: istore_2
      27: iload_0
      28: anewarray     #67                 // class "[I"
      31: astore_3
      32: iload_2
      33: iload_0
      34: if_icmpge     220
      37: iload_2
      38: istore        4
      40: aload_3
      41: iload         4
      43: invokestatic  #89                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
      46: pop
      47: nop
      48: invokestatic  #89                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
      51: dup
      52: ifnonnull     58
      55: pop
      56: ldc           #91                 // String
      58: checkcast     #35                 // class java/lang/CharSequence
      61: invokestatic  #95                 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
      64: invokevirtual #96                 // Method java/lang/Object.toString:()Ljava/lang/String;
      67: checkcast     #35                 // class java/lang/CharSequence
      70: iconst_1
      71: anewarray     #104                // class java/lang/String
      74: astore        5
      76: aload         5
      78: iconst_0
      79: ldc           #106                // String
      81: aastore
      82: aload         5
      84: iconst_0
      85: iconst_0
      86: bipush        6
      88: aconst_null
      89: invokestatic  #110                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      92: checkcast     #112                // class java/lang/Iterable
      95: astore        5
      97: istore        15
      99: astore        14
     101: iconst_0
     102: istore        6
     104: aload         5
     106: astore        7
     108: new           #114                // class java/util/ArrayList
     111: dup
     112: aload         5
     114: bipush        10
     116: invokestatic  #120                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     119: invokespecial #123                // Method java/util/ArrayList."<init>":(I)V
     122: checkcast     #125                // class java/util/Collection
     125: astore        8
     127: iconst_0
     128: istore        9
     130: aload         7
     132: invokeinterface #129,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     137: astore        10
     139: aload         10
     141: invokeinterface #135,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     146: ifeq          193
     149: aload         10
     151: invokeinterface #139,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     156: astore        11
     158: aload         8
     160: aload         11
     162: checkcast     #104                // class java/lang/String
     165: astore        12
     167: astore        16
     169: iconst_0
     170: istore        13
     172: aload         12
     174: invokestatic  #102                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     177: nop
     178: invokestatic  #143                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     181: aload         16
     183: swap
     184: invokeinterface #147,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     189: pop
     190: goto          139
     193: aload         8
     195: checkcast     #149                // class java/util/List
     198: nop
     199: astore        16
     201: aload         14
     203: iload         15
     205: aload         16
     207: checkcast     #125                // class java/util/Collection
     210: invokestatic  #153                // Method kotlin/collections/CollectionsKt.toIntArray:(Ljava/util/Collection;)[I
     213: aastore
     214: iinc          2, 1
     217: goto          32
     220: aload_3
     221: astore_1
     222: aload_1
     223: checkcast     #155                // class "[Ljava/lang/Object;"
     226: astore_2
     227: iconst_0
     228: istore_3
     229: iconst_0
     230: istore        4
     232: aload_2
     233: arraylength
     234: istore        5
     236: iload         4
     238: iload         5
     240: if_icmpge     282
     243: aload_2
     244: iload         4
     246: aaload
     247: astore        6
     249: aload         6
     251: checkcast     #67                 // class "[I"
     254: astore        7
     256: iconst_0
     257: istore        8
     259: aload         7
     261: invokestatic  #159                // Method countSwaps:([I)J
     264: lstore        9
     266: getstatic     #165                // Field java/lang/System.out:Ljava/io/PrintStream;
     269: lload         9
     271: invokevirtual #171                // Method java/io/PrintStream.println:(J)V
     274: nop
     275: nop
     276: iinc          4, 1
     279: goto          236
     282: nop
     283: return

  public static final long countSwaps(int[]);
    Code:
       0: aload_0
       1: ldc           #191                // String array
       3: invokestatic  #194                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: new           #71                 // class kotlin/ranges/IntRange
      10: dup
      11: iconst_0
      12: aload_0
      13: arraylength
      14: invokespecial #197                // Method kotlin/ranges/IntRange."<init>":(II)V
      17: aload_0
      18: arraylength
      19: newarray       int
      21: invokestatic  #201                // Method sort:([ILkotlin/ranges/IntRange;[I)J
      24: lreturn

  public static final long sort(int[], kotlin.ranges.IntRange, int[]);
    Code:
       0: aload_0
       1: ldc           #191                // String array
       3: invokestatic  #194                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #203                // String range
       9: invokestatic  #194                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_2
      13: ldc           #205                // String temp
      15: invokestatic  #194                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: aload_1
      19: invokestatic  #82                 // Method getSize:(Lkotlin/ranges/IntRange;)I
      22: iconst_1
      23: if_icmpgt     28
      26: lconst_0
      27: lreturn
      28: new           #71                 // class kotlin/ranges/IntRange
      31: dup
      32: aload_1
      33: invokevirtual #77                 // Method kotlin/ranges/IntRange.getFirst:()I
      36: aload_1
      37: invokestatic  #207                // Method getHalf:(Lkotlin/ranges/IntRange;)I
      40: invokespecial #197                // Method kotlin/ranges/IntRange."<init>":(II)V
      43: astore_3
      44: new           #71                 // class kotlin/ranges/IntRange
      47: dup
      48: aload_1
      49: invokestatic  #207                // Method getHalf:(Lkotlin/ranges/IntRange;)I
      52: aload_1
      53: invokevirtual #74                 // Method kotlin/ranges/IntRange.getLast:()I
      56: invokespecial #197                // Method kotlin/ranges/IntRange."<init>":(II)V
      59: astore        4
      61: aload_0
      62: aload_3
      63: aload_2
      64: invokestatic  #201                // Method sort:([ILkotlin/ranges/IntRange;[I)J
      67: aload_0
      68: aload         4
      70: aload_2
      71: invokestatic  #201                // Method sort:([ILkotlin/ranges/IntRange;[I)J
      74: ladd
      75: aload_0
      76: aload_3
      77: aload         4
      79: aload_2
      80: invokestatic  #211                // Method merge:([ILkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;[I)J
      83: ladd
      84: lreturn

  public static final long merge(int[], kotlin.ranges.IntRange, kotlin.ranges.IntRange, int[]);
    Code:
       0: aload_0
       1: ldc           #191                // String array
       3: invokestatic  #194                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #214                // String leftHalf
       9: invokestatic  #194                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_2
      13: ldc           #215                // String rightHalf
      15: invokestatic  #194                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: aload_3
      19: ldc           #205                // String temp
      21: invokestatic  #194                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      24: aload_1
      25: invokevirtual #77                 // Method kotlin/ranges/IntRange.getFirst:()I
      28: istore        4
      30: aload_2
      31: invokevirtual #77                 // Method kotlin/ranges/IntRange.getFirst:()I
      34: istore        5
      36: iload         4
      38: istore        6
      40: lconst_0
      41: lstore        7
      43: iload         4
      45: aload_1
      46: invokevirtual #74                 // Method kotlin/ranges/IntRange.getLast:()I
      49: if_icmpge     114
      52: iload         5
      54: aload_2
      55: invokevirtual #74                 // Method kotlin/ranges/IntRange.getLast:()I
      58: if_icmpge     114
      61: aload_0
      62: iload         4
      64: iaload
      65: aload_0
      66: iload         5
      68: iaload
      69: if_icmpgt     86
      72: aload_3
      73: iload         6
      75: aload_0
      76: iload         4
      78: iinc          4, 1
      81: iaload
      82: iastore
      83: goto          108
      86: lload         7
      88: iload         5
      90: iload         6
      92: isub
      93: i2l
      94: ladd
      95: lstore        7
      97: aload_3
      98: iload         6
     100: aload_0
     101: iload         5
     103: iinc          5, 1
     106: iaload
     107: iastore
     108: iinc          6, 1
     111: goto          43
     114: iload         4
     116: aload_1
     117: invokevirtual #74                 // Method kotlin/ranges/IntRange.getLast:()I
     120: if_icmpge     140
     123: aload_3
     124: iload         6
     126: iinc          6, 1
     129: aload_0
     130: iload         4
     132: iinc          4, 1
     135: iaload
     136: iastore
     137: goto          114
     140: iload         5
     142: aload_2
     143: invokevirtual #74                 // Method kotlin/ranges/IntRange.getLast:()I
     146: if_icmpge     166
     149: aload_3
     150: iload         6
     152: iinc          6, 1
     155: aload_0
     156: iload         5
     158: iinc          5, 1
     161: iaload
     162: iastore
     163: goto          140
     166: aload_1
     167: invokevirtual #77                 // Method kotlin/ranges/IntRange.getFirst:()I
     170: istore        9
     172: aload_2
     173: invokevirtual #74                 // Method kotlin/ranges/IntRange.getLast:()I
     176: istore        10
     178: iload         9
     180: iload         10
     182: if_icmpge     199
     185: aload_0
     186: iload         9
     188: aload_3
     189: iload         9
     191: iaload
     192: iastore
     193: iinc          9, 1
     196: goto          178
     199: lload         7
     201: lreturn

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


fun main() {

    readLine() // ignore first input
    val str = readLine().orEmpty()

    var count = 0L
    val freqTable = buildFreqTable(str)

    // all singles
    for (freq in freqTable) count += triangleNumber(freq.second)

    // all "middle" cases
    for (i in 0 until freqTable.size - 2) {

        if (freqTable[i + 1].second == 1 && freqTable[i].first == freqTable[i + 2].first) {

            count += Math.min(freqTable[i].second, freqTable[i + 2].second)
        }
    }

    println(count)
}

private fun buildFreqTable(str: String): List<Pair<Char, Int>> {

    if (str.length == 1) return listOf(Pair(str[0], 1))

    val table = mutableListOf<Pair<Char, Int>>()
    var lastChar = str[0]
    var count = 1
    for (i in 1 until str.length) {

        if (str[i] == lastChar) count++
        else {
            table.add(Pair(lastChar, count))
            lastChar = str[i]
            count = 1
        }
    }

    table.add(Pair(lastChar, count))
    return table
}

private fun triangleNumber(n: Int) = (n * (n + 1L)) / 2L

Compiled from "SpecialPalindromeAgain.kt"
public final class SpecialPalindromeAgainKt {
  public static final void main();
    Code:
       0: invokestatic  #12                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       3: pop
       4: invokestatic  #12                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       7: dup
       8: ifnonnull     14
      11: pop
      12: ldc           #14                 // String
      14: astore_0
      15: lconst_0
      16: lstore_1
      17: aload_0
      18: invokestatic  #18                 // Method buildFreqTable:(Ljava/lang/String;)Ljava/util/List;
      21: astore_3
      22: aload_3
      23: invokeinterface #24,  1           // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
      28: astore        4
      30: aload         4
      32: invokeinterface #30,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      37: ifeq          72
      40: aload         4
      42: invokeinterface #34,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      47: checkcast     #36                 // class kotlin/Pair
      50: astore        5
      52: lload_1
      53: aload         5
      55: invokevirtual #39                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      58: checkcast     #41                 // class java/lang/Number
      61: invokevirtual #45                 // Method java/lang/Number.intValue:()I
      64: invokestatic  #49                 // Method triangleNumber:(I)J
      67: ladd
      68: lstore_1
      69: goto          30
      72: iconst_0
      73: istore        4
      75: aload_3
      76: invokeinterface #52,  1           // InterfaceMethod java/util/List.size:()I
      81: iconst_2
      82: isub
      83: istore        5
      85: iload         4
      87: iload         5
      89: if_icmpge     218
      92: aload_3
      93: iload         4
      95: iconst_1
      96: iadd
      97: invokeinterface #56,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     102: checkcast     #36                 // class kotlin/Pair
     105: invokevirtual #39                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     108: checkcast     #41                 // class java/lang/Number
     111: invokevirtual #45                 // Method java/lang/Number.intValue:()I
     114: iconst_1
     115: if_icmpne     212
     118: aload_3
     119: iload         4
     121: invokeinterface #56,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     126: checkcast     #36                 // class kotlin/Pair
     129: invokevirtual #59                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     132: checkcast     #61                 // class java/lang/Character
     135: invokevirtual #65                 // Method java/lang/Character.charValue:()C
     138: aload_3
     139: iload         4
     141: iconst_2
     142: iadd
     143: invokeinterface #56,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     148: checkcast     #36                 // class kotlin/Pair
     151: invokevirtual #59                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     154: checkcast     #61                 // class java/lang/Character
     157: invokevirtual #65                 // Method java/lang/Character.charValue:()C
     160: if_icmpne     212
     163: lload_1
     164: aload_3
     165: iload         4
     167: invokeinterface #56,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     172: checkcast     #36                 // class kotlin/Pair
     175: invokevirtual #39                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     178: checkcast     #41                 // class java/lang/Number
     181: invokevirtual #45                 // Method java/lang/Number.intValue:()I
     184: aload_3
     185: iload         4
     187: iconst_2
     188: iadd
     189: invokeinterface #56,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     194: checkcast     #36                 // class kotlin/Pair
     197: invokevirtual #39                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     200: checkcast     #41                 // class java/lang/Number
     203: invokevirtual #45                 // Method java/lang/Number.intValue:()I
     206: invokestatic  #71                 // Method java/lang/Math.min:(II)I
     209: i2l
     210: ladd
     211: lstore_1
     212: iinc          4, 1
     215: goto          85
     218: getstatic     #77                 // Field java/lang/System.out:Ljava/io/PrintStream;
     221: lload_1
     222: invokevirtual #83                 // Method java/io/PrintStream.println:(J)V
     225: return

  private static final java.util.List<kotlin.Pair<java.lang.Character, java.lang.Integer>> buildFreqTable(java.lang.String);
    Code:
       0: aload_0
       1: invokevirtual #99                 // Method java/lang/String.length:()I
       4: iconst_1
       5: if_icmpne     31
       8: new           #36                 // class kotlin/Pair
      11: dup
      12: aload_0
      13: iconst_0
      14: invokevirtual #103                // Method java/lang/String.charAt:(I)C
      17: invokestatic  #107                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      20: iconst_1
      21: invokestatic  #112                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      24: invokespecial #116                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
      27: invokestatic  #122                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
      30: areturn
      31: new           #124                // class java/util/ArrayList
      34: dup
      35: invokespecial #126                // Method java/util/ArrayList."<init>":()V
      38: checkcast     #20                 // class java/util/List
      41: astore_1
      42: aload_0
      43: iconst_0
      44: invokevirtual #103                // Method java/lang/String.charAt:(I)C
      47: istore_2
      48: iconst_1
      49: istore_3
      50: iconst_1
      51: istore        4
      53: aload_0
      54: invokevirtual #99                 // Method java/lang/String.length:()I
      57: istore        5
      59: iload         4
      61: iload         5
      63: if_icmpge     121
      66: aload_0
      67: iload         4
      69: invokevirtual #103                // Method java/lang/String.charAt:(I)C
      72: iload_2
      73: if_icmpne     84
      76: iload_3
      77: iinc          3, 1
      80: pop
      81: goto          115
      84: aload_1
      85: new           #36                 // class kotlin/Pair
      88: dup
      89: iload_2
      90: invokestatic  #107                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      93: iload_3
      94: invokestatic  #112                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      97: invokespecial #116                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     100: invokeinterface #130,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     105: pop
     106: aload_0
     107: iload         4
     109: invokevirtual #103                // Method java/lang/String.charAt:(I)C
     112: istore_2
     113: iconst_1
     114: istore_3
     115: iinc          4, 1
     118: goto          59
     121: aload_1
     122: new           #36                 // class kotlin/Pair
     125: dup
     126: iload_2
     127: invokestatic  #107                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     130: iload_3
     131: invokestatic  #112                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     134: invokespecial #116                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     137: invokeinterface #130,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     142: pop
     143: aload_1
     144: areturn

  private static final long triangleNumber(int);
    Code:
       0: iload_0
       1: i2l
       2: iload_0
       3: i2l
       4: lconst_1
       5: ladd
       6: lmul
       7: ldc2_w        #134                // long 2l
      10: ldiv
      11: lreturn

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


// https://www.hackerrank.com/challenges/fraudulent-activity-notifications/problem

fun main() {

    val (_, days) = readLine().orEmpty().trim().split(" ").map(String::toInt)
    val expenditures = readLine().orEmpty().trim().split(" ").map(String::toInt).toTypedArray()
    fraudulentActivityNotifications(days, expenditures)
}

fun fraudulentActivityNotifications(days: Int, expenditures: Array<Int>) {

    val countArray = IntArray(200)
    var qty = 0

    // initialize
    for (i in 0 until days) {
        countArray[expenditures[i]]++
    }

    for (i in days until expenditures.size) {

        if (expenditures[i] >= median(days, countArray)) qty++
        countArray[expenditures[i - days]]--
        countArray[expenditures[i]]++
    }

    println(qty)
}

fun median(days: Int, countArray: IntArray): Int {

    var count = 0
    val even = days % 2 == 0
    val medianIdx = days / 2
    var foundFirst = false
    var median = 0
    for (countIdx in 0 until countArray.size) {

        count += countArray[countIdx]
        if (!even) {
            if (count > medianIdx) {

                median = countIdx * 2
                break
            }
        } else {

            if (countArray[countIdx] > 0 && count == medianIdx) {

                median = countIdx
                foundFirst = true
            } else if (countArray[countIdx] > 0 && count > medianIdx) {

                if (foundFirst) median += countIdx
                else median = countIdx * 2
                break
            }
        }
    }

    return median
}

Compiled from "FraudulentActivityNotifications.kt"
public final class FraudulentActivityNotificationsKt {
  public static final void main();
    Code:
       0: nop
       1: invokestatic  #12                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       4: dup
       5: ifnonnull     11
       8: pop
       9: ldc           #14                 // String
      11: checkcast     #16                 // class java/lang/CharSequence
      14: invokestatic  #22                 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
      17: invokevirtual #25                 // Method java/lang/Object.toString:()Ljava/lang/String;
      20: checkcast     #16                 // class java/lang/CharSequence
      23: iconst_1
      24: anewarray     #27                 // class java/lang/String
      27: astore_0
      28: aload_0
      29: iconst_0
      30: ldc           #29                 // String
      32: aastore
      33: aload_0
      34: iconst_0
      35: iconst_0
      36: bipush        6
      38: aconst_null
      39: invokestatic  #33                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      42: checkcast     #35                 // class java/lang/Iterable
      45: astore_0
      46: iconst_0
      47: istore_1
      48: aload_0
      49: astore_2
      50: new           #37                 // class java/util/ArrayList
      53: dup
      54: aload_0
      55: bipush        10
      57: invokestatic  #43                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      60: invokespecial #47                 // Method java/util/ArrayList."<init>":(I)V
      63: checkcast     #49                 // class java/util/Collection
      66: astore_3
      67: iconst_0
      68: istore        4
      70: aload_2
      71: invokeinterface #53,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      76: astore        5
      78: aload         5
      80: invokeinterface #59,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      85: ifeq          131
      88: aload         5
      90: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      95: astore        6
      97: aload_3
      98: aload         6
     100: checkcast     #27                 // class java/lang/String
     103: astore        7
     105: astore        11
     107: iconst_0
     108: istore        8
     110: aload         7
     112: invokestatic  #69                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     115: nop
     116: invokestatic  #73                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     119: aload         11
     121: swap
     122: invokeinterface #77,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     127: pop
     128: goto          78
     131: aload_3
     132: checkcast     #79                 // class java/util/List
     135: nop
     136: iconst_1
     137: invokeinterface #83,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     142: checkcast     #85                 // class java/lang/Number
     145: invokevirtual #89                 // Method java/lang/Number.intValue:()I
     148: istore_0
     149: nop
     150: invokestatic  #12                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
     153: dup
     154: ifnonnull     160
     157: pop
     158: ldc           #14                 // String
     160: checkcast     #16                 // class java/lang/CharSequence
     163: invokestatic  #22                 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     166: invokevirtual #25                 // Method java/lang/Object.toString:()Ljava/lang/String;
     169: checkcast     #16                 // class java/lang/CharSequence
     172: iconst_1
     173: anewarray     #27                 // class java/lang/String
     176: astore_2
     177: aload_2
     178: iconst_0
     179: ldc           #29                 // String
     181: aastore
     182: aload_2
     183: iconst_0
     184: iconst_0
     185: bipush        6
     187: aconst_null
     188: invokestatic  #33                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     191: checkcast     #35                 // class java/lang/Iterable
     194: astore_2
     195: iconst_0
     196: istore_3
     197: aload_2
     198: astore        4
     200: new           #37                 // class java/util/ArrayList
     203: dup
     204: aload_2
     205: bipush        10
     207: invokestatic  #43                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     210: invokespecial #47                 // Method java/util/ArrayList."<init>":(I)V
     213: checkcast     #49                 // class java/util/Collection
     216: astore        5
     218: iconst_0
     219: istore        6
     221: aload         4
     223: invokeinterface #53,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     228: astore        7
     230: aload         7
     232: invokeinterface #59,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     237: ifeq          284
     240: aload         7
     242: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     247: astore        8
     249: aload         5
     251: aload         8
     253: checkcast     #27                 // class java/lang/String
     256: astore        9
     258: astore        11
     260: iconst_0
     261: istore        10
     263: aload         9
     265: invokestatic  #69                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     268: nop
     269: invokestatic  #73                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     272: aload         11
     274: swap
     275: invokeinterface #77,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     280: pop
     281: goto          230
     284: aload         5
     286: checkcast     #79                 // class java/util/List
     289: nop
     290: checkcast     #49                 // class java/util/Collection
     293: astore_2
     294: nop
     295: iconst_0
     296: istore_3
     297: aload_2
     298: astore        4
     300: aload         4
     302: iconst_0
     303: anewarray     #65                 // class java/lang/Integer
     306: invokeinterface #93,  2           // InterfaceMethod java/util/Collection.toArray:([Ljava/lang/Object;)[Ljava/lang/Object;
     311: checkcast     #95                 // class "[Ljava/lang/Integer;"
     314: astore_1
     315: iload_0
     316: aload_1
     317: invokestatic  #99                 // Method fraudulentActivityNotifications:(I[Ljava/lang/Integer;)V
     320: return

  public static final void fraudulentActivityNotifications(int, java.lang.Integer[]);
    Code:
       0: aload_1
       1: ldc           #120                // String expenditures
       3: invokestatic  #126                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: sipush        200
       9: newarray       int
      11: astore_2
      12: iconst_0
      13: istore_3
      14: iconst_0
      15: istore        4
      17: iload         4
      19: iload_0
      20: if_icmpge     52
      23: aload_1
      24: iload         4
      26: aaload
      27: invokevirtual #127                // Method java/lang/Integer.intValue:()I
      30: istore        5
      32: aload_2
      33: iload         5
      35: iaload
      36: istore        6
      38: aload_2
      39: iload         5
      41: iload         6
      43: iconst_1
      44: iadd
      45: iastore
      46: iinc          4, 1
      49: goto          17
      52: iload_0
      53: istore        4
      55: aload_1
      56: arraylength
      57: istore        5
      59: iload         4
      61: iload         5
      63: if_icmpge     138
      66: aload_1
      67: iload         4
      69: aaload
      70: invokevirtual #127                // Method java/lang/Integer.intValue:()I
      73: iload_0
      74: aload_2
      75: invokestatic  #131                // Method median:(I[I)I
      78: if_icmplt     84
      81: iinc          3, 1
      84: aload_1
      85: iload         4
      87: iload_0
      88: isub
      89: aaload
      90: invokevirtual #127                // Method java/lang/Integer.intValue:()I
      93: istore        6
      95: aload_2
      96: iload         6
      98: iaload
      99: istore        7
     101: aload_2
     102: iload         6
     104: iload         7
     106: iconst_m1
     107: iadd
     108: iastore
     109: aload_1
     110: iload         4
     112: aaload
     113: invokevirtual #127                // Method java/lang/Integer.intValue:()I
     116: istore        8
     118: aload_2
     119: iload         8
     121: iaload
     122: istore        9
     124: aload_2
     125: iload         8
     127: iload         9
     129: iconst_1
     130: iadd
     131: iastore
     132: iinc          4, 1
     135: goto          59
     138: getstatic     #137                // Field java/lang/System.out:Ljava/io/PrintStream;
     141: iload_3
     142: invokevirtual #142                // Method java/io/PrintStream.println:(I)V
     145: return

  public static final int median(int, int[]);
    Code:
       0: aload_1
       1: ldc           #148                // String countArray
       3: invokestatic  #126                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_0
       7: istore_2
       8: iload_0
       9: iconst_2
      10: irem
      11: ifne          18
      14: iconst_1
      15: goto          19
      18: iconst_0
      19: istore_3
      20: iload_0
      21: iconst_2
      22: idiv
      23: istore        4
      25: iconst_0
      26: istore        5
      28: iconst_0
      29: istore        6
      31: iconst_0
      32: istore        7
      34: aload_1
      35: arraylength
      36: istore        8
      38: iload         7
      40: iload         8
      42: if_icmpge     137
      45: iload_2
      46: aload_1
      47: iload         7
      49: iaload
      50: iadd
      51: istore_2
      52: iload_3
      53: ifne          71
      56: iload_2
      57: iload         4
      59: if_icmple     131
      62: iload         7
      64: iconst_2
      65: imul
      66: istore        6
      68: goto          137
      71: aload_1
      72: iload         7
      74: iaload
      75: ifle          94
      78: iload_2
      79: iload         4
      81: if_icmpne     94
      84: iload         7
      86: istore        6
      88: iconst_1
      89: istore        5
      91: goto          131
      94: aload_1
      95: iload         7
      97: iaload
      98: ifle          131
     101: iload_2
     102: iload         4
     104: if_icmple     131
     107: iload         5
     109: ifeq          122
     112: iload         6
     114: iload         7
     116: iadd
     117: istore        6
     119: goto          128
     122: iload         7
     124: iconst_2
     125: imul
     126: istore        6
     128: goto          137
     131: iinc          7, 1
     134: goto          38
     137: iload         6
     139: ireturn

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