package codeforces.kotlinheroes8

fun main() {
	val (n, m) = readInts()
	data class Attack(val warrior: Int, val barricade: Int, val damage: Int)
	val attacks = List(n) { warrior ->
		val (_, damages, barricadesLeft) = List(3) { readInts() }
		List(damages.size) { Attack(warrior, m - barricadesLeft[it], damages[it]) }
	}.flatten()
	val st = SegmentsTreeSimple(n)
	for (a in attacks.sortedBy { it.barricade }) {
		val level = a.warrior - a.barricade
		if (level < 0) continue
		st[level] = maxOf(st[level], a.damage + maxOf(st.getMax(0, level), 0))
	}
	println(st.getMax(0, n))
}

class SegmentsTreeSimple(var n: Int) {
	var max: LongArray
	var size = 1

	operator fun set(index: Int, value: Long) {
		var i = size + index
		max[i] = value
		while (i > 1) {
			i /= 2
			max[i] = maxOf(max[2 * i], max[2 * i + 1])
		}
	}

	operator fun get(index: Int): Long {
		return max[size + index]
	}

	fun getMax(from: Int, to: Int): Long {
		var fromVar = from
		var toVar = to
		fromVar += size
		toVar += size
		var res = Long.MIN_VALUE
		while (fromVar < toVar) {
			if (fromVar % 2 == 1) {
				res = maxOf(res, max[fromVar])
				fromVar++
			}
			if (toVar % 2 == 1) {
				toVar--
				res = maxOf(res, max[toVar])
			}
			fromVar /= 2
			toVar /= 2
		}
		return res
	}

	init {
		while (size <= n) {
			size *= 2
		}
		max = LongArray(2 * size)
	}
}

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

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

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

Compiled from "g.kt"
public final class codeforces.kotlinheroes8.GKt$main$Attack {
  private final int warrior;

  private final int barricade;

  private final int damage;

  public codeforces.kotlinheroes8.GKt$main$Attack(int, int, int);
    Code:
       0: aload_0
       1: invokespecial #9                  // Method java/lang/Object."<init>":()V
       4: aload_0
       5: iload_1
       6: putfield      #13                 // Field warrior:I
       9: aload_0
      10: iload_2
      11: putfield      #16                 // Field barricade:I
      14: aload_0
      15: iload_3
      16: putfield      #19                 // Field damage:I
      19: return

  public final int getWarrior();
    Code:
       0: aload_0
       1: getfield      #13                 // Field warrior:I
       4: ireturn

  public final int getBarricade();
    Code:
       0: aload_0
       1: getfield      #16                 // Field barricade:I
       4: ireturn

  public final int getDamage();
    Code:
       0: aload_0
       1: getfield      #19                 // Field damage:I
       4: ireturn

  public final int component1();
    Code:
       0: aload_0
       1: getfield      #13                 // Field warrior:I
       4: ireturn

  public final int component2();
    Code:
       0: aload_0
       1: getfield      #16                 // Field barricade:I
       4: ireturn

  public final int component3();
    Code:
       0: aload_0
       1: getfield      #19                 // Field damage:I
       4: ireturn

  public final codeforces.kotlinheroes8.GKt$main$Attack copy(int, int, int);
    Code:
       0: new           #2                  // class codeforces/kotlinheroes8/GKt$main$Attack
       3: dup
       4: iload_1
       5: iload_2
       6: iload_3
       7: invokespecial #32                 // Method "<init>":(III)V
      10: areturn

  public static codeforces.kotlinheroes8.GKt$main$Attack copy$default(codeforces.kotlinheroes8.GKt$main$Attack, int, int, int, int, java.lang.Object);
    Code:
       0: iload         4
       2: iconst_1
       3: iand
       4: ifeq          12
       7: aload_0
       8: getfield      #13                 // Field warrior:I
      11: istore_1
      12: iload         4
      14: iconst_2
      15: iand
      16: ifeq          24
      19: aload_0
      20: getfield      #16                 // Field barricade:I
      23: istore_2
      24: iload         4
      26: iconst_4
      27: iand
      28: ifeq          36
      31: aload_0
      32: getfield      #19                 // Field damage:I
      35: istore_3
      36: aload_0
      37: iload_1
      38: iload_2
      39: iload_3
      40: invokevirtual #36                 // Method copy:(III)Lcodeforces/kotlinheroes8/GKt$main$Attack;
      43: areturn

  public java.lang.String toString();
    Code:
       0: new           #40                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #41                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #43                 // String Attack(warrior=
       9: invokevirtual #47                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #13                 // Field warrior:I
      16: invokevirtual #50                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: ldc           #52                 // String , barricade=
      21: invokevirtual #47                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #16                 // Field barricade:I
      28: invokevirtual #50                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: ldc           #54                 // String , damage=
      33: invokevirtual #47                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      36: aload_0
      37: getfield      #19                 // Field damage:I
      40: invokevirtual #50                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      43: bipush        41
      45: invokevirtual #57                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      48: invokevirtual #59                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      51: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #13                 // Field warrior:I
       4: invokestatic  #65                 // Method java/lang/Integer.hashCode:(I)I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #16                 // Field barricade:I
      16: invokestatic  #65                 // Method java/lang/Integer.hashCode:(I)I
      19: iadd
      20: istore_1
      21: iload_1
      22: bipush        31
      24: imul
      25: aload_0
      26: getfield      #19                 // Field damage:I
      29: invokestatic  #65                 // Method java/lang/Integer.hashCode:(I)I
      32: iadd
      33: istore_1
      34: iload_1
      35: ireturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class codeforces/kotlinheroes8/GKt$main$Attack
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class codeforces/kotlinheroes8/GKt$main$Attack
      20: astore_2
      21: aload_0
      22: getfield      #13                 // Field warrior:I
      25: aload_2
      26: getfield      #13                 // Field warrior:I
      29: if_icmpeq     34
      32: iconst_0
      33: ireturn
      34: aload_0
      35: getfield      #16                 // Field barricade:I
      38: aload_2
      39: getfield      #16                 // Field barricade:I
      42: if_icmpeq     47
      45: iconst_0
      46: ireturn
      47: aload_0
      48: getfield      #19                 // Field damage:I
      51: aload_2
      52: getfield      #19                 // Field damage:I
      55: if_icmpeq     60
      58: iconst_0
      59: ireturn
      60: iconst_1
      61: ireturn
}

