package kickstart2022.g

// TODO
fun main() {
    val inputFileName = "src/kickstart2022/g/CuteLittleButterfly.in"
    java.io.File(inputFileName).takeIf { it.exists() }?.also { System.setIn(it.inputStream()) }

    for (case in 1..readLine()!!.toInt()) {
        val (n, e) = readLine()!!.split(' ').map { it.toInt() }

        val f = Array(n) {
            val (x, y, c) = readLine()!!.split(' ').map { it.toInt() }
            Flower(x, y, c)
        }.toList()

        val res = findBestWay(0, 500, 1, f, e)

        println("Case #$case: $res")
    }
}

data class Flower(val x: Int, val y: Int, val c: Int)

fun findBestWay(x: Int, y: Int, d: Int, f: List<Flower>, e: Int): Int {
    val g = f.filter { it.y <= y }

    return g.mapIndexed { i, it ->
        when {
            g.size == 1 && it.x * d >= x * d -> it.c
            g.size == 1 && it.x * d <= x * d && it.c > e -> it.c - e
            g.size > 1 && it.x * d >= x * d -> it.c + findBestWay(it.x, it.y, d, g.filterIndexed { j, _ -> i != j }, e)
            g.size > 1 && it.x * d <= x * d && it.c > e -> it.c - e + findBestWay(it.x, it.y, -d, g.filterIndexed { j, _ -> i != j }, e)
            else -> 0
        }
    }.maxOrNull() ?: 0
}

Compiled from "CuteLittleButterfly.kt"
public final class kickstart2022.g.CuteLittleButterflyKt {
  public static final void main();
    Code:
       0: ldc           #8                  // String src/kickstart2022/g/CuteLittleButterfly.in
       2: astore_0
       3: new           #10                 // class java/io/File
       6: dup
       7: aload_0
       8: invokespecial #14                 // Method java/io/File."<init>":(Ljava/lang/String;)V
      11: astore_2
      12: aload_2
      13: astore_3
      14: iconst_0
      15: istore        4
      17: aload_3
      18: invokevirtual #18                 // Method java/io/File.exists:()Z
      21: ifeq          28
      24: aload_2
      25: goto          29
      28: aconst_null
      29: dup
      30: ifnull        56
      33: astore_2
      34: aload_2
      35: astore_3
      36: iconst_0
      37: istore        4
      39: new           #20                 // class java/io/FileInputStream
      42: dup
      43: aload_3
      44: invokespecial #23                 // Method java/io/FileInputStream."<init>":(Ljava/io/File;)V
      47: checkcast     #25                 // class java/io/InputStream
      50: invokestatic  #31                 // Method java/lang/System.setIn:(Ljava/io/InputStream;)V
      53: goto          58
      56: pop
      57: nop
      58: iconst_1
      59: istore_1
      60: invokestatic  #37                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
      63: dup
      64: invokestatic  #43                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      67: invokestatic  #49                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      70: istore_2
      71: iload_1
      72: iload_2
      73: if_icmpgt     550
      76: invokestatic  #37                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
      79: dup
      80: invokestatic  #43                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      83: checkcast     #51                 // class java/lang/CharSequence
      86: iconst_1
      87: newarray       char
      89: astore        4
      91: aload         4
      93: iconst_0
      94: bipush        32
      96: castore
      97: aload         4
      99: iconst_0
     100: iconst_0
     101: bipush        6
     103: aconst_null
     104: invokestatic  #57                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[CZIILjava/lang/Object;)Ljava/util/List;
     107: checkcast     #59                 // class java/lang/Iterable
     110: astore        4
     112: iconst_0
     113: istore        5
     115: aload         4
     117: astore        6
     119: new           #61                 // class java/util/ArrayList
     122: dup
     123: aload         4
     125: bipush        10
     127: invokestatic  #67                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     130: invokespecial #70                 // Method java/util/ArrayList."<init>":(I)V
     133: checkcast     #72                 // class java/util/Collection
     136: astore        7
     138: iconst_0
     139: istore        8
     141: aload         6
     143: invokeinterface #76,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     148: astore        9
     150: aload         9
     152: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     157: ifeq          204
     160: aload         9
     162: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     167: astore        10
     169: aload         7
     171: aload         10
     173: checkcast     #87                 // class java/lang/String
     176: astore        11
     178: astore        20
     180: iconst_0
     181: istore        12
     183: aload         11
     185: invokestatic  #49                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     188: nop
     189: invokestatic  #91                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     192: aload         20
     194: swap
     195: invokeinterface #95,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     200: pop
     201: goto          150
     204: aload         7
     206: checkcast     #97                 // class java/util/List
     209: nop
     210: astore_3
     211: aload_3
     212: iconst_0
     213: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     218: checkcast     #103                // class java/lang/Number
     221: invokevirtual #107                // Method java/lang/Number.intValue:()I
     224: istore        4
     226: aload_3
     227: iconst_1
     228: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     233: checkcast     #103                // class java/lang/Number
     236: invokevirtual #107                // Method java/lang/Number.intValue:()I
     239: istore        5
     241: iconst_0
     242: istore        7
     244: iload         4
     246: anewarray     #109                // class kickstart2022/g/Flower
     249: astore        8
     251: iload         7
     253: iload         4
     255: if_icmpge     482
     258: iload         7
     260: istore        9
     262: aload         8
     264: iload         9
     266: invokestatic  #37                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
     269: dup
     270: invokestatic  #43                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     273: checkcast     #51                 // class java/lang/CharSequence
     276: iconst_1
     277: newarray       char
     279: astore        11
     281: aload         11
     283: iconst_0
     284: bipush        32
     286: castore
     287: aload         11
     289: iconst_0
     290: iconst_0
     291: bipush        6
     293: aconst_null
     294: invokestatic  #57                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[CZIILjava/lang/Object;)Ljava/util/List;
     297: checkcast     #59                 // class java/lang/Iterable
     300: astore        11
     302: istore        21
     304: astore        20
     306: iconst_0
     307: istore        12
     309: aload         11
     311: astore        13
     313: new           #61                 // class java/util/ArrayList
     316: dup
     317: aload         11
     319: bipush        10
     321: invokestatic  #67                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     324: invokespecial #70                 // Method java/util/ArrayList."<init>":(I)V
     327: checkcast     #72                 // class java/util/Collection
     330: astore        14
     332: iconst_0
     333: istore        15
     335: aload         13
     337: invokeinterface #76,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     342: astore        16
     344: aload         16
     346: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     351: ifeq          398
     354: aload         16
     356: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     361: astore        17
     363: aload         14
     365: aload         17
     367: checkcast     #87                 // class java/lang/String
     370: astore        18
     372: astore        22
     374: iconst_0
     375: istore        19
     377: aload         18
     379: invokestatic  #49                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     382: nop
     383: invokestatic  #91                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     386: aload         22
     388: swap
     389: invokeinterface #95,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     394: pop
     395: goto          344
     398: aload         14
     400: checkcast     #97                 // class java/util/List
     403: nop
     404: astore        22
     406: aload         20
     408: iload         21
     410: aload         22
     412: astore        10
     414: aload         10
     416: iconst_0
     417: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     422: checkcast     #103                // class java/lang/Number
     425: invokevirtual #107                // Method java/lang/Number.intValue:()I
     428: istore        11
     430: aload         10
     432: iconst_1
     433: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     438: checkcast     #103                // class java/lang/Number
     441: invokevirtual #107                // Method java/lang/Number.intValue:()I
     444: istore        12
     446: aload         10
     448: iconst_2
     449: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     454: checkcast     #103                // class java/lang/Number
     457: invokevirtual #107                // Method java/lang/Number.intValue:()I
     460: istore        13
     462: new           #109                // class kickstart2022/g/Flower
     465: dup
     466: iload         11
     468: iload         12
     470: iload         13
     472: invokespecial #112                // Method kickstart2022/g/Flower."<init>":(III)V
     475: aastore
     476: iinc          7, 1
     479: goto          251
     482: aload         8
     484: invokestatic  #118                // Method kotlin/collections/ArraysKt.toList:([Ljava/lang/Object;)Ljava/util/List;
     487: astore        6
     489: iconst_0
     490: sipush        500
     493: iconst_1
     494: aload         6
     496: iload         5
     498: invokestatic  #122                // Method findBestWay:(IIILjava/util/List;I)I
     501: istore        7
     503: new           #124                // class java/lang/StringBuilder
     506: dup
     507: invokespecial #126                // Method java/lang/StringBuilder."<init>":()V
     510: ldc           #128                // String Case #
     512: invokevirtual #132                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     515: iload_1
     516: invokevirtual #135                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     519: ldc           #137                // String :
     521: invokevirtual #132                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     524: iload         7
     526: invokevirtual #135                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     529: invokevirtual #140                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     532: getstatic     #144                // Field java/lang/System.out:Ljava/io/PrintStream;
     535: swap
     536: invokevirtual #149                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     539: iload_1
     540: iload_2
     541: if_icmpeq     550
     544: iinc          1, 1
     547: goto          76
     550: return

