package gcj.y2020.round2

import kotlin.math.pow

fun solvePancakes(aIn: Long, bIn: Long): String {
	var a = aIn; var b = bIn
	var i = 1L
	val maxN = (a.toDouble() + b + 100).pow(0.5).toLong() * 2

	fun step(): String? {
		if (maxOf(a, b) < i) return "${i - 1} $a $b"
		if (a >= b) a -= i else b -= i
		i++
		return null
	}

	fun take(amount: Long) = (i - 1..maxN).binarySearch { j -> sum(i, j) >= amount } - 1

	val takeA = take(a - b)
	a -= sum(i, takeA)
	i = takeA + 1

	step()?.also { return it }

	val takeB = take(b - a)
	b -= sum(i, takeB)
	i = takeB + 1

	if (b > a) { step()?.also { return it } }

	val takeAB = (take(a + b) - i) / 2
	a -= (i + takeAB - 1) * takeAB
	b -= (i + takeAB) * takeAB
	i += 2 * takeAB

	while (true) { step()?.also { return it } }
}

private fun solve(): String {
	val (a, b) = readLongs()
	return solvePancakes(a, b)
}

private fun sum(start: Long, end: Long) = (start + end) * (end + 1 - start) / 2

fun main() = repeat(readInt()) { println("Case #${it + 1}: ${solve()}") }

private fun LongRange.binarySearch(predicate: (Long) -> Boolean): Long {
	var (low, high) = this.first to this.last // must be false .. must be true
	while (low + 1 < high) (low + (high - low) / 2).also { if (predicate(it)) high = it else low = it }
	return high // first true
}

private fun readLn() = readLine()!!
private fun readInt() = readLn().toInt()
private fun readStrings() = readLn().split(" ")
private fun readLongs() = readStrings().map { it.toLong() }

Compiled from "a.kt"
public final class gcj.y2020.round2.AKt {
  public static final java.lang.String solvePancakes(long, long);
    Code:
       0: new           #9                  // class kotlin/jvm/internal/Ref$LongRef
       3: dup
       4: invokespecial #13                 // Method kotlin/jvm/internal/Ref$LongRef."<init>":()V
       7: astore        4
       9: aload         4
      11: lload_0
      12: putfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
      15: new           #9                  // class kotlin/jvm/internal/Ref$LongRef
      18: dup
      19: invokespecial #13                 // Method kotlin/jvm/internal/Ref$LongRef."<init>":()V
      22: astore        5
      24: aload         5
      26: lload_2
      27: putfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
      30: new           #9                  // class kotlin/jvm/internal/Ref$LongRef
      33: dup
      34: invokespecial #13                 // Method kotlin/jvm/internal/Ref$LongRef."<init>":()V
      37: astore        6
      39: aload         6
      41: lconst_1
      42: putfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
      45: aload         4
      47: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
      50: l2d
      51: aload         5
      53: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
      56: l2d
      57: dadd
      58: bipush        100
      60: i2d
      61: dadd
      62: ldc2_w        #18                 // double 0.5d
      65: invokestatic  #25                 // Method java/lang/Math.pow:(DD)D
      68: d2l
      69: iconst_2
      70: i2l
      71: lmul
      72: lstore        7
      74: aload         6
      76: lload         7
      78: aload         4
      80: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
      83: aload         5
      85: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
      88: lsub
      89: invokestatic  #29                 // Method solvePancakes$take:(Lkotlin/jvm/internal/Ref$LongRef;JJ)J
      92: lstore        9
      94: aload         4
      96: aload         4
      98: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     101: aload         6
     103: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     106: lload         9
     108: invokestatic  #33                 // Method sum:(JJ)J
     111: lsub
     112: putfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     115: aload         6
     117: lload         9
     119: lconst_1
     120: ladd
     121: putfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     124: aload         4
     126: aload         5
     128: aload         6
     130: invokestatic  #37                 // Method solvePancakes$step:(Lkotlin/jvm/internal/Ref$LongRef;Lkotlin/jvm/internal/Ref$LongRef;Lkotlin/jvm/internal/Ref$LongRef;)Ljava/lang/String;
     133: astore        11
     135: aload         11
     137: ifnull        150
     140: aload         11
     142: astore        13
     144: iconst_0
     145: istore        14
     147: aload         13
     149: areturn
     150: nop
     151: aload         6
     153: lload         7
     155: aload         5
     157: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     160: aload         4
     162: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     165: lsub
     166: invokestatic  #29                 // Method solvePancakes$take:(Lkotlin/jvm/internal/Ref$LongRef;JJ)J
     169: lstore        11
     171: aload         5
     173: aload         5
     175: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     178: aload         6
     180: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     183: lload         11
     185: invokestatic  #33                 // Method sum:(JJ)J
     188: lsub
     189: putfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     192: aload         6
     194: lload         11
     196: lconst_1
     197: ladd
     198: putfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     201: aload         5
     203: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     206: aload         4
     208: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     211: lcmp
     212: ifle          242
     215: aload         4
     217: aload         5
     219: aload         6
     221: invokestatic  #37                 // Method solvePancakes$step:(Lkotlin/jvm/internal/Ref$LongRef;Lkotlin/jvm/internal/Ref$LongRef;Lkotlin/jvm/internal/Ref$LongRef;)Ljava/lang/String;
     224: astore        13
     226: aload         13
     228: ifnull        241
     231: aload         13
     233: astore        15
     235: iconst_0
     236: istore        16
     238: aload         15
     240: areturn
     241: nop
     242: aload         6
     244: lload         7
     246: aload         4
     248: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     251: aload         5
     253: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     256: ladd
     257: invokestatic  #29                 // Method solvePancakes$take:(Lkotlin/jvm/internal/Ref$LongRef;JJ)J
     260: aload         6
     262: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     265: lsub
     266: iconst_2
     267: i2l
     268: ldiv
     269: lstore        13
     271: aload         4
     273: aload         4
     275: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     278: aload         6
     280: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     283: lload         13
     285: ladd
     286: lconst_1
     287: lsub
     288: lload         13
     290: lmul
     291: lsub
     292: putfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     295: aload         5
     297: aload         5
     299: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     302: aload         6
     304: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     307: lload         13
     309: ladd
     310: lload         13
     312: lmul
     313: lsub
     314: putfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     317: aload         6
     319: aload         6
     321: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     324: iconst_2
     325: i2l
     326: lload         13
     328: lmul
     329: ladd
     330: putfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     333: aload         4
     335: aload         5
     337: aload         6
     339: invokestatic  #37                 // Method solvePancakes$step:(Lkotlin/jvm/internal/Ref$LongRef;Lkotlin/jvm/internal/Ref$LongRef;Lkotlin/jvm/internal/Ref$LongRef;)Ljava/lang/String;
     342: astore        15
     344: aload         15
     346: ifnull        359
     349: aload         15
     351: astore        17
     353: iconst_0
     354: istore        18
     356: aload         17
     358: areturn
     359: goto          333

  private static final java.lang.String solve();
    Code:
       0: invokestatic  #61                 // Method readLongs:()Ljava/util/List;
       3: astore_0
       4: aload_0
       5: iconst_0
       6: invokeinterface #67,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      11: checkcast     #69                 // class java/lang/Number
      14: invokevirtual #73                 // Method java/lang/Number.longValue:()J
      17: lstore_1
      18: aload_0
      19: iconst_1
      20: invokeinterface #67,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      25: checkcast     #69                 // class java/lang/Number
      28: invokevirtual #73                 // Method java/lang/Number.longValue:()J
      31: lstore_3
      32: lload_1
      33: lload_3
      34: invokestatic  #75                 // Method solvePancakes:(JJ)Ljava/lang/String;
      37: areturn

  private static final long sum(long, long);
    Code:
       0: lload_0
       1: lload_2
       2: ladd
       3: lload_2
       4: lconst_1
       5: ladd
       6: lload_0
       7: lsub
       8: lmul
       9: iconst_2
      10: i2l
      11: ldiv
      12: lreturn

  public static final void main();
    Code:
       0: invokestatic  #82                 // Method readInt:()I
       3: istore_0
       4: iconst_0
       5: istore_1
       6: iload_1
       7: iload_0
       8: if_icmpge     61
      11: iload_1
      12: istore_2
      13: iconst_0
      14: istore_3
      15: new           #84                 // class java/lang/StringBuilder
      18: dup
      19: invokespecial #85                 // Method java/lang/StringBuilder."<init>":()V
      22: ldc           #87                 // String Case #
      24: invokevirtual #91                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      27: iload_2
      28: iconst_1
      29: iadd
      30: invokevirtual #94                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      33: ldc           #96                 // String :
      35: invokevirtual #91                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      38: invokestatic  #98                 // Method solve:()Ljava/lang/String;
      41: invokevirtual #91                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      44: invokevirtual #101                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      47: getstatic     #107                // Field java/lang/System.out:Ljava/io/PrintStream;
      50: swap
      51: invokevirtual #113                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      54: nop
      55: iinc          1, 1
      58: goto          6
      61: return