Compiled from "g.kt"
public final class codeforces.kotlinheroes8.GKt {
  public static final void main();
    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 java/util/ArrayList
      35: dup
      36: iload_1
      37: invokespecial #28                 // Method java/util/ArrayList."<init>":(I)V
      40: astore        4
      42: iconst_0
      43: istore        5
      45: iload         5
      47: iload_1
      48: if_icmpge     272
      51: iload         5
      53: istore        6
      55: aload         4
      57: iload         6
      59: istore        7
      61: astore        19
      63: iconst_0
      64: istore        8
      66: iconst_3
      67: istore        9
      69: new           #24                 // class java/util/ArrayList
      72: dup
      73: iload         9
      75: invokespecial #28                 // Method java/util/ArrayList."<init>":(I)V
      78: astore        10
      80: iconst_0
      81: istore        11
      83: iload         11
      85: iload         9
      87: if_icmpge     121
      90: iload         11
      92: istore        12
      94: aload         10
      96: iload         12
      98: istore        13
     100: astore        14
     102: iconst_0
     103: istore        15
     105: invokestatic  #10                 // Method readInts:()Ljava/util/List;
     108: aload         14
     110: swap
     111: invokevirtual #32                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     114: pop
     115: iinc          11, 1
     118: goto          83
     121: aload         10
     123: checkcast     #12                 // class java/util/List
     126: astore        16
     128: aload         16
     130: iconst_1
     131: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     136: checkcast     #12                 // class java/util/List
     139: astore        9
     141: aload         16
     143: iconst_2
     144: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     149: checkcast     #12                 // class java/util/List
     152: astore        10
     154: aload         9
     156: invokeinterface #35,  1           // InterfaceMethod java/util/List.size:()I
     161: istore        11
     163: new           #24                 // class java/util/ArrayList
     166: dup
     167: iload         11
     169: invokespecial #28                 // Method java/util/ArrayList."<init>":(I)V
     172: astore        12
     174: iconst_0
     175: istore        13
     177: iload         13
     179: iload         11
     181: if_icmpge     253
     184: iload         13
     186: istore        15
     188: aload         12
     190: iload         15
     192: istore        17
     194: astore        14
     196: iconst_0
     197: istore        18
     199: new           #37                 // class codeforces/kotlinheroes8/GKt$main$Attack
     202: dup
     203: iload         7
     205: iload_2
     206: aload         10
     208: iload         17
     210: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     215: checkcast     #18                 // class java/lang/Number
     218: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     221: isub
     222: aload         9
     224: iload         17
     226: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     231: checkcast     #18                 // class java/lang/Number
     234: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     237: invokespecial #40                 // Method codeforces/kotlinheroes8/GKt$main$Attack."<init>":(III)V
     240: aload         14
     242: swap
     243: invokevirtual #32                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     246: pop
     247: iinc          13, 1
     250: goto          177
     253: aload         12
     255: checkcast     #12                 // class java/util/List
     258: nop
     259: aload         19
     261: swap
     262: invokevirtual #32                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     265: pop
     266: iinc          5, 1
     269: goto          45
     272: aload         4
     274: checkcast     #12                 // class java/util/List
     277: checkcast     #42                 // class java/lang/Iterable
     280: invokestatic  #48                 // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;
     283: astore_3
     284: new           #50                 // class codeforces/kotlinheroes8/SegmentsTreeSimple
     287: dup
     288: iload_1
     289: invokespecial #51                 // Method codeforces/kotlinheroes8/SegmentsTreeSimple."<init>":(I)V
     292: astore        4
     294: aload_3
     295: checkcast     #42                 // class java/lang/Iterable
     298: astore        6
     300: iconst_0
     301: istore        7
     303: aload         6
     305: new           #53                 // class codeforces/kotlinheroes8/GKt$main$$inlined$sortedBy$1
     308: dup
     309: invokespecial #55                 // Method codeforces/kotlinheroes8/GKt$main$$inlined$sortedBy$1."<init>":()V
     312: checkcast     #57                 // class java/util/Comparator
     315: invokestatic  #61                 // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
     318: invokeinterface #65,  1           // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     323: astore        5
     325: aload         5
     327: invokeinterface #71,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     332: ifeq          404
     335: aload         5
     337: invokeinterface #75,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     342: checkcast     #37                 // class codeforces/kotlinheroes8/GKt$main$Attack
     345: astore        6
     347: aload         6
     349: invokevirtual #78                 // Method codeforces/kotlinheroes8/GKt$main$Attack.getWarrior:()I
     352: aload         6
     354: invokevirtual #81                 // Method codeforces/kotlinheroes8/GKt$main$Attack.getBarricade:()I
     357: isub
     358: istore        7
     360: iload         7
     362: iflt          325
     365: aload         4
     367: iload         7
     369: aload         4
     371: iload         7
     373: invokevirtual #84                 // Method codeforces/kotlinheroes8/SegmentsTreeSimple.get:(I)J
     376: aload         6
     378: invokevirtual #87                 // Method codeforces/kotlinheroes8/GKt$main$Attack.getDamage:()I
     381: i2l
     382: aload         4
     384: iconst_0
     385: iload         7
     387: invokevirtual #91                 // Method codeforces/kotlinheroes8/SegmentsTreeSimple.getMax:(II)J
     390: lconst_0
     391: invokestatic  #97                 // Method java/lang/Math.max:(JJ)J
     394: ladd
     395: invokestatic  #97                 // Method java/lang/Math.max:(JJ)J
     398: invokevirtual #101                // Method codeforces/kotlinheroes8/SegmentsTreeSimple.set:(IJ)V
     401: goto          325
     404: aload         4
     406: iconst_0
     407: iload_1
     408: invokevirtual #91                 // Method codeforces/kotlinheroes8/SegmentsTreeSimple.getMax:(II)J
     411: lstore        5
     413: getstatic     #107                // Field java/lang/System.out:Ljava/io/PrintStream;
     416: lload         5
     418: invokevirtual #113                // Method java/io/PrintStream.println:(J)V
     421: return

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

  private static final java.util.List<java.lang.String> readStrings();
    Code:
       0: invokestatic  #150                // Method readLn:()Ljava/lang/String;
       3: checkcast     #152                // class java/lang/CharSequence
       6: iconst_1
       7: anewarray     #154                // class java/lang/String
      10: astore_0
      11: aload_0
      12: iconst_0
      13: ldc           #156                // String
      15: aastore
      16: aload_0
      17: iconst_0
      18: iconst_0
      19: bipush        6
      21: aconst_null
      22: invokestatic  #162                // 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  #165                // Method readStrings:()Ljava/util/List;
       3: checkcast     #42                 // class java/lang/Iterable
       6: astore_0
       7: iconst_0
       8: istore_1
       9: aload_0
      10: astore_2
      11: new           #24                 // class java/util/ArrayList
      14: dup
      15: aload_0
      16: bipush        10
      18: invokestatic  #169                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      21: invokespecial #28                 // Method java/util/ArrayList."<init>":(I)V
      24: checkcast     #171                // class java/util/Collection
      27: astore_3
      28: iconst_0
      29: istore        4
      31: aload_2
      32: invokeinterface #172,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      37: astore        5
      39: aload         5
      41: invokeinterface #71,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      46: ifeq          92
      49: aload         5
      51: invokeinterface #75,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      56: astore        6
      58: aload_3
      59: aload         6
      61: checkcast     #154                // class java/lang/String
      64: astore        7
      66: astore        9
      68: iconst_0
      69: istore        8
      71: aload         7
      73: invokestatic  #178                // 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 #183,  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  #196                // Method main:()V
       3: return
}


package codeforces.kotlinheroes8

fun main() {
	val (n, m) = readInts()
	val groups = List(2) { mutableListOf<IndexedValue<Int>>() }
	repeat(n) {
		val (k, t) = readInts()
		groups[t - 1].add(IndexedValue(it, k))
	}
	val groupSum = groups.map { group -> group.sumOf { it.value } }
	val can = BooleanArray(m + 1)
	val how = Array<IndexedValue<Int>?>(m + 1) { null }
	can[0] = true
	for (series in groups[1]) for (i in m - series.value downTo 0) {
		if (!can[i] || can[i + series.value]) continue
		can[i + series.value] = true
		how[i + series.value] = series
	}
	val x = can.indices.firstOrNull { can[it] && maxOf(2 * it - 1, 2 * (groupSum[1] - it)) + groupSum[0] <= m }
		?: return println(-1)
	val odd = mutableListOf<IndexedValue<Int>>()
	var z = x
	while (z > 0) z -= how[z]!!.also { odd.add(it) }.value
	val ans = IntArray(n)
	fun place(list: List<IndexedValue<Int>>, start: Int, gap: Int) {
		list.fold(start) { time, series -> (time + series.value * gap).also { ans[series.index] = time } }
	}
	place(odd, 1, 2)
	place(groups[1] - odd, 2, 2)
	place(groups[0], m - groupSum[0] + 1, 1)
	println(ans.joinToString(" "))
}

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