  public static final int findBestWay(int, int, int, java.util.List<kickstart2022.g.Flower>, int);
    Code:
       0: aload_3
       1: ldc           #181                // String f
       3: invokestatic  #185                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_3
       7: checkcast     #59                 // class java/lang/Iterable
      10: astore        6
      12: iconst_0
      13: istore        7
      15: aload         6
      17: astore        8
      19: new           #61                 // class java/util/ArrayList
      22: dup
      23: invokespecial #186                // Method java/util/ArrayList."<init>":()V
      26: checkcast     #72                 // class java/util/Collection
      29: astore        9
      31: iconst_0
      32: istore        10
      34: aload         8
      36: invokeinterface #76,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      41: astore        11
      43: aload         11
      45: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      50: ifeq          102
      53: aload         11
      55: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      60: astore        12
      62: aload         12
      64: checkcast     #109                // class kickstart2022/g/Flower
      67: astore        13
      69: iconst_0
      70: istore        14
      72: aload         13
      74: invokevirtual #189                // Method kickstart2022/g/Flower.getY:()I
      77: iload_1
      78: if_icmpgt     85
      81: iconst_1
      82: goto          86
      85: iconst_0
      86: ifeq          43
      89: aload         9
      91: aload         12
      93: invokeinterface #95,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      98: pop
      99: goto          43
     102: aload         9
     104: checkcast     #97                 // class java/util/List
     107: nop
     108: astore        5
     110: aload         5
     112: checkcast     #59                 // class java/lang/Iterable
     115: astore        7
     117: iconst_0
     118: istore        8
     120: aload         7
     122: astore        9
     124: new           #61                 // class java/util/ArrayList
     127: dup
     128: aload         7
     130: bipush        10
     132: invokestatic  #67                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     135: invokespecial #70                 // Method java/util/ArrayList."<init>":(I)V
     138: checkcast     #72                 // class java/util/Collection
     141: astore        10
     143: iconst_0
     144: istore        11
     146: iconst_0
     147: istore        12
     149: aload         9
     151: invokeinterface #76,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     156: astore        13
     158: aload         13
     160: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     165: ifeq          743
     168: aload         13
     170: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     175: astore        14
     177: aload         10
     179: iload         12
     181: iinc          12, 1
     184: istore        15
     186: iload         15
     188: ifge          194
     191: invokestatic  #192                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     194: iload         15
     196: aload         14
     198: checkcast     #109                // class kickstart2022/g/Flower
     201: astore        16
     203: istore        17
     205: astore        40
     207: iconst_0
     208: istore        18
     210: nop
     211: aload         5
     213: invokeinterface #195,  1          // InterfaceMethod java/util/List.size:()I
     218: iconst_1
     219: if_icmpne     243
     222: aload         16
     224: invokevirtual #198                // Method kickstart2022/g/Flower.getX:()I
     227: iload_2
     228: imul
     229: iload_0
     230: iload_2
     231: imul
     232: if_icmplt     243
     235: aload         16
     237: invokevirtual #201                // Method kickstart2022/g/Flower.getC:()I
     240: goto          727
     243: aload         5
     245: invokeinterface #195,  1          // InterfaceMethod java/util/List.size:()I
     250: iconst_1
     251: if_icmpne     288
     254: aload         16
     256: invokevirtual #198                // Method kickstart2022/g/Flower.getX:()I
     259: iload_2
     260: imul
     261: iload_0
     262: iload_2
     263: imul
     264: if_icmpgt     288
     267: aload         16
     269: invokevirtual #201                // Method kickstart2022/g/Flower.getC:()I
     272: iload         4
     274: if_icmple     288
     277: aload         16
     279: invokevirtual #201                // Method kickstart2022/g/Flower.getC:()I
     282: iload         4
     284: isub
     285: goto          727
     288: aload         5
     290: invokeinterface #195,  1          // InterfaceMethod java/util/List.size:()I
     295: iconst_1
     296: if_icmple     500
     299: aload         16
     301: invokevirtual #198                // Method kickstart2022/g/Flower.getX:()I
     304: iload_2
     305: imul
     306: iload_0
     307: iload_2
     308: imul
     309: if_icmplt     500
     312: aload         16
     314: invokevirtual #201                // Method kickstart2022/g/Flower.getC:()I
     317: aload         16
     319: invokevirtual #198                // Method kickstart2022/g/Flower.getX:()I
     322: aload         16
     324: invokevirtual #189                // Method kickstart2022/g/Flower.getY:()I
     327: iload_2
     328: aload         5
     330: checkcast     #59                 // class java/lang/Iterable
     333: astore        19
     335: istore        20
     337: istore        21
     339: istore        22
     341: istore        23
     343: iconst_0
     344: istore        24
     346: aload         19
     348: astore        25
     350: new           #61                 // class java/util/ArrayList
     353: dup
     354: invokespecial #186                // Method java/util/ArrayList."<init>":()V
     357: checkcast     #72                 // class java/util/Collection
     360: astore        26
     362: iconst_0
     363: istore        27
     365: aload         25
     367: astore        28
     369: iconst_0
     370: istore        29
     372: iconst_0
     373: istore        30
     375: aload         28
     377: invokeinterface #76,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     382: astore        31
     384: aload         31
     386: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     391: ifeq          472
     394: aload         31
     396: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     401: astore        32
     403: iload         30
     405: iinc          30, 1
     408: istore        33
     410: iload         33
     412: ifge          418
     415: invokestatic  #192                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     418: iload         33
     420: aload         32
     422: astore        34
     424: istore        35
     426: iconst_0
     427: istore        36
     429: iload         35
     431: aload         34
     433: checkcast     #109                // class kickstart2022/g/Flower
     436: pop
     437: istore        37
     439: iconst_0
     440: istore        38
     442: iload         17
     444: iload         37
     446: if_icmpeq     453
     449: iconst_1
     450: goto          454
     453: iconst_0
     454: ifeq          467
     457: aload         26
     459: aload         34
     461: invokeinterface #95,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     466: pop
     467: nop
     468: nop
     469: goto          384
     472: nop
     473: aload         26
     475: checkcast     #97                 // class java/util/List
     478: nop
     479: astore        39
     481: iload         23
     483: iload         22
     485: iload         21
     487: iload         20
     489: aload         39
     491: iload         4
     493: invokestatic  #122                // Method findBestWay:(IIILjava/util/List;I)I
     496: iadd
     497: goto          727
     500: aload         5
     502: invokeinterface #195,  1          // InterfaceMethod java/util/List.size:()I
     507: iconst_1
     508: if_icmple     726
     511: aload         16
     513: invokevirtual #198                // Method kickstart2022/g/Flower.getX:()I
     516: iload_2
     517: imul
     518: iload_0
     519: iload_2
     520: imul
     521: if_icmpgt     726
     524: aload         16
     526: invokevirtual #201                // Method kickstart2022/g/Flower.getC:()I
     529: iload         4
     531: if_icmple     726
     534: aload         16
     536: invokevirtual #201                // Method kickstart2022/g/Flower.getC:()I
     539: iload         4
     541: isub
     542: aload         16
     544: invokevirtual #198                // Method kickstart2022/g/Flower.getX:()I
     547: aload         16
     549: invokevirtual #189                // Method kickstart2022/g/Flower.getY:()I
     552: iload_2
     553: ineg
     554: aload         5
     556: checkcast     #59                 // class java/lang/Iterable
     559: astore        19
     561: istore        20
     563: istore        21
     565: istore        22
     567: istore        23
     569: iconst_0
     570: istore        24
     572: aload         19
     574: astore        25
     576: new           #61                 // class java/util/ArrayList
     579: dup
     580: invokespecial #186                // Method java/util/ArrayList."<init>":()V
     583: checkcast     #72                 // class java/util/Collection
     586: astore        26
     588: iconst_0
     589: istore        27
     591: aload         25
     593: astore        28
     595: iconst_0
     596: istore        29
     598: iconst_0
     599: istore        30
     601: aload         28
     603: invokeinterface #76,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     608: astore        31
     610: aload         31
     612: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     617: ifeq          698
     620: aload         31
     622: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     627: astore        32
     629: iload         30
     631: iinc          30, 1
     634: istore        33
     636: iload         33
     638: ifge          644
     641: invokestatic  #192                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     644: iload         33
     646: aload         32
     648: astore        34
     650: istore        35
     652: iconst_0
     653: istore        36
     655: iload         35
     657: aload         34
     659: checkcast     #109                // class kickstart2022/g/Flower
     662: pop
     663: istore        37
     665: iconst_0
     666: istore        38
     668: iload         17
     670: iload         37
     672: if_icmpeq     679
     675: iconst_1
     676: goto          680
     679: iconst_0
     680: ifeq          693
     683: aload         26
     685: aload         34
     687: invokeinterface #95,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     692: pop
     693: nop
     694: nop
     695: goto          610
     698: nop
     699: aload         26
     701: checkcast     #97                 // class java/util/List
     704: nop
     705: astore        39
     707: iload         23
     709: iload         22
     711: iload         21
     713: iload         20
     715: aload         39
     717: iload         4
     719: invokestatic  #122                // Method findBestWay:(IIILjava/util/List;I)I
     722: iadd
     723: goto          727
     726: iconst_0
     727: nop
     728: invokestatic  #91                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     731: aload         40
     733: swap
     734: invokeinterface #95,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     739: pop
     740: goto          158
     743: aload         10
     745: checkcast     #97                 // class java/util/List
     748: nop
     749: checkcast     #59                 // class java/lang/Iterable
     752: invokestatic  #205                // Method kotlin/collections/CollectionsKt.maxOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     755: checkcast     #45                 // class java/lang/Integer
     758: dup
     759: ifnull        768
     762: invokevirtual #206                // Method java/lang/Integer.intValue:()I
     765: goto          770
     768: pop
     769: iconst_0
     770: ireturn

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


package kickstart2022.c

// TODO test set 2
fun main() {
    val inputFileName = "src/kickstart2022/c/AntsOnStick.in"
    java.io.File(inputFileName).takeIf { it.exists() }?.also { System.setIn(it.inputStream()) }

    for (case in 1..readLine()!!.toInt()) {
        val (n, len) = readLine()!!.split(' ').map { it.toInt() }

        val ants = Array(n) {
            val (p, d) = readLine()!!.split(' ').map { it.toInt() }
            Ant(it + 1, p, if (d == 1) Direction.RIGHT else Direction.LEFT)
        }
            .sortedBy { it.pos }
            .toMutableList()

        var time = 0L
        val drops = mutableListOf<Drop>()

        while (ants.size > 0) {
            while (ants.size > 0 && ants[0].dir == Direction.LEFT) {
                drops.add(Drop(ants[0].num, time + ants[0].pos))
                ants.removeAt(0)
            }

            while (ants.size > 0 && ants.last().dir == Direction.RIGHT) {
                drops.add(Drop(ants.last().num, time + len - ants.last().pos))
                ants.removeLast()
            }

            var minLen = Int.MAX_VALUE

            for (i in 0 until ants.size - 1) {
                if (ants[i].dir == Direction.RIGHT
                    && ants[i + 1].dir == Direction.LEFT
                    && ants[i + 1].pos - ants[i].pos < minLen
                ) {
                    minLen = ants[i + 1].pos - ants[i].pos
                }
            }

            if (minLen < Int.MAX_VALUE) {
                val move = (minLen + 1) / 2

                for (k in ants.indices) {
                    ants[k].pos += if (ants[k].dir == Direction.RIGHT) move else -move
                }

                for (k in 0 until ants.size - 1) {
                    if (ants[k].pos > ants[k + 1].pos
                        && ants[k].dir == Direction.RIGHT
                        && ants[k + 1].dir == Direction.LEFT
                    ) {
                        ants[k].pos--
                        ants[k].dir = Direction.LEFT
                        ants[k + 1].pos++
                        ants[k + 1].dir = Direction.RIGHT
                    }
                }

                for (k in 0 until ants.size - 1) {
                    if (ants[k].pos == ants[k + 1].pos
                        && ants[k].dir == Direction.RIGHT
                        && ants[k + 1].dir == Direction.LEFT
                    ) {
                        ants[k].dir = Direction.LEFT
                        ants[k + 1].dir = Direction.RIGHT
                    }
                }

                time += move
            }
        }

        val res = drops.sortedWith(compareBy(Drop::time, Drop::num))
            .map { it.num }
            .joinToString(" ")

        println("Case #$case: $res")
    }
}

enum class Direction {
    LEFT,
    RIGHT
}

data class Ant(var num: Int, var pos: Int, var dir: Direction)

data class Drop(val num: Int, val time: Long)

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