  private static final long binarySearch(kotlin.ranges.LongRange, kotlin.jvm.functions.Function1<? super java.lang.Long, java.lang.Boolean>);
    Code:
       0: aload_0
       1: invokevirtual #122                // Method kotlin/ranges/LongRange.getFirst:()J
       4: invokestatic  #128                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
       7: aload_0
       8: invokevirtual #131                // Method kotlin/ranges/LongRange.getLast:()J
      11: invokestatic  #128                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      14: invokestatic  #137                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      17: astore_2
      18: lconst_0
      19: lstore        8
      21: aload_2
      22: invokevirtual #143                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      25: checkcast     #69                 // class java/lang/Number
      28: invokevirtual #73                 // Method java/lang/Number.longValue:()J
      31: lstore        8
      33: lconst_0
      34: lstore        10
      36: aload_2
      37: invokevirtual #146                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      40: checkcast     #69                 // class java/lang/Number
      43: invokevirtual #73                 // Method java/lang/Number.longValue:()J
      46: lstore        10
      48: lload         8
      50: lconst_1
      51: ladd
      52: lload         10
      54: lcmp
      55: ifge          112
      58: lload         8
      60: lload         10
      62: lload         8
      64: lsub
      65: iconst_2
      66: i2l
      67: ldiv
      68: ladd
      69: lstore_3
      70: lload_3
      71: lstore        5
      73: iconst_0
      74: istore        7
      76: aload_1
      77: lload         5
      79: invokestatic  #128                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      82: invokeinterface #152,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
      87: checkcast     #154                // class java/lang/Boolean
      90: invokevirtual #158                // Method java/lang/Boolean.booleanValue:()Z
      93: ifeq          103
      96: lload         5
      98: lstore        10
     100: goto          107
     103: lload         5
     105: lstore        8
     107: lload_3
     108: pop2
     109: goto          48
     112: lload         10
     114: lreturn

  private static final java.lang.String readLn();
    Code:
       0: invokestatic  #171                // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       3: dup
       4: invokestatic  #176                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       7: areturn

  private static final int readInt();
    Code:
       0: invokestatic  #178                // Method readLn:()Ljava/lang/String;
       3: invokestatic  #184                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
       6: ireturn

  private static final java.util.List<java.lang.String> readStrings();
    Code:
       0: invokestatic  #178                // Method readLn:()Ljava/lang/String;
       3: checkcast     #188                // class java/lang/CharSequence
       6: iconst_1
       7: anewarray     #55                 // class java/lang/String
      10: astore_0
      11: aload_0
      12: iconst_0
      13: ldc           #190                // String
      15: aastore
      16: aload_0
      17: iconst_0
      18: iconst_0
      19: bipush        6
      21: aconst_null
      22: invokestatic  #196                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      25: areturn

  private static final java.util.List<java.lang.Long> readLongs();
    Code:
       0: invokestatic  #199                // Method readStrings:()Ljava/util/List;
       3: checkcast     #201                // class java/lang/Iterable
       6: astore_0
       7: iconst_0
       8: istore_1
       9: aload_0
      10: astore_2
      11: new           #203                // class java/util/ArrayList
      14: dup
      15: aload_0
      16: bipush        10
      18: invokestatic  #209                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      21: invokespecial #212                // Method java/util/ArrayList."<init>":(I)V
      24: checkcast     #214                // class java/util/Collection
      27: astore_3
      28: iconst_0
      29: istore        4
      31: aload_2
      32: invokeinterface #218,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      37: astore        5
      39: aload         5
      41: invokeinterface #223,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      46: ifeq          92
      49: aload         5
      51: invokeinterface #226,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      56: astore        6
      58: aload_3
      59: aload         6
      61: checkcast     #55                 // class java/lang/String
      64: astore        7
      66: astore        9
      68: iconst_0
      69: istore        8
      71: aload         7
      73: invokestatic  #230                // Method java/lang/Long.parseLong:(Ljava/lang/String;)J
      76: nop
      77: invokestatic  #128                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      80: aload         9
      82: swap
      83: invokeinterface #234,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      88: pop
      89: goto          39
      92: aload_3
      93: checkcast     #63                 // class java/util/List
      96: nop
      97: areturn

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

  private static final java.lang.String solvePancakes$step(kotlin.jvm.internal.Ref$LongRef, kotlin.jvm.internal.Ref$LongRef, kotlin.jvm.internal.Ref$LongRef);
    Code:
       0: aload_0
       1: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
       4: aload_1
       5: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
       8: invokestatic  #252                // Method java/lang/Math.max:(JJ)J
      11: aload_2
      12: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
      15: lcmp
      16: ifge          63
      19: new           #84                 // class java/lang/StringBuilder
      22: dup
      23: invokespecial #85                 // Method java/lang/StringBuilder."<init>":()V
      26: aload_2
      27: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
      30: lconst_1
      31: lsub
      32: invokevirtual #255                // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;
      35: bipush        32
      37: invokevirtual #258                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      40: aload_0
      41: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
      44: invokevirtual #255                // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;
      47: bipush        32
      49: invokevirtual #258                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      52: aload_1
      53: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
      56: invokevirtual #255                // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;
      59: invokevirtual #101                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      62: areturn
      63: aload_0
      64: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
      67: aload_1
      68: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
      71: lcmp
      72: iflt          91
      75: aload_0
      76: aload_0
      77: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
      80: aload_2
      81: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
      84: lsub
      85: putfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
      88: goto          104
      91: aload_1
      92: aload_1
      93: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
      96: aload_2
      97: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     100: lsub
     101: putfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     104: aload_2
     105: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     108: lstore_3
     109: aload_2
     110: lload_3
     111: lconst_1
     112: ladd
     113: putfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
     116: aconst_null
     117: areturn

  private static final boolean solvePancakes$take$lambda$0(kotlin.jvm.internal.Ref$LongRef, long, long);
    Code:
       0: aload_0
       1: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
       4: lload_3
       5: invokestatic  #33                 // Method sum:(JJ)J
       8: lload_1
       9: lcmp
      10: iflt          17
      13: iconst_1
      14: goto          18
      17: iconst_0
      18: ireturn

  private static final long solvePancakes$take(kotlin.jvm.internal.Ref$LongRef, long, long);
    Code:
       0: new           #119                // class kotlin/ranges/LongRange
       3: dup
       4: aload_0
       5: getfield      #17                 // Field kotlin/jvm/internal/Ref$LongRef.element:J
       8: lconst_1
       9: lsub
      10: lload_1
      11: invokespecial #266                // Method kotlin/ranges/LongRange."<init>":(JJ)V
      14: aload_0
      15: lload_3
      16: invokedynamic #282,  0            // InvokeDynamic #0:invoke:(Lkotlin/jvm/internal/Ref$LongRef;J)Lkotlin/jvm/functions/Function1;
      21: invokestatic  #284                // Method binarySearch:(Lkotlin/ranges/LongRange;Lkotlin/jvm/functions/Function1;)J
      24: lconst_1
      25: lsub
      26: lreturn
}


package gcj.y2020.kickstart_b

const val M = 1000000000
val DX = intArrayOf(1, 0, M - 1, 0)
val DY = intArrayOf(0, 1, 0, M - 1)
const val DIR_ROSE = "ESWN"

private fun solve(): String {
	val s = "1(" + readLn() + ")"
	var i = 0
	fun readMove(): Pair<Int, Int> {
		val c = s[i++]
		if (c in DIR_ROSE) return DIR_ROSE.indexOf(c).let { DX[it] to DY[it] }
		i++
		var x = 0
		var y = 0
		while (s[i] != ')') {
			val (moveX, moveY) = readMove()
			x = (x + moveX) % M
			y = (y + moveY) % M
		}
		val (moveX, moveY) = listOf(x, y).map { (it.toLong() * (c - '0') % M).toInt() }
		i++
		return moveX to moveY
	}
	val (x, y) = readMove()
	return "${x + 1} ${y + 1}"
}

fun main() = repeat(readInt()) { println("Case #${it + 1}: ${solve()}") }

private fun readLn() = readLine()!!
private fun readInt() = readLn().toInt()

Compiled from "c.kt"
public final class gcj.y2020.kickstart_b.CKt {
  public static final int M;

  private static final int[] DX;

  private static final int[] DY;

  public static final java.lang.String DIR_ROSE;

  public static final int[] getDX();
    Code:
       0: getstatic     #11                 // Field DX:[I
       3: areturn

  public static final int[] getDY();
    Code:
       0: getstatic     #15                 // Field DY:[I
       3: areturn

  private static final java.lang.String solve();
    Code:
       0: new           #19                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #23                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #25                 // String 1(
       9: invokevirtual #29                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: invokestatic  #32                 // Method readLn:()Ljava/lang/String;
      15: invokevirtual #29                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      18: bipush        41
      20: invokevirtual #35                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      23: invokevirtual #38                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      26: astore_0
      27: new           #40                 // class kotlin/jvm/internal/Ref$IntRef
      30: dup
      31: invokespecial #41                 // Method kotlin/jvm/internal/Ref$IntRef."<init>":()V
      34: astore_1
      35: aload_0
      36: aload_1
      37: invokestatic  #45                 // Method solve$readMove:(Ljava/lang/String;Lkotlin/jvm/internal/Ref$IntRef;)Lkotlin/Pair;
      40: astore_2
      41: aload_2
      42: invokevirtual #51                 // Method kotlin/Pair.component1:()Ljava/lang/Object;
      45: checkcast     #53                 // class java/lang/Number
      48: invokevirtual #57                 // Method java/lang/Number.intValue:()I
      51: istore_3
      52: aload_2
      53: invokevirtual #60                 // Method kotlin/Pair.component2:()Ljava/lang/Object;
      56: checkcast     #53                 // class java/lang/Number
      59: invokevirtual #57                 // Method java/lang/Number.intValue:()I
      62: istore        4
      64: new           #19                 // class java/lang/StringBuilder
      67: dup
      68: invokespecial #23                 // Method java/lang/StringBuilder."<init>":()V
      71: iload_3
      72: iconst_1
      73: iadd
      74: invokevirtual #63                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      77: bipush        32
      79: invokevirtual #35                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      82: iload         4
      84: iconst_1
      85: iadd
      86: invokevirtual #63                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      89: invokevirtual #38                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      92: areturn