Compiled from "f.kt"
public final class codeforces.kotlinheroes8.FKt {
  public static final void main();
    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: iconst_2
      33: istore        4
      35: new           #24                 // class java/util/ArrayList
      38: dup
      39: iload         4
      41: invokespecial #28                 // Method java/util/ArrayList."<init>":(I)V
      44: astore        5
      46: iconst_0
      47: istore        6
      49: iload         6
      51: iload         4
      53: if_icmpge     95
      56: iload         6
      58: istore        7
      60: aload         5
      62: iload         7
      64: istore        8
      66: astore        22
      68: iconst_0
      69: istore        9
      71: new           #24                 // class java/util/ArrayList
      74: dup
      75: invokespecial #30                 // Method java/util/ArrayList."<init>":()V
      78: checkcast     #12                 // class java/util/List
      81: nop
      82: aload         22
      84: swap
      85: invokevirtual #34                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      88: pop
      89: iinc          6, 1
      92: goto          49
      95: aload         5
      97: checkcast     #12                 // class java/util/List
     100: astore_3
     101: iconst_0
     102: istore        4
     104: iload         4
     106: iload_1
     107: if_icmpge     194
     110: iload         4
     112: istore        5
     114: iconst_0
     115: istore        6
     117: invokestatic  #10                 // Method readInts:()Ljava/util/List;
     120: astore        7
     122: aload         7
     124: iconst_0
     125: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     130: checkcast     #18                 // class java/lang/Number
     133: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     136: istore        8
     138: aload         7
     140: iconst_1
     141: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     146: checkcast     #18                 // class java/lang/Number
     149: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     152: istore        9
     154: aload_3
     155: iload         9
     157: iconst_1
     158: isub
     159: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     164: checkcast     #12                 // class java/util/List
     167: new           #36                 // class kotlin/collections/IndexedValue
     170: dup
     171: iload         5
     173: iload         8
     175: invokestatic  #42                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     178: invokespecial #45                 // Method kotlin/collections/IndexedValue."<init>":(ILjava/lang/Object;)V
     181: invokeinterface #46,  2           // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     186: pop
     187: nop
     188: iinc          4, 1
     191: goto          104
     194: aload_3
     195: checkcast     #48                 // class java/lang/Iterable
     198: astore        5
     200: iconst_0
     201: istore        6
     203: aload         5
     205: astore        7
     207: new           #24                 // class java/util/ArrayList
     210: dup
     211: aload         5
     213: bipush        10
     215: invokestatic  #54                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     218: invokespecial #28                 // Method java/util/ArrayList."<init>":(I)V
     221: checkcast     #56                 // class java/util/Collection
     224: astore        8
     226: iconst_0
     227: istore        9
     229: aload         7
     231: invokeinterface #60,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     236: astore        10
     238: aload         10
     240: invokeinterface #66,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     245: ifeq          364
     248: aload         10
     250: invokeinterface #70,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     255: astore        11
     257: aload         8
     259: aload         11
     261: checkcast     #12                 // class java/util/List
     264: astore        12
     266: astore        22
     268: iconst_0
     269: istore        13
     271: aload         12
     273: checkcast     #48                 // class java/lang/Iterable
     276: astore        14
     278: iconst_0
     279: istore        15
     281: aload         14
     283: invokeinterface #60,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     288: astore        16
     290: aload         16
     292: invokeinterface #66,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     297: ifeq          346
     300: aload         16
     302: invokeinterface #70,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     307: astore        17
     309: iload         15
     311: aload         17
     313: checkcast     #36                 // class kotlin/collections/IndexedValue
     316: astore        18
     318: istore        19
     320: iconst_0
     321: istore        20
     323: aload         18
     325: invokevirtual #73                 // Method kotlin/collections/IndexedValue.getValue:()Ljava/lang/Object;
     328: checkcast     #18                 // class java/lang/Number
     331: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     334: istore        21
     336: iload         19
     338: iload         21
     340: iadd
     341: istore        15
     343: goto          290
     346: iload         15
     348: nop
     349: invokestatic  #42                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     352: aload         22
     354: swap
     355: invokeinterface #74,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     360: pop
     361: goto          238
     364: aload         8
     366: checkcast     #12                 // class java/util/List
     369: nop
     370: astore        4
     372: iload_2
     373: iconst_1
     374: iadd
     375: newarray       boolean
     377: astore        5
     379: iconst_0
     380: istore        7
     382: iload_2
     383: iconst_1
     384: iadd
     385: istore        8
     387: iload         8
     389: anewarray     #36                 // class kotlin/collections/IndexedValue
     392: astore        9
     394: iload         7
     396: iload         8
     398: if_icmpge     417
     401: iload         7
     403: istore        10
     405: aload         9
     407: iload         10
     409: aconst_null
     410: aastore
     411: iinc          7, 1
     414: goto          394
     417: aload         9
     419: astore        6
     421: aload         5
     423: iconst_0
     424: iconst_1
     425: bastore
     426: aload_3
     427: iconst_1
     428: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     433: checkcast     #12                 // class java/util/List
     436: invokeinterface #75,  1           // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     441: astore        7
     443: aload         7
     445: invokeinterface #66,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     450: ifeq          560
     453: aload         7
     455: invokeinterface #70,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     460: checkcast     #36                 // class kotlin/collections/IndexedValue
     463: astore        8
     465: iload_2
     466: aload         8
     468: invokevirtual #73                 // Method kotlin/collections/IndexedValue.getValue:()Ljava/lang/Object;
     471: checkcast     #18                 // class java/lang/Number
     474: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     477: isub
     478: istore        9
     480: iconst_m1
     481: iload         9
     483: if_icmpge     443
     486: aload         5
     488: iload         9
     490: baload
     491: ifeq          554
     494: aload         5
     496: iload         9
     498: aload         8
     500: invokevirtual #73                 // Method kotlin/collections/IndexedValue.getValue:()Ljava/lang/Object;
     503: checkcast     #18                 // class java/lang/Number
     506: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     509: iadd
     510: baload
     511: ifeq          517
     514: goto          554
     517: aload         5
     519: iload         9
     521: aload         8
     523: invokevirtual #73                 // Method kotlin/collections/IndexedValue.getValue:()Ljava/lang/Object;
     526: checkcast     #18                 // class java/lang/Number
     529: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     532: iadd
     533: iconst_1
     534: bastore
     535: aload         6
     537: iload         9
     539: aload         8
     541: invokevirtual #73                 // Method kotlin/collections/IndexedValue.getValue:()Ljava/lang/Object;
     544: checkcast     #18                 // class java/lang/Number
     547: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     550: iadd
     551: aload         8
     553: aastore
     554: iinc          9, -1
     557: goto          480
     560: aload         5
     562: invokestatic  #81                 // Method kotlin/collections/ArraysKt.getIndices:([Z)Lkotlin/ranges/IntRange;
     565: checkcast     #48                 // class java/lang/Iterable
     568: astore        9
     570: iconst_0
     571: istore        10
     573: aload         9
     575: invokeinterface #60,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     580: astore        11
     582: aload         11
     584: invokeinterface #66,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     589: ifeq          682
     592: aload         11
     594: invokeinterface #70,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     599: astore        12
     601: aload         12
     603: checkcast     #18                 // class java/lang/Number
     606: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     609: istore        13
     611: iconst_0
     612: istore        14
     614: aload         5
     616: iload         13
     618: baload
     619: ifeq          673
     622: iconst_2
     623: iload         13
     625: imul
     626: iconst_1
     627: isub
     628: iconst_2
     629: aload         4
     631: iconst_1
     632: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     637: checkcast     #18                 // class java/lang/Number
     640: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     643: iload         13
     645: isub
     646: imul
     647: invokestatic  #87                 // Method java/lang/Math.max:(II)I
     650: aload         4
     652: iconst_0
     653: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     658: checkcast     #18                 // class java/lang/Number
     661: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     664: iadd
     665: iload_2
     666: if_icmpgt     673
     669: iconst_1
     670: goto          674
     673: iconst_0
     674: ifeq          582
     677: aload         12
     679: goto          683
     682: aconst_null
     683: checkcast     #38                 // class java/lang/Integer
     686: dup
     687: ifnull        696
     690: invokevirtual #88                 // Method java/lang/Integer.intValue:()I
     693: goto          709
     696: pop
     697: iconst_m1
     698: istore        9
     700: getstatic     #94                 // Field java/lang/System.out:Ljava/io/PrintStream;
     703: iload         9
     705: invokevirtual #99                 // Method java/io/PrintStream.println:(I)V
     708: return
     709: istore        7
     711: new           #24                 // class java/util/ArrayList
     714: dup
     715: invokespecial #30                 // Method java/util/ArrayList."<init>":()V
     718: checkcast     #12                 // class java/util/List
     721: astore        8
     723: iload         7
     725: istore        9
     727: iload         9
     729: ifle          788
     732: iload         9
     734: aload         6
     736: iload         9
     738: aaload
     739: dup
     740: invokestatic  #105                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     743: astore        10
     745: aload         10
     747: astore        11
     749: istore        22
     751: iconst_0
     752: istore        12
     754: aload         8
     756: aload         11
     758: invokeinterface #46,  2           // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     763: pop
     764: getstatic     #111                // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
     767: astore        23
     769: iload         22
     771: aload         10
     773: invokevirtual #73                 // Method kotlin/collections/IndexedValue.getValue:()Ljava/lang/Object;
     776: checkcast     #18                 // class java/lang/Number
     779: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     782: isub
     783: istore        9
     785: goto          727
     788: iload_1
     789: newarray       int
     791: astore        10
     793: aload         10
     795: aload         8
     797: iconst_1
     798: iconst_2
     799: invokestatic  #115                // Method main$place:([ILjava/util/List;II)V
     802: aload         10
     804: aload_3
     805: iconst_1
     806: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     811: checkcast     #48                 // class java/lang/Iterable
     814: aload         8
     816: checkcast     #48                 // class java/lang/Iterable
     819: invokestatic  #119                // Method kotlin/collections/CollectionsKt.minus:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/List;
     822: iconst_2
     823: iconst_2
     824: invokestatic  #115                // Method main$place:([ILjava/util/List;II)V
     827: aload         10
     829: aload_3
     830: iconst_0
     831: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     836: checkcast     #12                 // class java/util/List
     839: iload_2
     840: aload         4
     842: iconst_0
     843: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     848: checkcast     #18                 // class java/lang/Number
     851: invokevirtual #22                 // Method java/lang/Number.intValue:()I
     854: isub
     855: iconst_1
     856: iadd
     857: iconst_1
     858: invokestatic  #115                // Method main$place:([ILjava/util/List;II)V
     861: aload         10
     863: ldc           #121                // String
     865: checkcast     #123                // class java/lang/CharSequence
     868: aconst_null
     869: aconst_null
     870: iconst_0
     871: aconst_null
     872: aconst_null
     873: bipush        62
     875: aconst_null
     876: invokestatic  #127                // 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;
     879: getstatic     #94                 // Field java/lang/System.out:Ljava/io/PrintStream;
     882: swap
     883: invokevirtual #129                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     886: return

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