  public final int compare(T, T);
    Code:
       0: aload_1
       1: checkcast     #23                 // class kickstart2022/c/Ant
       4: astore_3
       5: iconst_0
       6: istore        4
       8: aload_3
       9: invokevirtual #27                 // Method kickstart2022/c/Ant.getPos:()I
      12: invokestatic  #33                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      15: checkcast     #35                 // class java/lang/Comparable
      18: aload_2
      19: checkcast     #23                 // class kickstart2022/c/Ant
      22: astore_3
      23: astore        5
      25: iconst_0
      26: istore        4
      28: aload_3
      29: invokevirtual #27                 // Method kickstart2022/c/Ant.getPos:()I
      32: invokestatic  #33                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      35: aload         5
      37: swap
      38: checkcast     #35                 // class java/lang/Comparable
      41: invokestatic  #41                 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I
      44: ireturn
}

Compiled from "AntsOnStick.kt"
final class kickstart2022.c.AntsOnStickKt$main$res$1 extends kotlin.jvm.internal.PropertyReference1Impl {
  public static final kickstart2022.c.AntsOnStickKt$main$res$1 INSTANCE;

  kickstart2022.c.AntsOnStickKt$main$res$1();
    Code:
       0: aload_0
       1: ldc           #8                  // class kickstart2022/c/Drop
       3: ldc           #10                 // String time
       5: ldc           #12                 // String getTime()J
       7: iconst_0
       8: invokespecial #15                 // Method kotlin/jvm/internal/PropertyReference1Impl."<init>":(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      11: return