  public static final void main();
    Code:
       0: invokestatic  #74                 // Method readInt:()I
       3: istore_0
       4: iconst_0
       5: istore_1
       6: iload_1
       7: iload_0
       8: if_icmpge     61
      11: iload_1
      12: istore_2
      13: iconst_0
      14: istore_3
      15: new           #19                 // class java/lang/StringBuilder
      18: dup
      19: invokespecial #23                 // Method java/lang/StringBuilder."<init>":()V
      22: ldc           #76                 // String Case #
      24: invokevirtual #29                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      27: iload_2
      28: iconst_1
      29: iadd
      30: invokevirtual #63                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      33: ldc           #78                 // String :
      35: invokevirtual #29                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      38: invokestatic  #80                 // Method solve:()Ljava/lang/String;
      41: invokevirtual #29                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      44: invokevirtual #38                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      47: getstatic     #86                 // Field java/lang/System.out:Ljava/io/PrintStream;
      50: swap
      51: invokevirtual #92                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      54: nop
      55: iinc          1, 1
      58: goto          6
      61: return

  private static final java.lang.String readLn();
    Code:
       0: invokestatic  #99                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       3: dup
       4: invokestatic  #104                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       7: areturn

  private static final int readInt();
    Code:
       0: invokestatic  #32                 // Method readLn:()Ljava/lang/String;
       3: invokestatic  #110                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
       6: ireturn

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

  private static final kotlin.Pair<java.lang.Integer, java.lang.Integer> solve$readMove(java.lang.String, kotlin.jvm.internal.Ref$IntRef);
    Code:
       0: aload_0
       1: aload_1
       2: getfield      #119                // Field kotlin/jvm/internal/Ref$IntRef.element:I
       5: istore_3
       6: aload_1
       7: iload_3
       8: iconst_1
       9: iadd
      10: putfield      #119                // Field kotlin/jvm/internal/Ref$IntRef.element:I
      13: iload_3
      14: invokevirtual #125                // Method java/lang/String.charAt:(I)C
      17: istore_2
      18: ldc           #127                // String ESWN
      20: checkcast     #129                // class java/lang/CharSequence
      23: iload_2
      24: iconst_0
      25: iconst_2
      26: aconst_null
      27: invokestatic  #135                // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;CZILjava/lang/Object;)Z
      30: ifeq          75
      33: ldc           #127                // String ESWN
      35: checkcast     #129                // class java/lang/CharSequence
      38: iload_2
      39: iconst_0
      40: iconst_0
      41: bipush        6
      43: aconst_null
      44: invokestatic  #139                // Method kotlin/text/StringsKt.indexOf$default:(Ljava/lang/CharSequence;CIZILjava/lang/Object;)I
      47: istore        4
      49: iconst_0
      50: istore        5
      52: getstatic     #11                 // Field DX:[I
      55: iload         4
      57: iaload
      58: invokestatic  #143                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      61: getstatic     #15                 // Field DY:[I
      64: iload         4
      66: iaload
      67: invokestatic  #143                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      70: invokestatic  #149                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      73: nop
      74: areturn
      75: aload_1
      76: getfield      #119                // Field kotlin/jvm/internal/Ref$IntRef.element:I
      79: istore_3
      80: aload_1
      81: iload_3
      82: iconst_1
      83: iadd
      84: putfield      #119                // Field kotlin/jvm/internal/Ref$IntRef.element:I
      87: iconst_0
      88: istore_3
      89: iconst_0
      90: istore        4
      92: aload_0
      93: aload_1
      94: getfield      #119                // Field kotlin/jvm/internal/Ref$IntRef.element:I
      97: invokevirtual #125                // Method java/lang/String.charAt:(I)C
     100: bipush        41
     102: if_icmpeq     159
     105: aload_0
     106: aload_1
     107: invokestatic  #45                 // Method solve$readMove:(Ljava/lang/String;Lkotlin/jvm/internal/Ref$IntRef;)Lkotlin/Pair;
     110: astore        5
     112: aload         5
     114: invokevirtual #51                 // Method kotlin/Pair.component1:()Ljava/lang/Object;
     117: checkcast     #53                 // class java/lang/Number
     120: invokevirtual #57                 // Method java/lang/Number.intValue:()I
     123: istore        6
     125: aload         5
     127: invokevirtual #60                 // Method kotlin/Pair.component2:()Ljava/lang/Object;
     130: checkcast     #53                 // class java/lang/Number
     133: invokevirtual #57                 // Method java/lang/Number.intValue:()I
     136: istore        7
     138: iload_3
     139: iload         6
     141: iadd
     142: ldc           #150                // int 1000000000
     144: irem
     145: istore_3
     146: iload         4
     148: iload         7
     150: iadd
     151: ldc           #150                // int 1000000000
     153: irem
     154: istore        4
     156: goto          92
     159: iconst_2
     160: anewarray     #106                // class java/lang/Integer
     163: astore        6
     165: aload         6
     167: iconst_0
     168: iload_3
     169: invokestatic  #143                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     172: aastore
     173: aload         6
     175: iconst_1
     176: iload         4
     178: invokestatic  #143                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     181: aastore
     182: aload         6
     184: invokestatic  #156                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     187: checkcast     #158                // class java/lang/Iterable
     190: astore        6
     192: iconst_0
     193: istore        7
     195: aload         6
     197: astore        8
     199: new           #160                // class java/util/ArrayList
     202: dup
     203: aload         6
     205: bipush        10
     207: invokestatic  #164                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     210: invokespecial #167                // Method java/util/ArrayList."<init>":(I)V
     213: checkcast     #169                // class java/util/Collection
     216: astore        9
     218: iconst_0
     219: istore        10
     221: aload         8
     223: invokeinterface #173,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     228: astore        11
     230: aload         11
     232: invokeinterface #179,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     237: ifeq          295
     240: aload         11
     242: invokeinterface #182,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     247: astore        12
     249: aload         9
     251: aload         12
     253: checkcast     #53                 // class java/lang/Number
     256: invokevirtual #57                 // Method java/lang/Number.intValue:()I
     259: istore        13
     261: astore        15
     263: iconst_0
     264: istore        14
     266: iload         13
     268: i2l
     269: iload_2
     270: bipush        48
     272: isub
     273: i2l
     274: lmul
     275: ldc           #150                // int 1000000000
     277: i2l
     278: lrem
     279: l2i
     280: invokestatic  #143                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     283: aload         15
     285: swap
     286: invokeinterface #186,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     291: pop
     292: goto          230
     295: aload         9
     297: checkcast     #188                // class java/util/List
     300: nop
     301: astore        5
     303: aload         5
     305: iconst_0
     306: invokeinterface #192,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     311: checkcast     #53                 // class java/lang/Number
     314: invokevirtual #57                 // Method java/lang/Number.intValue:()I
     317: istore        6
     319: aload         5
     321: iconst_1
     322: invokeinterface #192,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     327: checkcast     #53                 // class java/lang/Number
     330: invokevirtual #57                 // Method java/lang/Number.intValue:()I
     333: istore        7
     335: aload_1
     336: getfield      #119                // Field kotlin/jvm/internal/Ref$IntRef.element:I
     339: istore        8
     341: aload_1
     342: iload         8
     344: iconst_1
     345: iadd
     346: putfield      #119                // Field kotlin/jvm/internal/Ref$IntRef.element:I
     349: iload         6
     351: invokestatic  #143                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     354: iload         7
     356: invokestatic  #143                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     359: invokestatic  #149                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     362: areturn

  static {};
    Code:
       0: iconst_4
       1: newarray       int
       3: astore_0
       4: aload_0
       5: iconst_0
       6: iconst_1
       7: iastore
       8: aload_0
       9: iconst_1
      10: iconst_0
      11: iastore
      12: aload_0
      13: iconst_2
      14: ldc           #209                // int 999999999
      16: iastore
      17: aload_0
      18: iconst_3
      19: iconst_0
      20: iastore
      21: aload_0
      22: putstatic     #11                 // Field DX:[I
      25: iconst_4
      26: newarray       int
      28: astore_0
      29: aload_0
      30: iconst_0
      31: iconst_0
      32: iastore
      33: aload_0
      34: iconst_1
      35: iconst_1
      36: iastore
      37: aload_0
      38: iconst_2
      39: iconst_0
      40: iastore
      41: aload_0
      42: iconst_3
      43: ldc           #209                // int 999999999
      45: iastore
      46: aload_0
      47: putstatic     #15                 // Field DY:[I
      50: return
}


package gcj.y2020.kickstart_b

import kotlin.math.pow