  private static final java.util.List<java.lang.String> readStrings();
    Code:
       0: invokestatic  #182                // Method readLn:()Ljava/lang/String;
       3: checkcast     #123                // class java/lang/CharSequence
       6: iconst_1
       7: anewarray     #184                // class java/lang/String
      10: astore_0
      11: aload_0
      12: iconst_0
      13: ldc           #121                // String
      15: aastore
      16: aload_0
      17: iconst_0
      18: iconst_0
      19: bipush        6
      21: aconst_null
      22: invokestatic  #190                // 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  #193                // Method readStrings:()Ljava/util/List;
       3: checkcast     #48                 // class java/lang/Iterable
       6: astore_0
       7: iconst_0
       8: istore_1
       9: aload_0
      10: astore_2
      11: new           #24                 // class java/util/ArrayList
      14: dup
      15: aload_0
      16: bipush        10
      18: invokestatic  #54                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      21: invokespecial #28                 // Method java/util/ArrayList."<init>":(I)V
      24: checkcast     #56                 // class java/util/Collection
      27: astore_3
      28: iconst_0
      29: istore        4
      31: aload_2
      32: invokeinterface #60,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      37: astore        5
      39: aload         5
      41: invokeinterface #66,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      46: ifeq          92
      49: aload         5
      51: invokeinterface #70,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      56: astore        6
      58: aload_3
      59: aload         6
      61: checkcast     #184                // class java/lang/String
      64: astore        7
      66: astore        9
      68: iconst_0
      69: istore        8
      71: aload         7
      73: invokestatic  #197                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      76: nop
      77: invokestatic  #42                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      80: aload         9
      82: swap
      83: invokeinterface #74,  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  #202                // Method main:()V
       3: return

  private static final void main$place(int[], java.util.List<kotlin.collections.IndexedValue<java.lang.Integer>>, int, int);
    Code:
       0: aload_1
       1: checkcast     #48                 // class java/lang/Iterable
       4: astore        4
       6: iload_2
       7: istore        5
       9: iconst_0
      10: istore        6
      12: iload         5
      14: istore        7
      16: aload         4
      18: invokeinterface #60,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      23: astore        8
      25: aload         8
      27: invokeinterface #66,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      32: ifeq          100
      35: aload         8
      37: invokeinterface #70,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      42: astore        9
      44: iload         7
      46: aload         9
      48: checkcast     #36                 // class kotlin/collections/IndexedValue
      51: astore        10
      53: istore        11
      55: iconst_0
      56: istore        12
      58: iload         11
      60: aload         10
      62: invokevirtual #73                 // Method kotlin/collections/IndexedValue.getValue:()Ljava/lang/Object;
      65: checkcast     #18                 // class java/lang/Number
      68: invokevirtual #22                 // Method java/lang/Number.intValue:()I
      71: iload_3
      72: imul
      73: iadd
      74: istore        13
      76: iload         13
      78: istore        14
      80: iconst_0
      81: istore        15
      83: aload_0
      84: aload         10
      86: invokevirtual #208                // Method kotlin/collections/IndexedValue.getIndex:()I
      89: iload         11
      91: iastore
      92: iload         13
      94: nop
      95: istore        7
      97: goto          25
     100: nop
     101: return
}


package codeforces.globalround5

fun main() {
	val n = readInt()
	val a = readInts()
	val b = a.plus(a).plus(a)
	val st = SegmentsTreeSimple(b)
	val r = IntArray(b.size)
	val ans = IntArray(b.size)
	for (i in b.indices.reversed()) {
		val v = b[i]
		var low = i + 1
		var high = b.size + 1
		while (low + 1 < high) {
			val mid = (low + high) / 2
			if (st.getMin(i + 1, mid) * 2 < v) {
				high = mid
			} else {
				low = mid
			}
		}
		r[i] = high - 1
		if (i + 1 < b.size) {
			r[i] = minOf(r[i], r[i + 1])
		}
		ans[i] = r[i] - i
		if (r[i] == b.size) ans[i] = -1
	}
	print(ans.take(n).joinToString(" "))
}

class SegmentsTreeSimple(data: List<Int>) {
	internal val min: IntArray
	internal var size: Int = 1

	init {
		while (size <= data.size) size *= 2
		min = IntArray(2 * size)
		System.arraycopy(data.toIntArray(), 0, min, size, data.size)
		for (i in size - 1 downTo 1) {
			min[i] = minOf(min[2 * i], min[2 * i + 1])
		}
	}