  public java.lang.Object get(java.lang.Object);
    Code:
       0: aload_1
       1: checkcast     #8                  // class kickstart2022/c/Drop
       4: invokevirtual #23                 // Method kickstart2022/c/Drop.getTime:()J
       7: invokestatic  #29                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      10: areturn

  static {};
    Code:
       0: new           #2                  // class kickstart2022/c/AntsOnStickKt$main$res$1
       3: dup
       4: invokespecial #34                 // Method "<init>":()V
       7: putstatic     #37                 // Field INSTANCE:Lkickstart2022/c/AntsOnStickKt$main$res$1;
      10: return
}

Compiled from "AntsOnStick.kt"
final class kickstart2022.c.AntsOnStickKt$main$res$2 extends kotlin.jvm.internal.PropertyReference1Impl {
  public static final kickstart2022.c.AntsOnStickKt$main$res$2 INSTANCE;

  kickstart2022.c.AntsOnStickKt$main$res$2();
    Code:
       0: aload_0
       1: ldc           #8                  // class kickstart2022/c/Drop
       3: ldc           #10                 // String num
       5: ldc           #12                 // String getNum()I
       7: iconst_0
       8: invokespecial #15                 // Method kotlin/jvm/internal/PropertyReference1Impl."<init>":(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      11: return

  public java.lang.Object get(java.lang.Object);
    Code:
       0: aload_1
       1: checkcast     #8                  // class kickstart2022/c/Drop
       4: invokevirtual #23                 // Method kickstart2022/c/Drop.getNum:()I
       7: invokestatic  #29                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      10: areturn

  static {};
    Code:
       0: new           #2                  // class kickstart2022/c/AntsOnStickKt$main$res$2
       3: dup
       4: invokespecial #34                 // Method "<init>":()V
       7: putstatic     #37                 // Field INSTANCE:Lkickstart2022/c/AntsOnStickKt$main$res$2;
      10: return
}