private fun solve(): Double {
	val (w, h, x1, y1, x2, y2) = readInts()
	return solve(x1 - 1, y2 - 1, h) + solve(y1 - 1, x2 - 1, w)
}

private fun solve(x: Int, y: Int, h: Int): Double {
	if (y + 1 >= h) return 0.0
	var res = 0.0
	var c = 1.0
	var p = x + y
	for (i in 0 until x) {
		res += c * (2.0).pow(-p)
		c *= x + y - i
		c /= i + 1
		while (c < 1) { p++; c *= 2 }
		while (c > 1) { p--; c /= 2 }
	}
	return res
}

fun main() = repeat(readInt()) { println("Case #${it + 1}: ${solve()}") }

private fun readLn() = readLine()!!
private fun readInt() = readLn().toInt()
private fun readStrings() = readLn().split(" ")
private fun readInts() = readStrings().map { it.toInt() }

operator fun <T> List<T>.component6(): T = get(5)

Compiled from "d.kt"
public final class gcj.y2020.kickstart_b.DKt {
  private static final double solve();
    Code:
       0: invokestatic  #10                 // Method readInts:()Ljava/util/List;
       3: astore_0
       4: aload_0
       5: iconst_0
       6: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      11: checkcast     #18                 // class java/lang/Number
      14: invokevirtual #22                 // Method java/lang/Number.intValue:()I
      17: istore_1
      18: aload_0
      19: iconst_1
      20: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      25: checkcast     #18                 // class java/lang/Number
      28: invokevirtual #22                 // Method java/lang/Number.intValue:()I
      31: istore_2
      32: aload_0
      33: iconst_2
      34: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      39: checkcast     #18                 // class java/lang/Number
      42: invokevirtual #22                 // Method java/lang/Number.intValue:()I
      45: istore_3
      46: aload_0
      47: iconst_3
      48: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      53: checkcast     #18                 // class java/lang/Number
      56: invokevirtual #22                 // Method java/lang/Number.intValue:()I
      59: istore        4
      61: aload_0
      62: iconst_4
      63: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      68: checkcast     #18                 // class java/lang/Number
      71: invokevirtual #22                 // Method java/lang/Number.intValue:()I
      74: istore        5
      76: aload_0
      77: invokestatic  #26                 // Method component6:(Ljava/util/List;)Ljava/lang/Object;
      80: checkcast     #18                 // class java/lang/Number
      83: invokevirtual #22                 // Method java/lang/Number.intValue:()I
      86: istore        6
      88: iload_3
      89: iconst_1
      90: isub
      91: iload         6
      93: iconst_1
      94: isub
      95: iload_2
      96: invokestatic  #29                 // Method solve:(III)D
      99: iload         4
     101: iconst_1
     102: isub
     103: iload         5
     105: iconst_1
     106: isub
     107: iload_1
     108: invokestatic  #29                 // Method solve:(III)D
     111: dadd
     112: dreturn

  private static final double solve(int, int, int);
    Code:
       0: iload_1
       1: iconst_1
       2: iadd
       3: iload_2
       4: if_icmplt     9
       7: dconst_0
       8: dreturn
       9: dconst_0
      10: dstore_3
      11: dconst_1
      12: dstore        5
      14: iload_0
      15: iload_1
      16: iadd
      17: istore        7
      19: iconst_0
      20: istore        8
      22: iload         8
      24: iload_0
      25: if_icmpge     112
      28: dload_3
      29: dload         5
      31: ldc2_w        #37                 // double 2.0d
      34: iload         7
      36: ineg
      37: i2d
      38: invokestatic  #44                 // Method java/lang/Math.pow:(DD)D
      41: dmul
      42: dadd
      43: dstore_3
      44: dload         5
      46: iload_0
      47: iload_1
      48: iadd
      49: iload         8
      51: isub
      52: i2d
      53: dmul
      54: dstore        5
      56: dload         5
      58: iload         8
      60: iconst_1
      61: iadd
      62: i2d
      63: ddiv
      64: dstore        5
      66: dload         5
      68: dconst_1
      69: dcmpg
      70: ifge          86
      73: iinc          7, 1
      76: dload         5
      78: iconst_2
      79: i2d
      80: dmul
      81: dstore        5
      83: goto          66
      86: dload         5
      88: dconst_1
      89: dcmpl
      90: ifle          106
      93: iinc          7, -1
      96: dload         5
      98: iconst_2
      99: i2d
     100: ddiv
     101: dstore        5
     103: goto          86
     106: iinc          8, 1
     109: goto          22
     112: dload_3
     113: dreturn

  public static final void main();
    Code:
       0: invokestatic  #56                 // Method readInt:()I
       3: istore_0
       4: iconst_0
       5: istore_1
       6: iload_1
       7: iload_0
       8: if_icmpge     61
      11: iload_1
      12: istore_2
      13: iconst_0
      14: istore_3
      15: new           #58                 // class java/lang/StringBuilder
      18: dup
      19: invokespecial #61                 // Method java/lang/StringBuilder."<init>":()V
      22: ldc           #63                 // String Case #
      24: invokevirtual #67                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      27: iload_2
      28: iconst_1
      29: iadd
      30: invokevirtual #70                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      33: ldc           #72                 // String :
      35: invokevirtual #67                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      38: invokestatic  #74                 // Method solve:()D
      41: invokevirtual #77                 // Method java/lang/StringBuilder.append:(D)Ljava/lang/StringBuilder;
      44: invokevirtual #81                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      47: getstatic     #87                 // Field java/lang/System.out:Ljava/io/PrintStream;
      50: swap
      51: invokevirtual #93                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      54: nop
      55: iinc          1, 1
      58: goto          6
      61: return

  private static final java.lang.String readLn();
    Code:
       0: invokestatic  #101                // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       3: dup
       4: invokestatic  #106                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       7: areturn

  private static final int readInt();
    Code:
       0: invokestatic  #108                // Method readLn:()Ljava/lang/String;
       3: invokestatic  #114                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
       6: ireturn

  private static final java.util.List<java.lang.String> readStrings();
    Code:
       0: invokestatic  #108                // Method readLn:()Ljava/lang/String;
       3: checkcast     #118                // class java/lang/CharSequence
       6: iconst_1
       7: anewarray     #120                // class java/lang/String
      10: astore_0
      11: aload_0
      12: iconst_0
      13: ldc           #122                // String
      15: aastore
      16: aload_0
      17: iconst_0
      18: iconst_0
      19: bipush        6
      21: aconst_null
      22: invokestatic  #128                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      25: areturn

  private static final java.util.List<java.lang.Integer> readInts();
    Code:
       0: invokestatic  #131                // Method readStrings:()Ljava/util/List;
       3: checkcast     #133                // class java/lang/Iterable
       6: astore_0
       7: iconst_0
       8: istore_1
       9: aload_0
      10: astore_2
      11: new           #135                // class java/util/ArrayList
      14: dup
      15: aload_0
      16: bipush        10
      18: invokestatic  #141                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      21: invokespecial #144                // Method java/util/ArrayList."<init>":(I)V
      24: checkcast     #146                // class java/util/Collection
      27: astore_3
      28: iconst_0
      29: istore        4
      31: aload_2
      32: invokeinterface #150,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      37: astore        5
      39: aload         5
      41: invokeinterface #156,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      46: ifeq          92
      49: aload         5
      51: invokeinterface #160,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      56: astore        6
      58: aload_3
      59: aload         6
      61: checkcast     #120                // class java/lang/String
      64: astore        7
      66: astore        9
      68: iconst_0
      69: istore        8
      71: aload         7
      73: invokestatic  #114                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      76: nop
      77: invokestatic  #164                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      80: aload         9
      82: swap
      83: invokeinterface #168,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      88: pop
      89: goto          39
      92: aload_3
      93: checkcast     #12                 // class java/util/List
      96: nop
      97: areturn