	internal fun getMin(from: Int, to: Int): Int {
		var f = from + size
		var t = to + size
		var res = Integer.MAX_VALUE
		while (f < t) {
			if (f % 2 == 1) {
				res = minOf(res, min[f])
				f++
			}
			if (t % 2 == 1) {
				t--
				res = minOf(res, min[t])
			}
			f /= 2
			t /= 2
		}
		return res
	}
}

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 codeforces.globalround5.DKt {
  public static final void main();
    Code:
       0: invokestatic  #10                 // Method readInt:()I
       3: istore_0
       4: invokestatic  #14                 // Method readInts:()Ljava/util/List;
       7: astore_1
       8: aload_1
       9: checkcast     #16                 // class java/util/Collection
      12: aload_1
      13: checkcast     #18                 // class java/lang/Iterable
      16: invokestatic  #24                 // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Iterable;)Ljava/util/List;
      19: checkcast     #16                 // class java/util/Collection
      22: aload_1
      23: checkcast     #18                 // class java/lang/Iterable
      26: invokestatic  #24                 // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Iterable;)Ljava/util/List;
      29: astore_2
      30: new           #26                 // class codeforces/globalround5/SegmentsTreeSimple
      33: dup
      34: aload_2
      35: invokespecial #30                 // Method codeforces/globalround5/SegmentsTreeSimple."<init>":(Ljava/util/List;)V
      38: astore_3
      39: aload_2
      40: invokeinterface #35,  1           // InterfaceMethod java/util/List.size:()I
      45: newarray       int
      47: astore        4
      49: aload_2
      50: invokeinterface #35,  1           // InterfaceMethod java/util/List.size:()I
      55: newarray       int
      57: astore        5
      59: aload_2
      60: checkcast     #16                 // class java/util/Collection
      63: invokeinterface #36,  1           // InterfaceMethod java/util/Collection.size:()I
      68: iconst_m1
      69: iadd
      70: istore        6
      72: iconst_0
      73: iload         6
      75: if_icmpgt     247
      78: iload         6
      80: istore        7
      82: iinc          6, -1
      85: aload_2
      86: iload         7
      88: invokeinterface #40,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      93: checkcast     #42                 // class java/lang/Number
      96: invokevirtual #45                 // Method java/lang/Number.intValue:()I
      99: istore        8
     101: iload         7
     103: iconst_1
     104: iadd
     105: istore        9
     107: aload_2
     108: invokeinterface #35,  1           // InterfaceMethod java/util/List.size:()I
     113: iconst_1
     114: iadd
     115: istore        10
     117: iload         9
     119: iconst_1
     120: iadd
     121: iload         10
     123: if_icmpge     166
     126: iload         9
     128: iload         10
     130: iadd
     131: iconst_2
     132: idiv
     133: istore        11
     135: aload_3
     136: iload         7
     138: iconst_1
     139: iadd
     140: iload         11
     142: invokevirtual #49                 // Method codeforces/globalround5/SegmentsTreeSimple.getMin$main:(II)I
     145: iconst_2
     146: imul
     147: iload         8
     149: if_icmpge     159
     152: iload         11
     154: istore        10
     156: goto          117
     159: iload         11
     161: istore        9
     163: goto          117
     166: aload         4
     168: iload         7
     170: iload         10
     172: iconst_1
     173: isub
     174: iastore
     175: iload         7
     177: iconst_1
     178: iadd
     179: aload_2
     180: invokeinterface #35,  1           // InterfaceMethod java/util/List.size:()I
     185: if_icmpge     208
     188: aload         4
     190: iload         7
     192: aload         4
     194: iload         7
     196: iaload
     197: aload         4
     199: iload         7
     201: iconst_1
     202: iadd
     203: iaload
     204: invokestatic  #54                 // Method java/lang/Math.min:(II)I
     207: iastore
     208: aload         5
     210: iload         7
     212: aload         4
     214: iload         7
     216: iaload
     217: iload         7
     219: isub
     220: iastore
     221: aload         4
     223: iload         7
     225: iaload
     226: aload_2
     227: invokeinterface #35,  1           // InterfaceMethod java/util/List.size:()I
     232: if_icmpne     241
     235: aload         5
     237: iload         7
     239: iconst_m1
     240: iastore
     241: iconst_0
     242: iload         6
     244: if_icmple     78
     247: aload         5
     249: iload_0
     250: invokestatic  #60                 // Method kotlin/collections/ArraysKt.take:([II)Ljava/util/List;
     253: checkcast     #18                 // class java/lang/Iterable
     256: ldc           #62                 // String
     258: checkcast     #64                 // class java/lang/CharSequence
     261: aconst_null
     262: aconst_null
     263: iconst_0
     264: aconst_null
     265: aconst_null
     266: bipush        62
     268: aconst_null
     269: invokestatic  #68                 // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
     272: getstatic     #74                 // Field java/lang/System.out:Ljava/io/PrintStream;
     275: swap
     276: invokevirtual #80                 // Method java/io/PrintStream.print:(Ljava/lang/Object;)V
     279: return

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

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

  private static final java.util.List<java.lang.String> readStrings();
    Code:
       0: invokestatic  #110                // Method readLn:()Ljava/lang/String;
       3: checkcast     #64                 // 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           #62                 // String
      15: aastore
      16: aload_0
      17: iconst_0
      18: iconst_0
      19: bipush        6
      21: aconst_null
      22: invokestatic  #126                // 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  #129                // Method readStrings:()Ljava/util/List;
       3: checkcast     #18                 // class java/lang/Iterable
       6: astore_0
       7: iconst_0
       8: istore_1
       9: aload_0
      10: astore_2
      11: new           #131                // class java/util/ArrayList
      14: dup
      15: aload_0
      16: bipush        10
      18: invokestatic  #135                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      21: invokespecial #138                // Method java/util/ArrayList."<init>":(I)V
      24: checkcast     #16                 // class java/util/Collection
      27: astore_3
      28: iconst_0
      29: istore        4
      31: aload_2
      32: invokeinterface #142,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      37: astore        5
      39: aload         5
      41: invokeinterface #148,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      46: ifeq          92
      49: aload         5
      51: invokeinterface #152,  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  #116                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      76: nop
      77: invokestatic  #156                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      80: aload         9
      82: swap
      83: invokeinterface #160,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      88: pop
      89: goto          39
      92: aload_3
      93: checkcast     #32                 // class java/util/List
      96: nop
      97: areturn

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


package codeforces.round614

import kotlin.math.abs

fun main() {
	val (x0, y0, ax, ay, bx, by) = readLongs()
	val (xs, ys, t) = readLongs()
	val points = mutableListOf(x0 to y0)
	while (true) {
		val (x, y) = ax * points.last().first + bx to ay * points.last().second + by
		if (xs + ys + t < x + y) break
		points.add(x to y)
	}
	val best = points.indices.mapNotNull { i ->
		points.indices.mapNotNull { j ->
			(abs(j - i) + 1).takeIf { dist(xs to ys, points[i]) + dist(points[i], points[j]) <= t }
		}.maxOrNull()
	}.maxOrNull() ?: 0
	println(best)
}

private fun dist(a: Pair<Long, Long>, b: Pair<Long, Long>): Long = abs(a.first - b.first) + abs(a.second - b.second)

private operator fun <E> List<E>.component6(): E = get(5)
private fun readLn() = readLine()!!
private fun readStrings() = readLn().split(" ")
private fun readLongs() = readStrings().map { it.toLong() }

Compiled from "b.kt"
public final class codeforces.round614.BKt {
  public static final void main();
    Code:
       0: invokestatic  #10                 // Method readLongs:()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.longValue:()J
      17: lstore_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.longValue:()J
      31: lstore_3
      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.longValue:()J
      45: lstore        5
      47: aload_0
      48: iconst_3
      49: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      54: checkcast     #18                 // class java/lang/Number
      57: invokevirtual #22                 // Method java/lang/Number.longValue:()J
      60: lstore        7
      62: aload_0
      63: iconst_4
      64: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      69: checkcast     #18                 // class java/lang/Number
      72: invokevirtual #22                 // Method java/lang/Number.longValue:()J
      75: lstore        9
      77: aload_0
      78: invokestatic  #26                 // Method component6:(Ljava/util/List;)Ljava/lang/Object;
      81: checkcast     #18                 // class java/lang/Number
      84: invokevirtual #22                 // Method java/lang/Number.longValue:()J
      87: lstore        11
      89: invokestatic  #10                 // Method readLongs:()Ljava/util/List;
      92: astore        13
      94: aload         13
      96: iconst_0
      97: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     102: checkcast     #18                 // class java/lang/Number
     105: invokevirtual #22                 // Method java/lang/Number.longValue:()J
     108: lstore        14
     110: aload         13
     112: iconst_1
     113: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     118: checkcast     #18                 // class java/lang/Number
     121: invokevirtual #22                 // Method java/lang/Number.longValue:()J
     124: lstore        16
     126: aload         13
     128: iconst_2
     129: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     134: checkcast     #18                 // class java/lang/Number
     137: invokevirtual #22                 // Method java/lang/Number.longValue:()J
     140: lstore        18
     142: iconst_1
     143: anewarray     #28                 // class kotlin/Pair
     146: astore        21
     148: aload         21
     150: iconst_0
     151: lload_1
     152: invokestatic  #34                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     155: lload_3
     156: invokestatic  #34                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     159: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     162: aastore
     163: aload         21
     165: invokestatic  #46                 // Method kotlin/collections/CollectionsKt.mutableListOf:([Ljava/lang/Object;)Ljava/util/List;
     168: astore        20
     170: nop
     171: lload         5
     173: aload         20
     175: invokestatic  #49                 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     178: checkcast     #28                 // class kotlin/Pair
     181: invokevirtual #53                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     184: checkcast     #18                 // class java/lang/Number
     187: invokevirtual #22                 // Method java/lang/Number.longValue:()J
     190: lmul
     191: lload         9
     193: ladd
     194: invokestatic  #34                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     197: lload         7
     199: aload         20
     201: invokestatic  #49                 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     204: checkcast     #28                 // class kotlin/Pair
     207: invokevirtual #56                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     210: checkcast     #18                 // class java/lang/Number
     213: invokevirtual #22                 // Method java/lang/Number.longValue:()J
     216: lmul
     217: lload         11
     219: ladd
     220: invokestatic  #34                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     223: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     226: astore        21
     228: aload         21
     230: invokevirtual #59                 // Method kotlin/Pair.component1:()Ljava/lang/Object;
     233: checkcast     #18                 // class java/lang/Number
     236: invokevirtual #22                 // Method java/lang/Number.longValue:()J
     239: lstore        22
     241: aload         21
     243: invokevirtual #62                 // Method kotlin/Pair.component2:()Ljava/lang/Object;
     246: checkcast     #18                 // class java/lang/Number
     249: invokevirtual #22                 // Method java/lang/Number.longValue:()J
     252: lstore        24
     254: lload         14
     256: lload         16
     258: ladd
     259: lload         18
     261: ladd
     262: lload         22
     264: lload         24
     266: ladd
     267: lcmp
     268: iflt          295
     271: aload         20
     273: lload         22
     275: invokestatic  #34                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     278: lload         24
     280: invokestatic  #34                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     283: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     286: invokeinterface #66,  2           // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     291: pop
     292: goto          170
     295: aload         20
     297: checkcast     #68                 // class java/util/Collection
     300: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.getIndices:(Ljava/util/Collection;)Lkotlin/ranges/IntRange;
     303: checkcast     #74                 // class java/lang/Iterable
     306: astore        23
     308: iconst_0
     309: istore        24
     311: aload         23
     313: astore        25
     315: new           #76                 // class java/util/ArrayList
     318: dup
     319: invokespecial #79                 // Method java/util/ArrayList."<init>":()V
     322: checkcast     #68                 // class java/util/Collection
     325: astore        26
     327: iconst_0
     328: istore        27
     330: aload         25
     332: astore        28
     334: iconst_0
     335: istore        29
     337: aload         28
     339: invokeinterface #83,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     344: astore        30
     346: aload         30
     348: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     353: ifeq          640
     356: aload         30
     358: checkcast     #91                 // class kotlin/collections/IntIterator
     361: invokevirtual #95                 // Method kotlin/collections/IntIterator.nextInt:()I
     364: istore        31
     366: iload         31
     368: istore        32
     370: iconst_0
     371: istore        33
     373: iload         32
     375: istore        34
     377: iconst_0
     378: istore        35
     380: aload         20
     382: checkcast     #68                 // class java/util/Collection
     385: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.getIndices:(Ljava/util/Collection;)Lkotlin/ranges/IntRange;
     388: checkcast     #74                 // class java/lang/Iterable
     391: astore        36
     393: iconst_0
     394: istore        37
     396: aload         36
     398: astore        38
     400: new           #76                 // class java/util/ArrayList
     403: dup
     404: invokespecial #79                 // Method java/util/ArrayList."<init>":()V
     407: checkcast     #68                 // class java/util/Collection
     410: astore        39
     412: iconst_0
     413: istore        40
     415: aload         38
     417: astore        41
     419: iconst_0
     420: istore        42
     422: aload         41
     424: invokeinterface #83,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     429: astore        43
     431: aload         43
     433: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     438: ifeq          597
     441: aload         43
     443: checkcast     #91                 // class kotlin/collections/IntIterator
     446: invokevirtual #95                 // Method kotlin/collections/IntIterator.nextInt:()I
     449: istore        44
     451: iload         44
     453: istore        45
     455: iconst_0
     456: istore        46
     458: iload         45
     460: istore        47
     462: iconst_0
     463: istore        48
     465: iload         47
     467: iload         34
     469: isub
     470: invokestatic  #101                // Method java/lang/Math.abs:(I)I
     473: iconst_1
     474: iadd
     475: invokestatic  #106                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     478: astore        49
     480: aload         49
     482: checkcast     #18                 // class java/lang/Number
     485: invokevirtual #109                // Method java/lang/Number.intValue:()I
     488: istore        50
     490: iconst_0
     491: istore        51
     493: lload         14
     495: invokestatic  #34                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     498: lload         16
     500: invokestatic  #34                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     503: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     506: aload         20
     508: iload         34
     510: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     515: checkcast     #28                 // class kotlin/Pair
     518: invokestatic  #113                // Method dist:(Lkotlin/Pair;Lkotlin/Pair;)J
     521: aload         20
     523: iload         34
     525: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     530: checkcast     #28                 // class kotlin/Pair
     533: aload         20
     535: iload         47
     537: invokeinterface #16,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     542: checkcast     #28                 // class kotlin/Pair
     545: invokestatic  #113                // Method dist:(Lkotlin/Pair;Lkotlin/Pair;)J
     548: ladd
     549: lload         18
     551: lcmp
     552: ifgt          559
     555: iconst_1
     556: goto          560
     559: iconst_0
     560: ifeq          568
     563: aload         49
     565: goto          569
     568: aconst_null
     569: nop
     570: dup
     571: ifnull        592
     574: astore        52
     576: iconst_0
     577: istore        53
     579: aload         39
     581: aload         52
     583: invokeinterface #114,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     588: pop
     589: goto          593
     592: pop
     593: nop
     594: goto          431
     597: nop
     598: aload         39
     600: checkcast     #12                 // class java/util/List
     603: nop
     604: checkcast     #74                 // class java/lang/Iterable
     607: invokestatic  #118                // Method kotlin/collections/CollectionsKt.maxOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     610: checkcast     #103                // class java/lang/Integer
     613: dup
     614: ifnull        635
     617: astore        54
     619: iconst_0
     620: istore        55
     622: aload         26
     624: aload         54
     626: invokeinterface #114,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     631: pop
     632: goto          636
     635: pop
     636: nop
     637: goto          346
     640: nop
     641: aload         26
     643: checkcast     #12                 // class java/util/List
     646: nop
     647: checkcast     #74                 // class java/lang/Iterable
     650: invokestatic  #118                // Method kotlin/collections/CollectionsKt.maxOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     653: checkcast     #103                // class java/lang/Integer
     656: dup
     657: ifnull        666
     660: invokevirtual #119                // Method java/lang/Integer.intValue:()I
     663: goto          668
     666: pop
     667: iconst_0
     668: istore        21
     670: getstatic     #125                // Field java/lang/System.out:Ljava/io/PrintStream;
     673: iload         21
     675: invokevirtual #131                // Method java/io/PrintStream.println:(I)V
     678: return

  private static final long dist(kotlin.Pair<java.lang.Long, java.lang.Long>, kotlin.Pair<java.lang.Long, java.lang.Long>);
    Code:
       0: aload_0
       1: invokevirtual #53                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
       4: checkcast     #18                 // class java/lang/Number
       7: invokevirtual #22                 // Method java/lang/Number.longValue:()J
      10: aload_1
      11: invokevirtual #53                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      14: checkcast     #18                 // class java/lang/Number
      17: invokevirtual #22                 // Method java/lang/Number.longValue:()J
      20: lsub
      21: invokestatic  #172                // Method java/lang/Math.abs:(J)J
      24: aload_0
      25: invokevirtual #56                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      28: checkcast     #18                 // class java/lang/Number
      31: invokevirtual #22                 // Method java/lang/Number.longValue:()J
      34: aload_1
      35: invokevirtual #56                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      38: checkcast     #18                 // class java/lang/Number
      41: invokevirtual #22                 // Method java/lang/Number.longValue:()J
      44: lsub
      45: invokestatic  #172                // Method java/lang/Math.abs:(J)J
      48: ladd
      49: lreturn

  private static final <E> E component6(java.util.List<? extends E>);
    Code:
       0: aload_0
       1: ldc           #178                // String <this>
       3: invokestatic  #184                // 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

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

  private static final java.util.List<java.lang.String> readStrings();
    Code:
       0: invokestatic  #200                // Method readLn:()Ljava/lang/String;
       3: checkcast     #202                // class java/lang/CharSequence
       6: iconst_1
       7: anewarray     #204                // class java/lang/String
      10: astore_0
      11: aload_0
      12: iconst_0
      13: ldc           #206                // String
      15: aastore
      16: aload_0
      17: iconst_0
      18: iconst_0
      19: bipush        6
      21: aconst_null
      22: invokestatic  #212                // 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  #215                // Method readStrings:()Ljava/util/List;
       3: checkcast     #74                 // class java/lang/Iterable
       6: astore_0
       7: iconst_0
       8: istore_1
       9: aload_0
      10: astore_2
      11: new           #76                 // class java/util/ArrayList
      14: dup
      15: aload_0
      16: bipush        10
      18: invokestatic  #219                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      21: invokespecial #221                // Method java/util/ArrayList."<init>":(I)V
      24: checkcast     #68                 // class java/util/Collection
      27: astore_3
      28: iconst_0
      29: istore        4
      31: aload_2
      32: invokeinterface #83,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      37: astore        5
      39: aload         5
      41: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      46: ifeq          92
      49: aload         5
      51: invokeinterface #224,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      56: astore        6
      58: aload_3
      59: aload         6
      61: checkcast     #204                // class java/lang/String
      64: astore        7
      66: astore        9
      68: iconst_0
      69: istore        8
      71: aload         7
      73: invokestatic  #228                // Method java/lang/Long.parseLong:(Ljava/lang/String;)J
      76: nop
      77: invokestatic  #34                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      80: aload         9
      82: swap
      83: invokeinterface #114,  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  #238                // Method main:()V
       3: return
}


package codeforces.round614

fun main() {
	val n = readInt()
	val nei = List(n) { mutableListOf<Int>() }
	repeat(n - 1) {
		val (a, b) = readInts().map { it - 1 }
		nei[a].add(b); nei[b].add(a)
	}
	val par = List(n) { IntArray(n) { 0 } }
	val count = List(n) { IntArray(n) { 1 } }
	for (root in nei.indices) {
		fun dfs(u: Int, p: Int) {
			par[root][u] = p
			for (v in nei[u]) if (v != p) {
				dfs(v, u)
				count[root][u] += count[root][v]
			}
		}
		dfs(root, -1)
	}
	val a = List(n) { LongArray(n) { -1 } }
	fun solve(u: Int, v: Int): Long {
		if (u == v) return 0
		if (a[u][v] == -1L) a[u][v] = maxOf(solve(par[v][u], v), solve(u, par[u][v])) + count[v][u] * count[u][v]
		return a[u][v]
	}
	println(nei.indices.map { u -> nei.indices.maxOf { v -> solve(u, v) } }.maxOrNull())
}

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

Compiled from "c.kt"
public final class codeforces.round614.CKt {
  public static final void main();
    Code:
       0: invokestatic  #10                 // Method readInt:()I
       3: istore_0
       4: new           #12                 // class java/util/ArrayList
       7: dup
       8: iload_0
       9: invokespecial #16                 // Method java/util/ArrayList."<init>":(I)V
      12: astore_2
      13: iconst_0
      14: istore_3
      15: iload_3
      16: iload_0
      17: if_icmpge     57
      20: iload_3
      21: istore        4
      23: aload_2
      24: iload         4
      26: istore        5
      28: astore        20
      30: iconst_0
      31: istore        6
      33: new           #12                 // class java/util/ArrayList
      36: dup
      37: invokespecial #18                 // Method java/util/ArrayList."<init>":()V
      40: checkcast     #20                 // class java/util/List
      43: nop
      44: aload         20
      46: swap
      47: invokevirtual #24                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      50: pop
      51: iinc          3, 1
      54: goto          15
      57: aload_2
      58: checkcast     #20                 // class java/util/List
      61: astore_1
      62: iload_0
      63: iconst_1
      64: isub
      65: istore_2
      66: iconst_0
      67: istore_3
      68: iload_3
      69: iload_2
      70: if_icmpge     271
      73: iload_3
      74: istore        4
      76: iconst_0
      77: istore        5
      79: invokestatic  #28                 // Method readInts:()Ljava/util/List;
      82: checkcast     #30                 // class java/lang/Iterable
      85: astore        6
      87: iconst_0
      88: istore        7
      90: aload         6
      92: astore        8
      94: new           #12                 // class java/util/ArrayList
      97: dup
      98: aload         6
     100: bipush        10
     102: invokestatic  #36                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     105: invokespecial #16                 // Method java/util/ArrayList."<init>":(I)V
     108: checkcast     #38                 // class java/util/Collection
     111: astore        9
     113: iconst_0
     114: istore        10
     116: aload         8
     118: invokeinterface #42,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     123: astore        11
     125: aload         11
     127: invokeinterface #48,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     132: ifeq          180
     135: aload         11
     137: invokeinterface #52,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     142: astore        12
     144: aload         9
     146: aload         12
     148: checkcast     #54                 // class java/lang/Number
     151: invokevirtual #57                 // Method java/lang/Number.intValue:()I
     154: istore        13
     156: astore        14
     158: iconst_0
     159: istore        15
     161: iload         13
     163: iconst_1
     164: isub
     165: invokestatic  #63                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     168: aload         14
     170: swap
     171: invokeinterface #64,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     176: pop
     177: goto          125
     180: aload         9
     182: checkcast     #20                 // class java/util/List
     185: nop
     186: astore        17
     188: aload         17
     190: iconst_0
     191: invokeinterface #68,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     196: checkcast     #54                 // class java/lang/Number
     199: invokevirtual #57                 // Method java/lang/Number.intValue:()I
     202: istore        6
     204: aload         17
     206: iconst_1
     207: invokeinterface #68,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     212: checkcast     #54                 // class java/lang/Number
     215: invokevirtual #57                 // Method java/lang/Number.intValue:()I
     218: istore        7
     220: aload_1
     221: iload         6
     223: invokeinterface #68,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     228: checkcast     #20                 // class java/util/List
     231: iload         7
     233: invokestatic  #63                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     236: invokeinterface #69,  2           // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     241: pop
     242: aload_1
     243: iload         7
     245: invokeinterface #68,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     250: checkcast     #20                 // class java/util/List
     253: iload         6
     255: invokestatic  #63                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     258: invokeinterface #69,  2           // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     263: pop
     264: nop
     265: iinc          3, 1
     268: goto          68
     271: new           #12                 // class java/util/ArrayList
     274: dup
     275: iload_0
     276: invokespecial #16                 // Method java/util/ArrayList."<init>":(I)V
     279: astore_3
     280: iconst_0
     281: istore        4
     283: iload         4
     285: iload_0
     286: if_icmpge     348
     289: iload         4
     291: istore        5
     293: aload_3
     294: iload         5
     296: istore        6
     298: astore        20
     300: iconst_0
     301: istore        7
     303: iconst_0
     304: istore        8
     306: iload_0
     307: newarray       int
     309: astore        9
     311: iload         8
     313: iload_0
     314: if_icmpge     333
     317: iload         8
     319: istore        10
     321: aload         9
     323: iload         10
     325: iconst_0
     326: iastore
     327: iinc          8, 1
     330: goto          311
     333: aload         9
     335: aload         20
     337: swap
     338: invokevirtual #24                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     341: pop
     342: iinc          4, 1
     345: goto          283
     348: aload_3
     349: checkcast     #20                 // class java/util/List
     352: astore_2
     353: new           #12                 // class java/util/ArrayList
     356: dup
     357: iload_0
     358: invokespecial #16                 // Method java/util/ArrayList."<init>":(I)V
     361: astore        4
     363: iconst_0
     364: istore        5
     366: iload         5
     368: iload_0
     369: if_icmpge     432
     372: iload         5
     374: istore        6
     376: aload         4
     378: iload         6
     380: istore        7
     382: astore        20
     384: iconst_0
     385: istore        8
     387: iconst_0
     388: istore        9
     390: iload_0
     391: newarray       int
     393: astore        10
     395: iload         9
     397: iload_0
     398: if_icmpge     417
     401: iload         9
     403: istore        11
     405: aload         10
     407: iload         11
     409: iconst_1
     410: iastore
     411: iinc          9, 1
     414: goto          395
     417: aload         10
     419: aload         20
     421: swap
     422: invokevirtual #24                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     425: pop
     426: iinc          5, 1
     429: goto          366
     432: aload         4
     434: checkcast     #20                 // class java/util/List
     437: astore_3
     438: iconst_0
     439: istore        4
     441: aload_1
     442: checkcast     #38                 // class java/util/Collection
     445: invokeinterface #72,  1           // InterfaceMethod java/util/Collection.size:()I
     450: istore        5
     452: iload         4
     454: iload         5
     456: if_icmpge     476
     459: aload_2
     460: iload         4
     462: aload_1
     463: aload_3
     464: iload         4
     466: iconst_m1
     467: invokestatic  #76                 // Method main$dfs:(Ljava/util/List;ILjava/util/List;Ljava/util/List;II)V
     470: iinc          4, 1
     473: goto          452
     476: new           #12                 // class java/util/ArrayList
     479: dup
     480: iload_0
     481: invokespecial #16                 // Method java/util/ArrayList."<init>":(I)V
     484: astore        5
     486: iconst_0
     487: istore        6
     489: iload         6
     491: iload_0
     492: if_icmpge     557
     495: iload         6
     497: istore        7
     499: aload         5
     501: iload         7
     503: istore        8
     505: astore        20
     507: iconst_0
     508: istore        9
     510: iconst_0
     511: istore        10
     513: iload_0
     514: newarray       long
     516: astore        11
     518: iload         10
     520: iload_0
     521: if_icmpge     542
     524: iload         10
     526: istore        12
     528: aload         11
     530: iload         12
     532: ldc2_w        #77                 // long -1l
     535: lastore
     536: iinc          10, 1
     539: goto          518
     542: aload         11
     544: aload         20
     546: swap
     547: invokevirtual #24                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     550: pop
     551: iinc          6, 1
     554: goto          489
     557: aload         5
     559: checkcast     #20                 // class java/util/List
     562: astore        4
     564: aload_1
     565: checkcast     #38                 // class java/util/Collection
     568: invokestatic  #82                 // Method kotlin/collections/CollectionsKt.getIndices:(Ljava/util/Collection;)Lkotlin/ranges/IntRange;
     571: checkcast     #30                 // class java/lang/Iterable
     574: astore        5
     576: iconst_0
     577: istore        6
     579: aload         5
     581: astore        7
     583: new           #12                 // class java/util/ArrayList
     586: dup
     587: aload         5
     589: bipush        10
     591: invokestatic  #36                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     594: invokespecial #16                 // Method java/util/ArrayList."<init>":(I)V
     597: checkcast     #38                 // class java/util/Collection
     600: astore        8
     602: iconst_0
     603: istore        9
     605: aload         7
     607: invokeinterface #42,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     612: astore        10
     614: aload         10
     616: invokeinterface #48,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     621: ifeq          775
     624: aload         10
     626: checkcast     #84                 // class kotlin/collections/IntIterator
     629: invokevirtual #87                 // Method kotlin/collections/IntIterator.nextInt:()I
     632: istore        11
     634: aload         8
     636: iload         11
     638: istore        12
     640: astore        20
     642: iconst_0
     643: istore        13
     645: aload_1
     646: checkcast     #38                 // class java/util/Collection
     649: invokestatic  #82                 // Method kotlin/collections/CollectionsKt.getIndices:(Ljava/util/Collection;)Lkotlin/ranges/IntRange;
     652: checkcast     #30                 // class java/lang/Iterable
     655: invokeinterface #42,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     660: astore        14
     662: aload         14
     664: invokeinterface #48,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     669: ifne          680
     672: new           #89                 // class java/util/NoSuchElementException
     675: dup
     676: invokespecial #90                 // Method java/util/NoSuchElementException."<init>":()V
     679: athrow
     680: aload         14
     682: checkcast     #84                 // class kotlin/collections/IntIterator
     685: invokevirtual #87                 // Method kotlin/collections/IntIterator.nextInt:()I
     688: istore        15
     690: iconst_0
     691: istore        17
     693: aload         4
     695: aload_2
     696: aload_3
     697: iload         12
     699: iload         15
     701: invokestatic  #94                 // Method main$solve:(Ljava/util/List;Ljava/util/List;Ljava/util/List;II)J
     704: lstore        15
     706: aload         14
     708: invokeinterface #48,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     713: ifeq          757
     716: aload         14
     718: checkcast     #84                 // class kotlin/collections/IntIterator
     721: invokevirtual #87                 // Method kotlin/collections/IntIterator.nextInt:()I
     724: istore        17
     726: iconst_0
     727: istore        19
     729: aload         4
     731: aload_2
     732: aload_3
     733: iload         12
     735: iload         17
     737: invokestatic  #94                 // Method main$solve:(Ljava/util/List;Ljava/util/List;Ljava/util/List;II)J
     740: lstore        17
     742: lload         15
     744: lload         17
     746: lcmp
     747: ifge          706
     750: lload         17
     752: lstore        15
     754: goto          706
     757: lload         15
     759: nop
     760: invokestatic  #99                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     763: aload         20
     765: swap
     766: invokeinterface #64,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     771: pop
     772: goto          614
     775: aload         8
     777: checkcast     #20                 // class java/util/List
     780: nop
     781: checkcast     #30                 // class java/lang/Iterable
     784: invokestatic  #103                // Method kotlin/collections/CollectionsKt.maxOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     787: getstatic     #109                // Field java/lang/System.out:Ljava/io/PrintStream;
     790: swap
     791: invokevirtual #115                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     794: return

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

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

  private static final java.util.List<java.lang.String> readStrings();
    Code:
       0: invokestatic  #162                // Method readLn:()Ljava/lang/String;
       3: checkcast     #170                // class java/lang/CharSequence
       6: iconst_1
       7: anewarray     #172                // class java/lang/String
      10: astore_0
      11: aload_0
      12: iconst_0
      13: ldc           #174                // String
      15: aastore
      16: aload_0
      17: iconst_0
      18: iconst_0
      19: bipush        6
      21: aconst_null
      22: invokestatic  #180                // 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  #183                // 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           #12                 // class java/util/ArrayList
      14: dup
      15: aload_0
      16: bipush        10
      18: invokestatic  #36                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      21: invokespecial #16                 // Method java/util/ArrayList."<init>":(I)V
      24: checkcast     #38                 // class java/util/Collection
      27: astore_3
      28: iconst_0
      29: istore        4
      31: aload_2
      32: invokeinterface #42,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      37: astore        5
      39: aload         5
      41: invokeinterface #48,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      46: ifeq          92
      49: aload         5
      51: invokeinterface #52,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      56: astore        6
      58: aload_3
      59: aload         6
      61: checkcast     #172                // class java/lang/String
      64: astore        7
      66: astore        9
      68: iconst_0
      69: istore        8
      71: aload         7
      73: invokestatic  #166                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      76: nop
      77: invokestatic  #63                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      80: aload         9
      82: swap
      83: invokeinterface #64,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      88: pop
      89: goto          39
      92: aload_3
      93: checkcast     #20                 // class java/util/List
      96: nop
      97: areturn

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

  private static final void main$dfs(java.util.List<int[]>, int, java.util.List<? extends java.util.List<java.lang.Integer>>, java.util.List<int[]>, int, int);
    Code:
       0: aload_0
       1: iload_1
       2: invokeinterface #68,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
       7: checkcast     #146                // class "[I"
      10: iload         4
      12: iload         5
      14: iastore
      15: aload_2
      16: iload         4
      18: invokeinterface #68,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      23: checkcast     #20                 // class java/util/List
      26: invokeinterface #192,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
      31: astore        6
      33: aload         6
      35: invokeinterface #48,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      40: ifeq          115
      43: aload         6
      45: invokeinterface #52,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      50: checkcast     #54                 // class java/lang/Number
      53: invokevirtual #57                 // Method java/lang/Number.intValue:()I
      56: istore        7
      58: iload         7
      60: iload         5
      62: if_icmpeq     33
      65: aload_0
      66: iload_1
      67: aload_2
      68: aload_3
      69: iload         7
      71: iload         4
      73: invokestatic  #76                 // Method main$dfs:(Ljava/util/List;ILjava/util/List;Ljava/util/List;II)V
      76: aload_3
      77: iload_1
      78: invokeinterface #68,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      83: checkcast     #146                // class "[I"
      86: astore        8
      88: aload         8
      90: iload         4
      92: aload         8
      94: iload         4
      96: iaload
      97: aload_3
      98: iload_1
      99: invokeinterface #68,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     104: checkcast     #146                // class "[I"
     107: iload         7
     109: iaload
     110: iadd
     111: iastore
     112: goto          33
     115: return

  private static final long main$solve(java.util.List<long[]>, java.util.List<int[]>, java.util.List<int[]>, int, int);
    Code:
       0: iload_3
       1: iload         4
       3: if_icmpne     8
       6: lconst_0
       7: lreturn
       8: aload_0
       9: iload_3
      10: invokeinterface #68,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      15: checkcast     #148                // class "[J"
      18: iload         4
      20: laload
      21: ldc2_w        #77                 // long -1l
      24: lcmp
      25: ifne          114
      28: aload_0
      29: iload_3
      30: invokeinterface #68,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      35: checkcast     #148                // class "[J"
      38: iload         4
      40: aload_0
      41: aload_1
      42: aload_2
      43: aload_1
      44: iload         4
      46: invokeinterface #68,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      51: checkcast     #146                // class "[I"
      54: iload_3
      55: iaload
      56: iload         4
      58: invokestatic  #94                 // Method main$solve:(Ljava/util/List;Ljava/util/List;Ljava/util/List;II)J
      61: aload_0
      62: aload_1
      63: aload_2
      64: iload_3
      65: aload_1
      66: iload_3
      67: invokeinterface #68,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      72: checkcast     #146                // class "[I"
      75: iload         4
      77: iaload
      78: invokestatic  #94                 // Method main$solve:(Ljava/util/List;Ljava/util/List;Ljava/util/List;II)J
      81: invokestatic  #200                // Method java/lang/Math.max:(JJ)J
      84: aload_2
      85: iload         4
      87: invokeinterface #68,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      92: checkcast     #146                // class "[I"
      95: iload_3
      96: iaload
      97: aload_2
      98: iload_3
      99: invokeinterface #68,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     104: checkcast     #146                // class "[I"
     107: iload         4
     109: iaload
     110: imul
     111: i2l
     112: ladd
     113: lastore
     114: aload_0
     115: iload_3
     116: invokeinterface #68,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     121: checkcast     #148                // class "[J"
     124: iload         4
     126: laload
     127: lreturn
}