Compiled from "AntsOnStick.kt"
public final class kickstart2022.c.AntsOnStickKt {
  public static final void main();
    Code:
       0: ldc           #8                  // String src/kickstart2022/c/AntsOnStick.in
       2: astore_0
       3: new           #10                 // class java/io/File
       6: dup
       7: aload_0
       8: invokespecial #14                 // Method java/io/File."<init>":(Ljava/lang/String;)V
      11: astore_2
      12: aload_2
      13: astore_3
      14: iconst_0
      15: istore        4
      17: aload_3
      18: invokevirtual #18                 // Method java/io/File.exists:()Z
      21: ifeq          28
      24: aload_2
      25: goto          29
      28: aconst_null
      29: dup
      30: ifnull        56
      33: astore_2
      34: aload_2
      35: astore_3
      36: iconst_0
      37: istore        4
      39: new           #20                 // class java/io/FileInputStream
      42: dup
      43: aload_3
      44: invokespecial #23                 // Method java/io/FileInputStream."<init>":(Ljava/io/File;)V
      47: checkcast     #25                 // class java/io/InputStream
      50: invokestatic  #31                 // Method java/lang/System.setIn:(Ljava/io/InputStream;)V
      53: goto          58
      56: pop
      57: nop
      58: iconst_1
      59: istore_1
      60: invokestatic  #37                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
      63: dup
      64: invokestatic  #43                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      67: invokestatic  #49                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      70: istore_2
      71: iload_1
      72: iload_2
      73: if_icmpgt     1519
      76: invokestatic  #37                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
      79: dup
      80: invokestatic  #43                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      83: checkcast     #51                 // class java/lang/CharSequence
      86: iconst_1
      87: newarray       char
      89: astore        4
      91: aload         4
      93: iconst_0
      94: bipush        32
      96: castore
      97: aload         4
      99: iconst_0
     100: iconst_0
     101: bipush        6
     103: aconst_null
     104: invokestatic  #57                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[CZIILjava/lang/Object;)Ljava/util/List;
     107: checkcast     #59                 // class java/lang/Iterable
     110: astore        4
     112: iconst_0
     113: istore        5
     115: aload         4
     117: astore        6
     119: new           #61                 // class java/util/ArrayList
     122: dup
     123: aload         4
     125: bipush        10
     127: invokestatic  #67                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     130: invokespecial #70                 // Method java/util/ArrayList."<init>":(I)V
     133: checkcast     #72                 // class java/util/Collection
     136: astore        7
     138: iconst_0
     139: istore        8
     141: aload         6
     143: invokeinterface #76,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     148: astore        9
     150: aload         9
     152: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     157: ifeq          204
     160: aload         9
     162: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     167: astore        10
     169: aload         7
     171: aload         10
     173: checkcast     #87                 // class java/lang/String
     176: astore        11
     178: astore        20
     180: iconst_0
     181: istore        12
     183: aload         11
     185: invokestatic  #49                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     188: nop
     189: invokestatic  #91                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     192: aload         20
     194: swap
     195: invokeinterface #95,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     200: pop
     201: goto          150
     204: aload         7
     206: checkcast     #97                 // class java/util/List
     209: nop
     210: astore_3
     211: aload_3
     212: iconst_0
     213: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     218: checkcast     #103                // class java/lang/Number
     221: invokevirtual #107                // Method java/lang/Number.intValue:()I
     224: istore        4
     226: aload_3
     227: iconst_1
     228: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     233: checkcast     #103                // class java/lang/Number
     236: invokevirtual #107                // Method java/lang/Number.intValue:()I
     239: istore        5
     241: iconst_0
     242: istore        7
     244: iload         4
     246: anewarray     #109                // class kickstart2022/c/Ant
     249: astore        8
     251: iload         7
     253: iload         4
     255: if_icmpge     481
     258: iload         7
     260: istore        9
     262: aload         8
     264: iload         9
     266: invokestatic  #37                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
     269: dup
     270: invokestatic  #43                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     273: checkcast     #51                 // class java/lang/CharSequence
     276: iconst_1
     277: newarray       char
     279: astore        11
     281: aload         11
     283: iconst_0
     284: bipush        32
     286: castore
     287: aload         11
     289: iconst_0
     290: iconst_0
     291: bipush        6
     293: aconst_null
     294: invokestatic  #57                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[CZIILjava/lang/Object;)Ljava/util/List;
     297: checkcast     #59                 // class java/lang/Iterable
     300: astore        11
     302: istore        21
     304: astore        20
     306: iconst_0
     307: istore        12
     309: aload         11
     311: astore        13
     313: new           #61                 // class java/util/ArrayList
     316: dup
     317: aload         11
     319: bipush        10
     321: invokestatic  #67                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     324: invokespecial #70                 // Method java/util/ArrayList."<init>":(I)V
     327: checkcast     #72                 // class java/util/Collection
     330: astore        14
     332: iconst_0
     333: istore        15
     335: aload         13
     337: invokeinterface #76,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     342: astore        16
     344: aload         16
     346: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     351: ifeq          398
     354: aload         16
     356: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     361: astore        17
     363: aload         14
     365: aload         17
     367: checkcast     #87                 // class java/lang/String
     370: astore        18
     372: astore        22
     374: iconst_0
     375: istore        19
     377: aload         18
     379: invokestatic  #49                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     382: nop
     383: invokestatic  #91                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     386: aload         22
     388: swap
     389: invokeinterface #95,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     394: pop
     395: goto          344
     398: aload         14
     400: checkcast     #97                 // class java/util/List
     403: nop
     404: astore        22
     406: aload         20
     408: iload         21
     410: aload         22
     412: astore        10
     414: aload         10
     416: iconst_0
     417: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     422: checkcast     #103                // class java/lang/Number
     425: invokevirtual #107                // Method java/lang/Number.intValue:()I
     428: istore        11
     430: aload         10
     432: iconst_1
     433: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     438: checkcast     #103                // class java/lang/Number
     441: invokevirtual #107                // Method java/lang/Number.intValue:()I
     444: istore        12
     446: new           #109                // class kickstart2022/c/Ant
     449: dup
     450: iload         9
     452: iconst_1
     453: iadd
     454: iload         11
     456: iload         12
     458: iconst_1
     459: if_icmpne     468
     462: getstatic     #115                // Field kickstart2022/c/Direction.RIGHT:Lkickstart2022/c/Direction;
     465: goto          471
     468: getstatic     #118                // Field kickstart2022/c/Direction.LEFT:Lkickstart2022/c/Direction;
     471: invokespecial #121                // Method kickstart2022/c/Ant."<init>":(IILkickstart2022/c/Direction;)V
     474: aastore
     475: iinc          7, 1
     478: goto          251
     481: aload         8
     483: astore        7
     485: nop
     486: iconst_0
     487: istore        8
     489: aload         7
     491: new           #123                // class kickstart2022/c/AntsOnStickKt$main$$inlined$sortedBy$1
     494: dup
     495: invokespecial #125                // Method kickstart2022/c/AntsOnStickKt$main$$inlined$sortedBy$1."<init>":()V
     498: checkcast     #127                // class java/util/Comparator
     501: invokestatic  #133                // Method kotlin/collections/ArraysKt.sortedWith:([Ljava/lang/Object;Ljava/util/Comparator;)Ljava/util/List;
     504: checkcast     #72                 // class java/util/Collection
     507: invokestatic  #137                // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;
     510: astore        6
     512: lconst_0
     513: lstore        7
     515: new           #61                 // class java/util/ArrayList
     518: dup
     519: invokespecial #138                // Method java/util/ArrayList."<init>":()V
     522: checkcast     #97                 // class java/util/List
     525: astore        9
     527: aload         6
     529: invokeinterface #141,  1          // InterfaceMethod java/util/List.size:()I
     534: ifle          1315
     537: aload         6
     539: invokeinterface #141,  1          // InterfaceMethod java/util/List.size:()I
     544: ifle          626
     547: aload         6
     549: iconst_0
     550: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     555: checkcast     #109                // class kickstart2022/c/Ant
     558: invokevirtual #145                // Method kickstart2022/c/Ant.getDir:()Lkickstart2022/c/Direction;
     561: getstatic     #118                // Field kickstart2022/c/Direction.LEFT:Lkickstart2022/c/Direction;
     564: if_acmpne     626
     567: aload         9
     569: new           #147                // class kickstart2022/c/Drop
     572: dup
     573: aload         6
     575: iconst_0
     576: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     581: checkcast     #109                // class kickstart2022/c/Ant
     584: invokevirtual #150                // Method kickstart2022/c/Ant.getNum:()I
     587: lload         7
     589: aload         6
     591: iconst_0
     592: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     597: checkcast     #109                // class kickstart2022/c/Ant
     600: invokevirtual #153                // Method kickstart2022/c/Ant.getPos:()I
     603: i2l
     604: ladd
     605: invokespecial #156                // Method kickstart2022/c/Drop."<init>":(IJ)V
     608: invokeinterface #157,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     613: pop
     614: aload         6
     616: iconst_0
     617: invokeinterface #160,  2          // InterfaceMethod java/util/List.remove:(I)Ljava/lang/Object;
     622: pop
     623: goto          537
     626: aload         6
     628: invokeinterface #141,  1          // InterfaceMethod java/util/List.size:()I
     633: ifle          709
     636: aload         6
     638: invokestatic  #164                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     641: checkcast     #109                // class kickstart2022/c/Ant
     644: invokevirtual #145                // Method kickstart2022/c/Ant.getDir:()Lkickstart2022/c/Direction;
     647: getstatic     #115                // Field kickstart2022/c/Direction.RIGHT:Lkickstart2022/c/Direction;
     650: if_acmpne     709
     653: aload         9
     655: new           #147                // class kickstart2022/c/Drop
     658: dup
     659: aload         6
     661: invokestatic  #164                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     664: checkcast     #109                // class kickstart2022/c/Ant
     667: invokevirtual #150                // Method kickstart2022/c/Ant.getNum:()I
     670: lload         7
     672: iload         5
     674: i2l
     675: ladd
     676: aload         6
     678: invokestatic  #164                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     681: checkcast     #109                // class kickstart2022/c/Ant
     684: invokevirtual #153                // Method kickstart2022/c/Ant.getPos:()I
     687: i2l
     688: lsub
     689: invokespecial #156                // Method kickstart2022/c/Drop."<init>":(IJ)V
     692: invokeinterface #157,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     697: pop
     698: aload         6
     700: invokeinterface #167,  1          // InterfaceMethod java/util/List.removeLast:()Ljava/lang/Object;
     705: pop
     706: goto          626
     709: ldc           #168                // int 2147483647
     711: istore        10
     713: iconst_0
     714: istore        11
     716: aload         6
     718: invokeinterface #141,  1          // InterfaceMethod java/util/List.size:()I
     723: iconst_1
     724: isub
     725: istore        12
     727: iload         11
     729: iload         12
     731: if_icmpge     857
     734: aload         6
     736: iload         11
     738: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     743: checkcast     #109                // class kickstart2022/c/Ant
     746: invokevirtual #145                // Method kickstart2022/c/Ant.getDir:()Lkickstart2022/c/Direction;
     749: getstatic     #115                // Field kickstart2022/c/Direction.RIGHT:Lkickstart2022/c/Direction;
     752: if_acmpne     851
     755: aload         6
     757: iload         11
     759: iconst_1
     760: iadd
     761: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     766: checkcast     #109                // class kickstart2022/c/Ant
     769: invokevirtual #145                // Method kickstart2022/c/Ant.getDir:()Lkickstart2022/c/Direction;
     772: getstatic     #118                // Field kickstart2022/c/Direction.LEFT:Lkickstart2022/c/Direction;
     775: if_acmpne     851
     778: aload         6
     780: iload         11
     782: iconst_1
     783: iadd
     784: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     789: checkcast     #109                // class kickstart2022/c/Ant
     792: invokevirtual #153                // Method kickstart2022/c/Ant.getPos:()I
     795: aload         6
     797: iload         11
     799: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     804: checkcast     #109                // class kickstart2022/c/Ant
     807: invokevirtual #153                // Method kickstart2022/c/Ant.getPos:()I
     810: isub
     811: iload         10
     813: if_icmpge     851
     816: aload         6
     818: iload         11
     820: iconst_1
     821: iadd
     822: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     827: checkcast     #109                // class kickstart2022/c/Ant
     830: invokevirtual #153                // Method kickstart2022/c/Ant.getPos:()I
     833: aload         6
     835: iload         11
     837: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     842: checkcast     #109                // class kickstart2022/c/Ant
     845: invokevirtual #153                // Method kickstart2022/c/Ant.getPos:()I
     848: isub
     849: istore        10
     851: iinc          11, 1
     854: goto          727
     857: iload         10
     859: ldc           #168                // int 2147483647
     861: if_icmpge     527
     864: iload         10
     866: iconst_1
     867: iadd
     868: iconst_2
     869: idiv
     870: istore        11
     872: iconst_0
     873: istore        12
     875: aload         6
     877: checkcast     #72                 // class java/util/Collection
     880: invokeinterface #169,  1          // InterfaceMethod java/util/Collection.size:()I
     885: istore        13
     887: iload         12
     889: iload         13
     891: if_icmpge     954
     894: aload         6
     896: iload         12
     898: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     903: checkcast     #109                // class kickstart2022/c/Ant
     906: astore        14
     908: aload         14
     910: aload         14
     912: invokevirtual #153                // Method kickstart2022/c/Ant.getPos:()I
     915: aload         6
     917: iload         12
     919: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     924: checkcast     #109                // class kickstart2022/c/Ant
     927: invokevirtual #145                // Method kickstart2022/c/Ant.getDir:()Lkickstart2022/c/Direction;
     930: getstatic     #115                // Field kickstart2022/c/Direction.RIGHT:Lkickstart2022/c/Direction;
     933: if_acmpne     941
     936: iload         11
     938: goto          944
     941: iload         11
     943: ineg
     944: iadd
     945: invokevirtual #172                // Method kickstart2022/c/Ant.setPos:(I)V
     948: iinc          12, 1
     951: goto          887
     954: iconst_0
     955: istore        12
     957: aload         6
     959: invokeinterface #141,  1          // InterfaceMethod java/util/List.size:()I
     964: iconst_1
     965: isub
     966: istore        13
     968: iload         12
     970: iload         13
     972: if_icmpge     1160
     975: aload         6
     977: iload         12
     979: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     984: checkcast     #109                // class kickstart2022/c/Ant
     987: invokevirtual #153                // Method kickstart2022/c/Ant.getPos:()I
     990: aload         6
     992: iload         12
     994: iconst_1
     995: iadd
     996: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1001: checkcast     #109                // class kickstart2022/c/Ant
    1004: invokevirtual #153                // Method kickstart2022/c/Ant.getPos:()I
    1007: if_icmple     1154
    1010: aload         6
    1012: iload         12
    1014: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1019: checkcast     #109                // class kickstart2022/c/Ant
    1022: invokevirtual #145                // Method kickstart2022/c/Ant.getDir:()Lkickstart2022/c/Direction;
    1025: getstatic     #115                // Field kickstart2022/c/Direction.RIGHT:Lkickstart2022/c/Direction;
    1028: if_acmpne     1154
    1031: aload         6
    1033: iload         12
    1035: iconst_1
    1036: iadd
    1037: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1042: checkcast     #109                // class kickstart2022/c/Ant
    1045: invokevirtual #145                // Method kickstart2022/c/Ant.getDir:()Lkickstart2022/c/Direction;
    1048: getstatic     #118                // Field kickstart2022/c/Direction.LEFT:Lkickstart2022/c/Direction;
    1051: if_acmpne     1154
    1054: aload         6
    1056: iload         12
    1058: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1063: checkcast     #109                // class kickstart2022/c/Ant
    1066: astore        14
    1068: aload         14
    1070: invokevirtual #153                // Method kickstart2022/c/Ant.getPos:()I
    1073: istore        15
    1075: aload         14
    1077: iload         15
    1079: iconst_m1
    1080: iadd
    1081: invokevirtual #172                // Method kickstart2022/c/Ant.setPos:(I)V
    1084: aload         6
    1086: iload         12
    1088: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1093: checkcast     #109                // class kickstart2022/c/Ant
    1096: getstatic     #118                // Field kickstart2022/c/Direction.LEFT:Lkickstart2022/c/Direction;
    1099: invokevirtual #176                // Method kickstart2022/c/Ant.setDir:(Lkickstart2022/c/Direction;)V
    1102: aload         6
    1104: iload         12
    1106: iconst_1
    1107: iadd
    1108: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1113: checkcast     #109                // class kickstart2022/c/Ant
    1116: astore        14
    1118: aload         14
    1120: invokevirtual #153                // Method kickstart2022/c/Ant.getPos:()I
    1123: istore        15
    1125: aload         14
    1127: iload         15
    1129: iconst_1
    1130: iadd
    1131: invokevirtual #172                // Method kickstart2022/c/Ant.setPos:(I)V
    1134: aload         6
    1136: iload         12
    1138: iconst_1
    1139: iadd
    1140: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1145: checkcast     #109                // class kickstart2022/c/Ant
    1148: getstatic     #115                // Field kickstart2022/c/Direction.RIGHT:Lkickstart2022/c/Direction;
    1151: invokevirtual #176                // Method kickstart2022/c/Ant.setDir:(Lkickstart2022/c/Direction;)V
    1154: iinc          12, 1
    1157: goto          968
    1160: iconst_0
    1161: istore        12
    1163: aload         6
    1165: invokeinterface #141,  1          // InterfaceMethod java/util/List.size:()I
    1170: iconst_1
    1171: isub
    1172: istore        13
    1174: iload         12
    1176: iload         13
    1178: if_icmpge     1304
    1181: aload         6
    1183: iload         12
    1185: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1190: checkcast     #109                // class kickstart2022/c/Ant
    1193: invokevirtual #153                // Method kickstart2022/c/Ant.getPos:()I
    1196: aload         6
    1198: iload         12
    1200: iconst_1
    1201: iadd
    1202: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1207: checkcast     #109                // class kickstart2022/c/Ant
    1210: invokevirtual #153                // Method kickstart2022/c/Ant.getPos:()I
    1213: if_icmpne     1298
    1216: aload         6
    1218: iload         12
    1220: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1225: checkcast     #109                // class kickstart2022/c/Ant
    1228: invokevirtual #145                // Method kickstart2022/c/Ant.getDir:()Lkickstart2022/c/Direction;
    1231: getstatic     #115                // Field kickstart2022/c/Direction.RIGHT:Lkickstart2022/c/Direction;
    1234: if_acmpne     1298
    1237: aload         6
    1239: iload         12
    1241: iconst_1
    1242: iadd
    1243: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1248: checkcast     #109                // class kickstart2022/c/Ant
    1251: invokevirtual #145                // Method kickstart2022/c/Ant.getDir:()Lkickstart2022/c/Direction;
    1254: getstatic     #118                // Field kickstart2022/c/Direction.LEFT:Lkickstart2022/c/Direction;
    1257: if_acmpne     1298
    1260: aload         6
    1262: iload         12
    1264: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1269: checkcast     #109                // class kickstart2022/c/Ant
    1272: getstatic     #118                // Field kickstart2022/c/Direction.LEFT:Lkickstart2022/c/Direction;
    1275: invokevirtual #176                // Method kickstart2022/c/Ant.setDir:(Lkickstart2022/c/Direction;)V
    1278: aload         6
    1280: iload         12
    1282: iconst_1
    1283: iadd
    1284: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1289: checkcast     #109                // class kickstart2022/c/Ant
    1292: getstatic     #115                // Field kickstart2022/c/Direction.RIGHT:Lkickstart2022/c/Direction;
    1295: invokevirtual #176                // Method kickstart2022/c/Ant.setDir:(Lkickstart2022/c/Direction;)V
    1298: iinc          12, 1
    1301: goto          1174
    1304: lload         7
    1306: iload         11
    1308: i2l
    1309: ladd
    1310: lstore        7
    1312: goto          527
    1315: aload         9
    1317: checkcast     #59                 // class java/lang/Iterable
    1320: iconst_2
    1321: anewarray     #178                // class kotlin/jvm/functions/Function1
    1324: astore        11
    1326: aload         11
    1328: iconst_0
    1329: getstatic     #184                // Field kickstart2022/c/AntsOnStickKt$main$res$1.INSTANCE:Lkickstart2022/c/AntsOnStickKt$main$res$1;
    1332: aastore
    1333: aload         11
    1335: iconst_1
    1336: getstatic     #189                // Field kickstart2022/c/AntsOnStickKt$main$res$2.INSTANCE:Lkickstart2022/c/AntsOnStickKt$main$res$2;
    1339: aastore
    1340: aload         11
    1342: invokestatic  #195                // Method kotlin/comparisons/ComparisonsKt.compareBy:([Lkotlin/jvm/functions/Function1;)Ljava/util/Comparator;
    1345: invokestatic  #198                // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
    1348: checkcast     #59                 // class java/lang/Iterable
    1351: astore        11
    1353: nop
    1354: iconst_0
    1355: istore        12
    1357: aload         11
    1359: astore        13
    1361: new           #61                 // class java/util/ArrayList
    1364: dup
    1365: aload         11
    1367: bipush        10
    1369: invokestatic  #67                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
    1372: invokespecial #70                 // Method java/util/ArrayList."<init>":(I)V
    1375: checkcast     #72                 // class java/util/Collection
    1378: astore        14
    1380: iconst_0
    1381: istore        15
    1383: aload         13
    1385: invokeinterface #76,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1390: astore        16
    1392: aload         16
    1394: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1399: ifeq          1445
    1402: aload         16
    1404: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1409: astore        17
    1411: aload         14
    1413: aload         17
    1415: checkcast     #147                // class kickstart2022/c/Drop
    1418: astore        18
    1420: astore        20
    1422: iconst_0
    1423: istore        19
    1425: aload         18
    1427: invokevirtual #199                // Method kickstart2022/c/Drop.getNum:()I
    1430: invokestatic  #91                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    1433: aload         20
    1435: swap
    1436: invokeinterface #95,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
    1441: pop
    1442: goto          1392
    1445: aload         14
    1447: checkcast     #97                 // class java/util/List
    1450: nop
    1451: checkcast     #59                 // class java/lang/Iterable
    1454: ldc           #201                // String
    1456: checkcast     #51                 // class java/lang/CharSequence
    1459: aconst_null
    1460: aconst_null
    1461: iconst_0
    1462: aconst_null
    1463: aconst_null
    1464: bipush        62
    1466: aconst_null
    1467: invokestatic  #205                // 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;
    1470: astore        10
    1472: new           #207                // class java/lang/StringBuilder
    1475: dup
    1476: invokespecial #208                // Method java/lang/StringBuilder."<init>":()V
    1479: ldc           #210                // String Case #
    1481: invokevirtual #214                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
    1484: iload_1
    1485: invokevirtual #217                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
    1488: ldc           #219                // String :
    1490: invokevirtual #214                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
    1493: aload         10
    1495: invokevirtual #214                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
    1498: invokevirtual #222                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
    1501: getstatic     #226                // Field java/lang/System.out:Ljava/io/PrintStream;
    1504: swap
    1505: invokevirtual #231                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    1508: iload_1
    1509: iload_2
    1510: if_icmpeq     1519
    1513: iinc          1, 1
    1516: goto          76
    1519: return

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


package kickstart2020.h

import kotlin.math.max

private val power5 = Array(20) { 1L }

fun main() {
    val inputFileName = "src/kickstart2020/h/BoringNumbers.in"
    java.io.File(inputFileName).takeIf { it.exists() }?.also { System.setIn(it.inputStream()) }

    for (i in 1 until power5.size) power5[i] = power5[i - 1] * 5

    for (case in 1..readLine()!!.toInt()) {
        val (l, r) = readLine()!!.split(' ').map { it.toLong() }
        val res = boring(r) - boring(l - 1)
        println("Case #$case: $res")
    }
}

private fun boring(k: Long): Long {
    val s = k.toString()
    return calculate(s) + (1 until s.length).map { power5[it] }.sum()
}

private fun calculate(s: String): Long {
    return when (s.length) {
        1 -> (s.toLong() + 1) / 2
        2 -> s.toLong() / 20 * 5 + if (s[0].toInt() % 2 > 0) (s.substring(1).toLong()) / 2 + 1 else 0
        else -> max(0, s.take(2).toInt() - 1).toString().let { if (it.length == 2) calculate(it) * power5[s.length - 2] else 0 } +
            if (s[0].toInt() % 2 > 0 && s[1].toInt() % 2 == 0) calculate(s.substring(2)) else 0
    }
}

Compiled from "BoringNumbers.kt"
public final class kickstart2020.h.BoringNumbersKt {
  private static final java.lang.Long[] power5;