  public static final <T> T component6(java.util.List<? extends T>);
    Code:
       0: aload_0
       1: ldc           #183                // String <this>
       3: invokestatic  #187                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: iconst_5
       8: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      13: areturn

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


package gcj.y2020.kickstart_d

private fun solve(): Double {
	val (n, a, b) = readInts()
	val p = listOf(0, 0) + readInts()
	val p1 = probs(p, a)
	val p2 = probs(p, b)
	val x = (1 until p.size).map { p1[it].toLong() * p2[it] }.sum()
	return p.size - 1 - x / (p.size - 1.0) / (p.size - 1)
}

private fun probs(p: List<Int>, a: Int): IntArray {
	val q = 22
	val n = p.size
	val r = List(q) { IntArray(n) }
	for (i in p.indices) r[0][i] = p[i]
	for (j in 1 until q) {
		for (i in p.indices) r[j][i] = r[j - 1][r[j - 1][i]]
	}
	val up = IntArray(n) { i ->
		var k = i
		for (j in 0 until q) {
			if (((a shr j) and 1) == 0) continue
			k = r[j][k]
		}
		k
	}
	val below = IntArray(n)
	for (i in below.indices.reversed()) {
		below[i]++
		below[up[i]] += below[i]
	}
	return IntArray(n) { n - 1 - below[it] }
}

fun main() = repeat(readInt()) { println("Case #${it + 1}: ${solve()}") }

private fun readLn() = readLine()!!
private fun readInt() = readLn().toInt()
private fun readStrings() = readLn().split(" ").filter { it.isNotEmpty() }
private fun readInts() = readStrings().map { it.toInt() }

Compiled from "c.kt"
public final class gcj.y2020.kickstart_d.CKt {
  private static final double solve();
    Code:
       0: invokestatic  #10                 // Method readInts:()Ljava/util/List;
       3: astore_0
       4: aload_0
       5: iconst_0
       6: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      11: checkcast     #18                 // class java/lang/Number
      14: invokevirtual #22                 // Method java/lang/Number.intValue:()I
      17: istore_1
      18: aload_0
      19: iconst_1
      20: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      25: checkcast     #18                 // class java/lang/Number
      28: invokevirtual #22                 // Method java/lang/Number.intValue:()I
      31: istore_2
      32: aload_0
      33: iconst_2
      34: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      39: checkcast     #18                 // class java/lang/Number
      42: invokevirtual #22                 // Method java/lang/Number.intValue:()I
      45: istore_3
      46: iconst_2
      47: anewarray     #24                 // class java/lang/Integer
      50: astore        5
      52: aload         5
      54: iconst_0
      55: iconst_0
      56: invokestatic  #28                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      59: aastore
      60: aload         5
      62: iconst_1
      63: iconst_0
      64: invokestatic  #28                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      67: aastore
      68: aload         5
      70: invokestatic  #34                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      73: checkcast     #36                 // class java/util/Collection
      76: invokestatic  #10                 // Method readInts:()Ljava/util/List;
      79: checkcast     #38                 // class java/lang/Iterable
      82: invokestatic  #42                 // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Iterable;)Ljava/util/List;
      85: astore        4
      87: aload         4
      89: iload_2
      90: invokestatic  #46                 // Method probs:(Ljava/util/List;I)[I
      93: astore        5
      95: aload         4
      97: iload_3
      98: invokestatic  #46                 // Method probs:(Ljava/util/List;I)[I
     101: astore        6
     103: iconst_1
     104: aload         4
     106: invokeinterface #49,  1           // InterfaceMethod java/util/List.size:()I
     111: invokestatic  #55                 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
     114: checkcast     #38                 // class java/lang/Iterable
     117: astore        9
     119: iconst_0
     120: istore        10
     122: aload         9
     124: astore        11
     126: new           #57                 // class java/util/ArrayList
     129: dup
     130: aload         9
     132: bipush        10
     134: invokestatic  #61                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     137: invokespecial #65                 // Method java/util/ArrayList."<init>":(I)V
     140: checkcast     #36                 // class java/util/Collection
     143: astore        12
     145: iconst_0
     146: istore        13
     148: aload         11
     150: invokeinterface #69,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     155: astore        14
     157: aload         14
     159: invokeinterface #75,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     164: ifeq          216
     167: aload         14
     169: checkcast     #77                 // class kotlin/collections/IntIterator
     172: invokevirtual #80                 // Method kotlin/collections/IntIterator.nextInt:()I
     175: istore        15
     177: aload         12
     179: iload         15
     181: istore        16
     183: astore        18
     185: iconst_0
     186: istore        17
     188: aload         5
     190: iload         16
     192: iaload
     193: i2l
     194: aload         6
     196: iload         16
     198: iaload
     199: i2l
     200: lmul
     201: invokestatic  #85                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     204: aload         18
     206: swap
     207: invokeinterface #89,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     212: pop
     213: goto          157
     216: aload         12
     218: checkcast     #12                 // class java/util/List
     221: nop
     222: checkcast     #38                 // class java/lang/Iterable
     225: invokestatic  #93                 // Method kotlin/collections/CollectionsKt.sumOfLong:(Ljava/lang/Iterable;)J
     228: lstore        7
     230: aload         4
     232: invokeinterface #49,  1           // InterfaceMethod java/util/List.size:()I
     237: iconst_1
     238: isub
     239: i2d
     240: lload         7
     242: l2d
     243: aload         4
     245: invokeinterface #49,  1           // InterfaceMethod java/util/List.size:()I
     250: i2d
     251: dconst_1
     252: dsub
     253: ddiv
     254: aload         4
     256: invokeinterface #49,  1           // InterfaceMethod java/util/List.size:()I
     261: iconst_1
     262: isub
     263: i2d
     264: ddiv
     265: dsub
     266: dreturn

  private static final int[] probs(java.util.List<java.lang.Integer>, int);
    Code:
       0: bipush        22
       2: istore_2
       3: aload_0
       4: invokeinterface #49,  1           // InterfaceMethod java/util/List.size:()I
       9: istore_3
      10: new           #57                 // class java/util/ArrayList
      13: dup
      14: iload_2
      15: invokespecial #65                 // Method java/util/ArrayList."<init>":(I)V
      18: astore        5
      20: iconst_0
      21: istore        6
      23: iload         6
      25: iload_2
      26: if_icmpge     60
      29: iload         6
      31: istore        7
      33: aload         5
      35: iload         7
      37: istore        8
      39: astore        11
      41: iconst_0
      42: istore        9
      44: iload_3
      45: newarray       int
      47: aload         11
      49: swap
      50: invokevirtual #117                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      53: pop
      54: iinc          6, 1
      57: goto          23
      60: aload         5
      62: checkcast     #12                 // class java/util/List
      65: astore        4
      67: iconst_0
      68: istore        5
      70: aload_0
      71: checkcast     #36                 // class java/util/Collection
      74: invokeinterface #118,  1          // InterfaceMethod java/util/Collection.size:()I
      79: istore        6
      81: iload         5
      83: iload         6
      85: if_icmpge     122
      88: aload         4
      90: iconst_0
      91: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      96: checkcast     #115                // class "[I"
      99: iload         5
     101: aload_0
     102: iload         5
     104: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     109: checkcast     #18                 // class java/lang/Number
     112: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     115: iastore
     116: iinc          5, 1
     119: goto          81
     122: iconst_1
     123: istore        5
     125: iload         5
     127: iload_2
     128: if_icmpge     211
     131: iconst_0
     132: istore        6
     134: aload_0
     135: checkcast     #36                 // class java/util/Collection
     138: invokeinterface #118,  1          // InterfaceMethod java/util/Collection.size:()I
     143: istore        7
     145: iload         6
     147: iload         7
     149: if_icmpge     205
     152: aload         4
     154: iload         5
     156: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     161: checkcast     #115                // class "[I"
     164: iload         6
     166: aload         4
     168: iload         5
     170: iconst_1
     171: isub
     172: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     177: checkcast     #115                // class "[I"
     180: aload         4
     182: iload         5
     184: iconst_1
     185: isub
     186: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     191: checkcast     #115                // class "[I"
     194: iload         6
     196: iaload
     197: iaload
     198: iastore
     199: iinc          6, 1
     202: goto          145
     205: iinc          5, 1
     208: goto          125
     211: iconst_0
     212: istore        6
     214: iload_3
     215: newarray       int
     217: astore        7
     219: iload         6
     221: iload_3
     222: if_icmpge     295
     225: iload         6
     227: istore        8
     229: aload         7
     231: iload         8
     233: iload         8
     235: istore        9
     237: iconst_0
     238: istore        10
     240: istore        12
     242: astore        11
     244: iload         10
     246: iload_2
     247: if_icmpge     282
     250: iload_1
     251: iload         10
     253: ishr
     254: iconst_1
     255: iand
     256: ifeq          276
     259: aload         4
     261: iload         10
     263: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     268: checkcast     #115                // class "[I"
     271: iload         9
     273: iaload
     274: istore        9
     276: iinc          10, 1
     279: goto          244
     282: aload         11
     284: iload         12
     286: iload         9
     288: iastore
     289: iinc          6, 1
     292: goto          219
     295: aload         7
     297: astore        5
     299: iload_3
     300: newarray       int
     302: astore        6
     304: aload         6
     306: arraylength
     307: iconst_m1
     308: iadd
     309: istore        7
     311: iconst_0
     312: iload         7
     314: if_icmpgt     369
     317: iload         7
     319: istore        8
     321: iinc          7, -1
     324: aload         6
     326: iload         8
     328: iaload
     329: istore        9
     331: aload         6
     333: iload         8
     335: iload         9
     337: iconst_1
     338: iadd
     339: iastore
     340: aload         5
     342: iload         8
     344: iaload
     345: istore        10
     347: aload         6
     349: iload         10
     351: aload         6
     353: iload         10
     355: iaload
     356: aload         6
     358: iload         8
     360: iaload
     361: iadd
     362: iastore
     363: iconst_0
     364: iload         7
     366: if_icmple     317
     369: iconst_0
     370: istore        7
     372: iload_3
     373: newarray       int
     375: astore        8
     377: iload         7
     379: iload_3
     380: if_icmpge     407
     383: iload         7
     385: istore        9
     387: aload         8
     389: iload         9
     391: iload_3
     392: iconst_1
     393: isub
     394: aload         6
     396: iload         9
     398: iaload
     399: isub
     400: iastore
     401: iinc          7, 1
     404: goto          377
     407: aload         8
     409: areturn

  public static final void main();
    Code:
       0: invokestatic  #131                // Method readInt:()I
       3: istore_0
       4: iconst_0
       5: istore_1
       6: iload_1
       7: iload_0
       8: if_icmpge     61
      11: iload_1
      12: istore_2
      13: iconst_0
      14: istore_3
      15: new           #133                // class java/lang/StringBuilder
      18: dup
      19: invokespecial #135                // Method java/lang/StringBuilder."<init>":()V
      22: ldc           #137                // String Case #
      24: invokevirtual #141                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      27: iload_2
      28: iconst_1
      29: iadd
      30: invokevirtual #144                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      33: ldc           #146                // String :
      35: invokevirtual #141                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      38: invokestatic  #148                // Method solve:()D
      41: invokevirtual #151                // Method java/lang/StringBuilder.append:(D)Ljava/lang/StringBuilder;
      44: invokevirtual #155                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      47: getstatic     #161                // Field java/lang/System.out:Ljava/io/PrintStream;
      50: swap
      51: invokevirtual #167                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      54: nop
      55: iinc          1, 1
      58: goto          6
      61: return

  private static final java.lang.String readLn();
    Code:
       0: invokestatic  #174                // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       3: dup
       4: invokestatic  #179                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       7: areturn

  private static final int readInt();
    Code:
       0: invokestatic  #181                // Method readLn:()Ljava/lang/String;
       3: invokestatic  #185                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
       6: ireturn

  private static final java.util.List<java.lang.String> readStrings();
    Code:
       0: invokestatic  #181                // Method readLn:()Ljava/lang/String;
       3: checkcast     #189                // class java/lang/CharSequence
       6: iconst_1
       7: anewarray     #191                // class java/lang/String
      10: astore_0
      11: aload_0
      12: iconst_0
      13: ldc           #193                // String
      15: aastore
      16: aload_0
      17: iconst_0
      18: iconst_0
      19: bipush        6
      21: aconst_null
      22: invokestatic  #199                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      25: checkcast     #38                 // class java/lang/Iterable
      28: astore_0
      29: iconst_0
      30: istore_1
      31: aload_0
      32: astore_2
      33: new           #57                 // class java/util/ArrayList
      36: dup
      37: invokespecial #200                // Method java/util/ArrayList."<init>":()V
      40: checkcast     #36                 // class java/util/Collection
      43: astore_3
      44: iconst_0
      45: istore        4
      47: aload_2
      48: invokeinterface #69,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      53: astore        5
      55: aload         5
      57: invokeinterface #75,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      62: ifeq          118
      65: aload         5
      67: invokeinterface #204,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      72: astore        6
      74: aload         6
      76: checkcast     #191                // class java/lang/String
      79: astore        7
      81: iconst_0
      82: istore        8
      84: aload         7
      86: checkcast     #189                // class java/lang/CharSequence
      89: invokeinterface #207,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      94: ifle          101
      97: iconst_1
      98: goto          102
     101: iconst_0
     102: nop
     103: ifeq          55
     106: aload_3
     107: aload         6
     109: invokeinterface #89,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     114: pop
     115: goto          55
     118: aload_3
     119: checkcast     #12                 // class java/util/List
     122: nop
     123: areturn

  private static final java.util.List<java.lang.Integer> readInts();
    Code:
       0: invokestatic  #218                // Method readStrings:()Ljava/util/List;
       3: checkcast     #38                 // class java/lang/Iterable
       6: astore_0
       7: iconst_0
       8: istore_1
       9: aload_0
      10: astore_2
      11: new           #57                 // class java/util/ArrayList
      14: dup
      15: aload_0
      16: bipush        10
      18: invokestatic  #61                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      21: invokespecial #65                 // Method java/util/ArrayList."<init>":(I)V
      24: checkcast     #36                 // class java/util/Collection
      27: astore_3
      28: iconst_0
      29: istore        4
      31: aload_2
      32: invokeinterface #69,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      37: astore        5
      39: aload         5
      41: invokeinterface #75,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      46: ifeq          92
      49: aload         5
      51: invokeinterface #204,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      56: astore        6
      58: aload_3
      59: aload         6
      61: checkcast     #191                // class java/lang/String
      64: astore        7
      66: astore        9
      68: iconst_0
      69: istore        8
      71: aload         7
      73: invokestatic  #185                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      76: nop
      77: invokestatic  #28                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      80: aload         9
      82: swap
      83: invokeinterface #89,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      88: pop
      89: goto          39
      92: aload_3
      93: checkcast     #12                 // class java/util/List
      96: nop
      97: areturn

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


package gcj.y2020.kickstart_d

private fun solve(): String {
	val (n, q) = readInts()
	val d = readInts().toIntArray()
	val maxD = d.maxOrNull()!!
	val st = SparseTable(d)

	fun canWalk(s: Int, t: Int): Pair<Int, Int> {
		var low = s
		var high = n
		while (low + 1 < high) {
			val mid = (low + high) / 2
			val maxDoor = st.max(s, mid)
			if (maxDoor <= t) low = mid else high = mid
		}
		val ans1 = low - s
		low = s
		high = -1
		while (low - 1 > high) {
			val mid = (low + high) / 2
			val maxDoor = st.max(mid, s)
			if (maxDoor <= t) low = mid else high = mid
		}
		val ans2 = s - low
		return ans1 to ans2
	}

	val ans = IntArray(q) {
		val (sIn, k) = readInts()
		val s = sIn -1
		if (k == 1) return@IntArray s
		var low = 0
		var high = maxD
		while (low + 1 < high) {
			val mid = (low + high) / 2
			val cw = canWalk(s, mid)
			if (cw.first + cw.second + 1 >= k) high = mid else low = mid
		}
		val cw = canWalk(s, high)
		val cwp = canWalk(s, high - 1)
		if (cw.first != cwp.first) s - cw.first else s + cw.second
		high
	}
	return ans.joinToString(" ")
}

fun main() = repeat(readInt()) { println("Case #${it + 1}: ${solve()}") }

class SparseTable(a: IntArray) {
	var min: Array<IntArray>
	var max: Array<IntArray>
	fun min(from: Int, to: Int): Int {
		val j = Integer.SIZE - 1 - Integer.numberOfLeadingZeros(to - from)
		return Math.min(min[j][from], min[j][to - (1 shl j)])
	}

	fun max(from: Int, to: Int): Int {
		val j = Integer.SIZE - 1 - Integer.numberOfLeadingZeros(to - from)
		return Math.max(max[j][from], max[j][to - (1 shl j)])
	}

	init {
		val n = a.size
		var t = 1
		while (1 shl t <= n) {
			t++
		}
		min = Array(t) { IntArray(n) }
		max = Array(t) { IntArray(n) }
		System.arraycopy(a, 0, min[0], 0, n)
		System.arraycopy(a, 0, max[0], 0, n)
		for (j in 1 until t) {
			var i = 0
			while (i + (1 shl j) <= n) {
				min[j][i] = Math.min(min[j - 1][i], min[j - 1][i + (1 shl j - 1)])
				max[j][i] = Math.max(max[j - 1][i], max[j - 1][i + (1 shl j - 1)])
				i++
			}
		}
	}
}

private fun readLn() = readLine()!!
private fun readInt() = readLn().toInt()
private fun readStrings() = readLn().split(" ")
private fun readInts() = readStrings().map { it.toInt() }

Compiled from "d.kt"
public final class gcj.y2020.kickstart_d.DKt {
  private static final java.lang.String solve();
    Code:
       0: invokestatic  #10                 // Method readInts:()Ljava/util/List;
       3: astore_0
       4: aload_0
       5: iconst_0
       6: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      11: checkcast     #18                 // class java/lang/Number
      14: invokevirtual #22                 // Method java/lang/Number.intValue:()I
      17: istore_1
      18: aload_0
      19: iconst_1
      20: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      25: checkcast     #18                 // class java/lang/Number
      28: invokevirtual #22                 // Method java/lang/Number.intValue:()I
      31: istore_2
      32: invokestatic  #10                 // Method readInts:()Ljava/util/List;
      35: checkcast     #24                 // class java/util/Collection
      38: invokestatic  #30                 // Method kotlin/collections/CollectionsKt.toIntArray:(Ljava/util/Collection;)[I
      41: astore_3
      42: aload_3
      43: invokestatic  #36                 // Method kotlin/collections/ArraysKt.maxOrNull:([I)Ljava/lang/Integer;
      46: dup
      47: invokestatic  #42                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      50: invokevirtual #45                 // Method java/lang/Integer.intValue:()I
      53: istore        4
      55: new           #47                 // class gcj/y2020/kickstart_d/SparseTable
      58: dup
      59: aload_3
      60: invokespecial #51                 // Method gcj/y2020/kickstart_d/SparseTable."<init>":([I)V
      63: astore        5
      65: iconst_0
      66: istore        7
      68: iload_2
      69: newarray       int
      71: astore        8
      73: iload         7
      75: iload_2
      76: if_icmpge     328
      79: iload         7
      81: istore        9
      83: aload         8
      85: iload         9
      87: istore        20
      89: astore        19
      91: invokestatic  #10                 // Method readInts:()Ljava/util/List;
      94: astore        11
      96: aload         11
      98: iconst_0
      99: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     104: checkcast     #18                 // class java/lang/Number
     107: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     110: istore        12
     112: aload         11
     114: iconst_1
     115: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     120: checkcast     #18                 // class java/lang/Number
     123: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     126: istore        13
     128: iload         12
     130: iconst_1
     131: isub
     132: istore        14
     134: iload         13
     136: iconst_1
     137: if_icmpne     147
     140: iload         14
     142: istore        10
     144: goto          315
     147: iconst_0
     148: istore        15
     150: iload         4
     152: istore        16
     154: iload         15
     156: iconst_1
     157: iadd
     158: iload         16
     160: if_icmpge     228
     163: iload         15
     165: iload         16
     167: iadd
     168: iconst_2
     169: idiv
     170: istore        17
     172: iload_1
     173: aload         5
     175: iload         14
     177: iload         17
     179: invokestatic  #55                 // Method solve$canWalk:(ILgcj/y2020/kickstart_d/SparseTable;II)Lkotlin/Pair;
     182: astore        18
     184: aload         18
     186: invokevirtual #61                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     189: checkcast     #18                 // class java/lang/Number
     192: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     195: aload         18
     197: invokevirtual #64                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     200: checkcast     #18                 // class java/lang/Number
     203: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     206: iadd
     207: iconst_1
     208: iadd
     209: iload         13
     211: if_icmplt     221
     214: iload         17
     216: istore        16
     218: goto          154
     221: iload         17
     223: istore        15
     225: goto          154
     228: iload_1
     229: aload         5
     231: iload         14
     233: iload         16
     235: invokestatic  #55                 // Method solve$canWalk:(ILgcj/y2020/kickstart_d/SparseTable;II)Lkotlin/Pair;
     238: astore        17
     240: iload_1
     241: aload         5
     243: iload         14
     245: iload         16
     247: iconst_1
     248: isub
     249: invokestatic  #55                 // Method solve$canWalk:(ILgcj/y2020/kickstart_d/SparseTable;II)Lkotlin/Pair;
     252: astore        18
     254: aload         17
     256: invokevirtual #61                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     259: checkcast     #18                 // class java/lang/Number
     262: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     265: aload         18
     267: invokevirtual #61                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     270: checkcast     #18                 // class java/lang/Number
     273: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     276: if_icmpeq     296
     279: iload         14
     281: aload         17
     283: invokevirtual #61                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     286: checkcast     #18                 // class java/lang/Number
     289: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     292: isub
     293: goto          310
     296: iload         14
     298: aload         17
     300: invokevirtual #64                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     303: checkcast     #18                 // class java/lang/Number
     306: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     309: iadd
     310: pop
     311: iload         16
     313: istore        10
     315: aload         19
     317: iload         20
     319: iload         10
     321: iastore
     322: iinc          7, 1
     325: goto          73
     328: aload         8
     330: astore        6
     332: aload         6
     334: ldc           #66                 // String
     336: checkcast     #68                 // class java/lang/CharSequence
     339: aconst_null
     340: aconst_null
     341: iconst_0
     342: aconst_null
     343: aconst_null
     344: bipush        62
     346: aconst_null
     347: invokestatic  #72                 // Method kotlin/collections/ArraysKt.joinToString$default:([ILjava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
     350: areturn