  public static final void main();
    Code:
       0: ldc           #8                  // String src/kickstart2020/h/BoringNumbers.in
       2: astore_0
       3: new           #10                 // class java/io/File
       6: dup
       7: aload_0
       8: invokespecial #14                 // Method java/io/File."<init>":(Ljava/lang/String;)V
      11: astore_2
      12: aload_2
      13: astore_3
      14: iconst_0
      15: istore        4
      17: aload_3
      18: invokevirtual #18                 // Method java/io/File.exists:()Z
      21: ifeq          28
      24: aload_2
      25: goto          29
      28: aconst_null
      29: dup
      30: ifnull        56
      33: astore_2
      34: aload_2
      35: astore_3
      36: iconst_0
      37: istore        4
      39: new           #20                 // class java/io/FileInputStream
      42: dup
      43: aload_3
      44: invokespecial #23                 // Method java/io/FileInputStream."<init>":(Ljava/io/File;)V
      47: checkcast     #25                 // class java/io/InputStream
      50: invokestatic  #31                 // Method java/lang/System.setIn:(Ljava/io/InputStream;)V
      53: goto          58
      56: pop
      57: nop
      58: iconst_1
      59: istore_1
      60: getstatic     #35                 // Field power5:[Ljava/lang/Long;
      63: arraylength
      64: istore_2
      65: iload_1
      66: iload_2
      67: if_icmpge     97
      70: getstatic     #35                 // Field power5:[Ljava/lang/Long;
      73: iload_1
      74: getstatic     #35                 // Field power5:[Ljava/lang/Long;
      77: iload_1
      78: iconst_1
      79: isub
      80: aaload
      81: invokevirtual #41                 // Method java/lang/Long.longValue:()J
      84: iconst_5
      85: i2l
      86: lmul
      87: invokestatic  #45                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      90: aastore
      91: iinc          1, 1
      94: goto          65
      97: iconst_1
      98: istore_1
      99: invokestatic  #51                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
     102: dup
     103: invokestatic  #57                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     106: invokestatic  #63                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     109: istore_2
     110: iload_1
     111: iload_2
     112: if_icmpgt     342
     115: invokestatic  #51                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
     118: dup
     119: invokestatic  #57                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     122: checkcast     #65                 // class java/lang/CharSequence
     125: iconst_1
     126: newarray       char
     128: astore        4
     130: aload         4
     132: iconst_0
     133: bipush        32
     135: castore
     136: aload         4
     138: iconst_0
     139: iconst_0
     140: bipush        6
     142: aconst_null
     143: invokestatic  #71                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[CZIILjava/lang/Object;)Ljava/util/List;
     146: checkcast     #73                 // class java/lang/Iterable
     149: astore        4
     151: iconst_0
     152: istore        5
     154: aload         4
     156: astore        6
     158: new           #75                 // class java/util/ArrayList
     161: dup
     162: aload         4
     164: bipush        10
     166: invokestatic  #81                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     169: invokespecial #84                 // Method java/util/ArrayList."<init>":(I)V
     172: checkcast     #86                 // class java/util/Collection
     175: astore        7
     177: iconst_0
     178: istore        8
     180: aload         6
     182: invokeinterface #90,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     187: astore        9
     189: aload         9
     191: invokeinterface #95,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     196: ifeq          243
     199: aload         9
     201: invokeinterface #99,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     206: astore        10
     208: aload         7
     210: aload         10
     212: checkcast     #101                // class java/lang/String
     215: astore        11
     217: astore        13
     219: iconst_0
     220: istore        12
     222: aload         11
     224: invokestatic  #105                // Method java/lang/Long.parseLong:(Ljava/lang/String;)J
     227: nop
     228: invokestatic  #45                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     231: aload         13
     233: swap
     234: invokeinterface #109,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     239: pop
     240: goto          189
     243: aload         7
     245: checkcast     #111                // class java/util/List
     248: nop
     249: astore_3
     250: aload_3
     251: iconst_0
     252: invokeinterface #115,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     257: checkcast     #117                // class java/lang/Number
     260: invokevirtual #118                // Method java/lang/Number.longValue:()J
     263: lstore        4
     265: aload_3
     266: iconst_1
     267: invokeinterface #115,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     272: checkcast     #117                // class java/lang/Number
     275: invokevirtual #118                // Method java/lang/Number.longValue:()J
     278: lstore        6
     280: lload         6
     282: invokestatic  #122                // Method boring:(J)J
     285: lload         4
     287: lconst_1
     288: lsub
     289: invokestatic  #122                // Method boring:(J)J
     292: lsub
     293: lstore        8
     295: new           #124                // class java/lang/StringBuilder
     298: dup
     299: invokespecial #126                // Method java/lang/StringBuilder."<init>":()V
     302: ldc           #128                // String Case #
     304: invokevirtual #132                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     307: iload_1
     308: invokevirtual #135                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     311: ldc           #137                // String :
     313: invokevirtual #132                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     316: lload         8
     318: invokevirtual #140                // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;
     321: invokevirtual #143                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     324: getstatic     #147                // Field java/lang/System.out:Ljava/io/PrintStream;
     327: swap
     328: invokevirtual #152                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     331: iload_1
     332: iload_2
     333: if_icmpeq     342
     336: iinc          1, 1
     339: goto          115
     342: return