  public static final void main();
    Code:
       0: invokestatic  #96                 // Method readInt:()I
       3: istore_0
       4: iconst_0
       5: istore_1
       6: iload_1
       7: iload_0
       8: if_icmpge     61
      11: iload_1
      12: istore_2
      13: iconst_0
      14: istore_3
      15: new           #98                 // class java/lang/StringBuilder
      18: dup
      19: invokespecial #100                // Method java/lang/StringBuilder."<init>":()V
      22: ldc           #102                // String Case #
      24: invokevirtual #106                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      27: iload_2
      28: iconst_1
      29: iadd
      30: invokevirtual #109                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      33: ldc           #111                // String :
      35: invokevirtual #106                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      38: invokestatic  #113                // Method solve:()Ljava/lang/String;
      41: invokevirtual #106                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      44: invokevirtual #116                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      47: getstatic     #122                // Field java/lang/System.out:Ljava/io/PrintStream;
      50: swap
      51: invokevirtual #127                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      54: nop
      55: iinc          1, 1
      58: goto          6
      61: return

  private static final java.lang.String readLn();
    Code:
       0: invokestatic  #135                // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       3: dup
       4: invokestatic  #42                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       7: areturn

  private static final int readInt();
    Code:
       0: invokestatic  #137                // Method readLn:()Ljava/lang/String;
       3: invokestatic  #141                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
       6: ireturn

  private static final java.util.List<java.lang.String> readStrings();
    Code:
       0: invokestatic  #137                // Method readLn:()Ljava/lang/String;
       3: checkcast     #68                 // class java/lang/CharSequence
       6: iconst_1
       7: anewarray     #145                // class java/lang/String
      10: astore_0
      11: aload_0
      12: iconst_0
      13: ldc           #66                 // String
      15: aastore
      16: aload_0
      17: iconst_0
      18: iconst_0
      19: bipush        6
      21: aconst_null
      22: invokestatic  #151                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      25: areturn

  private static final java.util.List<java.lang.Integer> readInts();
    Code:
       0: invokestatic  #154                // Method readStrings:()Ljava/util/List;
       3: checkcast     #156                // class java/lang/Iterable
       6: astore_0
       7: iconst_0
       8: istore_1
       9: aload_0
      10: astore_2
      11: new           #158                // class java/util/ArrayList
      14: dup
      15: aload_0
      16: bipush        10
      18: invokestatic  #162                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      21: invokespecial #165                // Method java/util/ArrayList."<init>":(I)V
      24: checkcast     #24                 // class java/util/Collection
      27: astore_3
      28: iconst_0
      29: istore        4
      31: aload_2
      32: invokeinterface #169,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      37: astore        5
      39: aload         5
      41: invokeinterface #175,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      46: ifeq          92
      49: aload         5
      51: invokeinterface #178,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      56: astore        6
      58: aload_3
      59: aload         6
      61: checkcast     #145                // class java/lang/String
      64: astore        7
      66: astore        9
      68: iconst_0
      69: istore        8
      71: aload         7
      73: invokestatic  #141                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      76: nop
      77: invokestatic  #182                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      80: aload         9
      82: swap
      83: invokeinterface #186,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      88: pop
      89: goto          39
      92: aload_3
      93: checkcast     #12                 // class java/util/List
      96: nop
      97: areturn

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

  private static final kotlin.Pair<java.lang.Integer, java.lang.Integer> solve$canWalk(int, gcj.y2020.kickstart_d.SparseTable, int, int);
    Code:
       0: iload_2
       1: istore        4
       3: iload_0
       4: istore        5
       6: iload         4
       8: iconst_1
       9: iadd
      10: iload         5
      12: if_icmpge     53
      15: iload         4
      17: iload         5
      19: iadd
      20: iconst_2
      21: idiv
      22: istore        6
      24: aload_1
      25: iload_2
      26: iload         6
      28: invokevirtual #207                // Method gcj/y2020/kickstart_d/SparseTable.max:(II)I
      31: istore        7
      33: iload         7
      35: iload_3
      36: if_icmpgt     46
      39: iload         6
      41: istore        4
      43: goto          6
      46: iload         6
      48: istore        5
      50: goto          6
      53: iload         4
      55: iload_2
      56: isub
      57: istore        6
      59: iload_2
      60: istore        4
      62: iconst_m1
      63: istore        5
      65: iload         4
      67: iconst_1
      68: isub
      69: iload         5
      71: if_icmple     112
      74: iload         4
      76: iload         5
      78: iadd
      79: iconst_2
      80: idiv
      81: istore        7
      83: aload_1
      84: iload         7
      86: iload_2
      87: invokevirtual #207                // Method gcj/y2020/kickstart_d/SparseTable.max:(II)I
      90: istore        8
      92: iload         8
      94: iload_3
      95: if_icmpgt     105
      98: iload         7
     100: istore        4
     102: goto          65
     105: iload         7
     107: istore        5
     109: goto          65
     112: iload_2
     113: iload         4
     115: isub
     116: istore        7
     118: iload         6
     120: invokestatic  #182                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     123: iload         7
     125: invokestatic  #182                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     128: invokestatic  #213                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     131: areturn
}


package gcj.y2020.kickstart_c

private fun solve(): Long {
	val (n, q) = readInts()
	val ft = FenwickTree(n)
	val ftCoef = FenwickTree(n)
	fun set(i: Int, value: Int) {
		ft[i] = minusOnePow(i) * value
		ftCoef[i] = minusOnePow(i) * value * (i + 1)
	}
	fun query(start: Int, end: Int) = (ftCoef.sum(start, end) - ft.sum(start, end) * start) * minusOnePow(start)
	readInts().forEachIndexed(::set)
	var ans = 0L
	repeat(q) {
		val (op, xIn, yIn) = readStrings()
		val x = xIn.toInt() - 1; val y = yIn.toInt()
		if (op == "U") set(x, y) else ans += query(x, y)
 	}
	return ans
}

class FenwickTree(n: Int) {
	val t = LongArray(n)

	fun add(i: Int, value: Long) {
		var j = i
		while (j < t.size) {
			t[j] += value
			j += j + 1 and -(j + 1)
		}
	}

	fun sum(i: Int): Long {
		var j = i - 1
		var res = 0L
		while (j >= 0) {
			res += t[j]
			j -= j + 1 and -(j + 1)
		}
		return res
	}

	fun sum(start: Int, end: Int): Long = sum(end) - sum(start)
	operator fun get(i: Int): Long = sum(i, i + 1)
	operator fun set(i: Int, value: Int) = add(i, value - get(i))
}

fun main() = repeat(readInt()) { println("Case #${it + 1}: ${solve()}") }

fun minusOnePow(i: Int) = 1 - ((i and 1) shl 1)
private fun readLn() = readLine()!!
private fun readInt() = readLn().toInt()
private fun readStrings() = readLn().split(" ")
private fun readInts() = readStrings().map { it.toInt() }

Compiled from "d.kt"
public final class gcj.y2020.kickstart_c.DKt {
  private static final long solve();
    Code:
       0: invokestatic  #10                 // Method readInts:()Ljava/util/List;
       3: astore_0
       4: aload_0
       5: iconst_0
       6: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      11: checkcast     #18                 // class java/lang/Number
      14: invokevirtual #22                 // Method java/lang/Number.intValue:()I
      17: istore_1
      18: aload_0
      19: iconst_1
      20: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      25: checkcast     #18                 // class java/lang/Number
      28: invokevirtual #22                 // Method java/lang/Number.intValue:()I
      31: istore_2
      32: new           #24                 // class gcj/y2020/kickstart_c/FenwickTree
      35: dup
      36: iload_1
      37: invokespecial #28                 // Method gcj/y2020/kickstart_c/FenwickTree."<init>":(I)V
      40: astore_3
      41: new           #24                 // class gcj/y2020/kickstart_c/FenwickTree
      44: dup
      45: iload_1
      46: invokespecial #28                 // Method gcj/y2020/kickstart_c/FenwickTree."<init>":(I)V
      49: astore        4
      51: invokestatic  #10                 // Method readInts:()Ljava/util/List;
      54: checkcast     #30                 // class java/lang/Iterable
      57: astore        5
      59: iconst_0
      60: istore        6
      62: iconst_0
      63: istore        7
      65: aload         5
      67: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      72: astore        8
      74: aload         8
      76: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      81: ifeq          139
      84: aload         8
      86: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      91: astore        9
      93: iload         7
      95: iinc          7, 1
      98: istore        10
     100: iload         10
     102: ifge          108
     105: invokestatic  #50                 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     108: iload         10
     110: aload         9
     112: checkcast     #18                 // class java/lang/Number
     115: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     118: istore        11
     120: istore        12
     122: iconst_0
     123: istore        13
     125: aload_3
     126: aload         4
     128: iload         12
     130: iload         11
     132: invokestatic  #54                 // Method solve$set:(Lgcj/y2020/kickstart_c/FenwickTree;Lgcj/y2020/kickstart_c/FenwickTree;II)V
     135: nop
     136: goto          74
     139: nop
     140: lconst_0
     141: lstore        15
     143: iconst_0
     144: istore        6
     146: iload         6
     148: iload_2
     149: if_icmpge     264
     152: iload         6
     154: istore        7
     156: iconst_0
     157: istore        8
     159: invokestatic  #57                 // Method readStrings:()Ljava/util/List;
     162: astore        9
     164: aload         9
     166: iconst_0
     167: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     172: checkcast     #59                 // class java/lang/String
     175: astore        10
     177: aload         9
     179: iconst_1
     180: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     185: checkcast     #59                 // class java/lang/String
     188: astore        11
     190: aload         9
     192: iconst_2
     193: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     198: checkcast     #59                 // class java/lang/String
     201: astore        12
     203: aload         11
     205: invokestatic  #65                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     208: iconst_1
     209: isub
     210: istore        13
     212: aload         12
     214: invokestatic  #65                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     217: istore        14
     219: aload         10
     221: ldc           #67                 // String U
     223: invokestatic  #73                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     226: ifeq          242
     229: aload_3
     230: aload         4
     232: iload         13
     234: iload         14
     236: invokestatic  #54                 // Method solve$set:(Lgcj/y2020/kickstart_c/FenwickTree;Lgcj/y2020/kickstart_c/FenwickTree;II)V
     239: goto          257
     242: lload         15
     244: aload         4
     246: aload_3
     247: iload         13
     249: iload         14
     251: invokestatic  #77                 // Method solve$query:(Lgcj/y2020/kickstart_c/FenwickTree;Lgcj/y2020/kickstart_c/FenwickTree;II)J
     254: ladd
     255: lstore        15
     257: nop
     258: iinc          6, 1
     261: goto          146
     264: lload         15
     266: lreturn

  public static final void main();
    Code:
       0: invokestatic  #106                // Method readInt:()I
       3: istore_0
       4: iconst_0
       5: istore_1
       6: iload_1
       7: iload_0
       8: if_icmpge     61
      11: iload_1
      12: istore_2
      13: iconst_0
      14: istore_3
      15: new           #108                // class java/lang/StringBuilder
      18: dup
      19: invokespecial #110                // Method java/lang/StringBuilder."<init>":()V
      22: ldc           #112                // String Case #
      24: invokevirtual #116                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      27: iload_2
      28: iconst_1
      29: iadd
      30: invokevirtual #119                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      33: ldc           #121                // String :
      35: invokevirtual #116                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      38: invokestatic  #123                // Method solve:()J
      41: invokevirtual #126                // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;
      44: invokevirtual #130                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      47: getstatic     #136                // Field java/lang/System.out:Ljava/io/PrintStream;
      50: swap
      51: invokevirtual #142                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      54: nop
      55: iinc          1, 1
      58: goto          6
      61: return

  public static final int minusOnePow(int);
    Code:
       0: iconst_1
       1: iload_0
       2: iconst_1
       3: iand
       4: iconst_1
       5: ishl
       6: isub
       7: ireturn

  private static final java.lang.String readLn();
    Code:
       0: invokestatic  #152                // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       3: dup
       4: invokestatic  #155                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       7: areturn

  private static final int readInt();
    Code:
       0: invokestatic  #157                // Method readLn:()Ljava/lang/String;
       3: invokestatic  #65                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
       6: ireturn

  private static final java.util.List<java.lang.String> readStrings();
    Code:
       0: invokestatic  #157                // Method readLn:()Ljava/lang/String;
       3: checkcast     #160                // class java/lang/CharSequence
       6: iconst_1
       7: anewarray     #59                 // class java/lang/String
      10: astore_0
      11: aload_0
      12: iconst_0
      13: ldc           #162                // String
      15: aastore
      16: aload_0
      17: iconst_0
      18: iconst_0
      19: bipush        6
      21: aconst_null
      22: invokestatic  #168                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      25: areturn

  private static final java.util.List<java.lang.Integer> readInts();
    Code:
       0: invokestatic  #57                 // Method readStrings:()Ljava/util/List;
       3: checkcast     #30                 // class java/lang/Iterable
       6: astore_0
       7: iconst_0
       8: istore_1
       9: aload_0
      10: astore_2
      11: new           #171                // class java/util/ArrayList
      14: dup
      15: aload_0
      16: bipush        10
      18: invokestatic  #175                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      21: invokespecial #176                // Method java/util/ArrayList."<init>":(I)V
      24: checkcast     #178                // class java/util/Collection
      27: astore_3
      28: iconst_0
      29: istore        4
      31: aload_2
      32: invokeinterface #34,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      37: astore        5
      39: aload         5
      41: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      46: ifeq          92
      49: aload         5
      51: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      56: astore        6
      58: aload_3
      59: aload         6
      61: checkcast     #59                 // class java/lang/String
      64: astore        7
      66: astore        9
      68: iconst_0
      69: istore        8
      71: aload         7
      73: invokestatic  #65                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      76: nop
      77: invokestatic  #182                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      80: aload         9
      82: swap
      83: invokeinterface #186,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      88: pop
      89: goto          39
      92: aload_3
      93: checkcast     #12                 // class java/util/List
      96: nop
      97: areturn

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

  private static final void solve$set(gcj.y2020.kickstart_c.FenwickTree, gcj.y2020.kickstart_c.FenwickTree, int, int);
    Code:
       0: aload_0
       1: iload_2
       2: iload_2
       3: invokestatic  #201                // Method minusOnePow:(I)I
       6: iload_3
       7: imul
       8: invokevirtual #205                // Method gcj/y2020/kickstart_c/FenwickTree.set:(II)V
      11: aload_1
      12: iload_2
      13: iload_2
      14: invokestatic  #201                // Method minusOnePow:(I)I
      17: iload_3
      18: imul
      19: iload_2
      20: iconst_1
      21: iadd
      22: imul
      23: invokevirtual #205                // Method gcj/y2020/kickstart_c/FenwickTree.set:(II)V
      26: return

  private static final long solve$query(gcj.y2020.kickstart_c.FenwickTree, gcj.y2020.kickstart_c.FenwickTree, int, int);
    Code:
       0: aload_0
       1: iload_2
       2: iload_3
       3: invokevirtual #210                // Method gcj/y2020/kickstart_c/FenwickTree.sum:(II)J
       6: aload_1
       7: iload_2
       8: iload_3
       9: invokevirtual #210                // Method gcj/y2020/kickstart_c/FenwickTree.sum:(II)J
      12: iload_2
      13: i2l
      14: lmul
      15: lsub
      16: iload_2
      17: invokestatic  #201                // Method minusOnePow:(I)I
      20: i2l
      21: lmul
      22: lreturn
}