  private static final long boring(long);
    Code:
       0: lload_0
       1: invokestatic  #178                // Method java/lang/String.valueOf:(J)Ljava/lang/String;
       4: astore_2
       5: aload_2
       6: invokestatic  #181                // Method calculate:(Ljava/lang/String;)J
       9: iconst_1
      10: aload_2
      11: invokevirtual #185                // Method java/lang/String.length:()I
      14: invokestatic  #191                // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
      17: checkcast     #73                 // class java/lang/Iterable
      20: astore_3
      21: lstore        12
      23: iconst_0
      24: istore        4
      26: aload_3
      27: astore        5
      29: new           #75                 // class java/util/ArrayList
      32: dup
      33: aload_3
      34: bipush        10
      36: invokestatic  #81                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      39: invokespecial #84                 // Method java/util/ArrayList."<init>":(I)V
      42: checkcast     #86                 // class java/util/Collection
      45: astore        6
      47: iconst_0
      48: istore        7
      50: aload         5
      52: invokeinterface #90,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      57: astore        8
      59: aload         8
      61: invokeinterface #95,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      66: ifeq          114
      69: aload         8
      71: checkcast     #193                // class kotlin/collections/IntIterator
      74: invokevirtual #196                // Method kotlin/collections/IntIterator.nextInt:()I
      77: istore        9
      79: aload         6
      81: iload         9
      83: istore        10
      85: astore        14
      87: iconst_0
      88: istore        11
      90: getstatic     #35                 // Field power5:[Ljava/lang/Long;
      93: iload         10
      95: aaload
      96: invokevirtual #41                 // Method java/lang/Long.longValue:()J
      99: invokestatic  #45                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     102: aload         14
     104: swap
     105: invokeinterface #109,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     110: pop
     111: goto          59
     114: aload         6
     116: checkcast     #111                // class java/util/List
     119: nop
     120: astore        14
     122: lload         12
     124: aload         14
     126: checkcast     #73                 // class java/lang/Iterable
     129: invokestatic  #200                // Method kotlin/collections/CollectionsKt.sumOfLong:(Ljava/lang/Iterable;)J
     132: ladd
     133: lreturn

  private static final long calculate(java.lang.String);
    Code:
       0: aload_0
       1: invokevirtual #185                // Method java/lang/String.length:()I
       4: tableswitch   { // 1 to 2
                     1: 28
                     2: 40
               default: 88
          }
      28: aload_0
      29: invokestatic  #105                // Method java/lang/Long.parseLong:(Ljava/lang/String;)J
      32: lconst_1
      33: ladd
      34: iconst_2
      35: i2l
      36: ldiv
      37: goto          178
      40: aload_0
      41: invokestatic  #105                // Method java/lang/Long.parseLong:(Ljava/lang/String;)J
      44: bipush        20
      46: i2l
      47: ldiv
      48: iconst_5
      49: i2l
      50: lmul
      51: aload_0
      52: iconst_0
      53: invokevirtual #207                // Method java/lang/String.charAt:(I)C
      56: iconst_2
      57: irem
      58: ifle          83
      61: aload_0
      62: iconst_1
      63: invokevirtual #211                // Method java/lang/String.substring:(I)Ljava/lang/String;
      66: dup
      67: ldc           #213                // String substring(...)
      69: invokestatic  #217                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      72: invokestatic  #105                // Method java/lang/Long.parseLong:(Ljava/lang/String;)J
      75: iconst_2
      76: i2l
      77: ldiv
      78: lconst_1
      79: ladd
      80: goto          84
      83: lconst_0
      84: ladd
      85: goto          178
      88: iconst_0
      89: aload_0
      90: iconst_2
      91: invokestatic  #221                // Method kotlin/text/StringsKt.take:(Ljava/lang/String;I)Ljava/lang/String;
      94: invokestatic  #63                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      97: iconst_1
      98: isub
      99: invokestatic  #227                // Method java/lang/Math.max:(II)I
     102: invokestatic  #229                // Method java/lang/String.valueOf:(I)Ljava/lang/String;
     105: astore_1
     106: iconst_0
     107: istore_2
     108: aload_1
     109: invokevirtual #185                // Method java/lang/String.length:()I
     112: iconst_2
     113: if_icmpne     137
     116: aload_1
     117: invokestatic  #181                // Method calculate:(Ljava/lang/String;)J
     120: getstatic     #35                 // Field power5:[Ljava/lang/Long;
     123: aload_0
     124: invokevirtual #185                // Method java/lang/String.length:()I
     127: iconst_2
     128: isub
     129: aaload
     130: invokevirtual #41                 // Method java/lang/Long.longValue:()J
     133: lmul
     134: goto          138
     137: lconst_0
     138: nop
     139: aload_0
     140: iconst_0
     141: invokevirtual #207                // Method java/lang/String.charAt:(I)C
     144: iconst_2
     145: irem
     146: ifle          176
     149: aload_0
     150: iconst_1
     151: invokevirtual #207                // Method java/lang/String.charAt:(I)C
     154: iconst_2
     155: irem
     156: ifne          176
     159: aload_0
     160: iconst_2
     161: invokevirtual #211                // Method java/lang/String.substring:(I)Ljava/lang/String;
     164: dup
     165: ldc           #213                // String substring(...)
     167: invokestatic  #217                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     170: invokestatic  #181                // Method calculate:(Ljava/lang/String;)J
     173: goto          177
     176: lconst_0
     177: ladd
     178: lreturn

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

  static {};
    Code:
       0: iconst_0
       1: istore_0
       2: bipush        20
       4: anewarray     #37                 // class java/lang/Long
       7: astore_1
       8: iload_0
       9: bipush        20
      11: if_icmpge     29
      14: iload_0
      15: istore_2
      16: aload_1
      17: iload_2
      18: lconst_1
      19: invokestatic  #45                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      22: aastore
      23: iinc          0, 1
      26: goto          8
      29: aload_1
      30: putstatic     #35                 // Field power5:[Ljava/lang/Long;
      33: return
}