kt_path
stringlengths
35
167
kt_source
stringlengths
626
28.9k
classes
listlengths
1
17
mikhail-dvorkin__competitions__3095312/codeforces/round901/a.kt
package codeforces.round901 private fun solve(): Long { val (_, _, k) = readInts() val (a, b) = List(2) { readInts().toMutableList() } val moves = mutableListOf<Long>() var i = 0 while (i < k) { val move = if (i % 2 == 0) makeMove(a, b) else makeMove(b, a) moves.add(move) if (i >= 4 && moves[moves.size - 1]...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round901/AKt.class", "javap": "Compiled from \"a.kt\"\npublic final class codeforces.round901.AKt {\n private static final long solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n 3...
mikhail-dvorkin__competitions__3095312/codeforces/round901/d.kt
package codeforces.round901 private fun solve(): Double { val (n, m) = readInts() val d = List(n + 1) { DoubleArray(m - n + 1) } for (i in 1..n) { var kPrevBest = 0 for (s in d[i].indices) { val range = maxOf(kPrevBest - 56, 0)..minOf(kPrevBest + 1, s) val (kBest, best) = range.minByAndValue { k -> (i + s...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round901/DKt$solve$$inlined$minByAndValue$1.class", "javap": "Compiled from \"d.kt\"\npublic final class codeforces.round901.DKt$solve$$inlined$minByAndValue$1 implements kotlin.jvm.functions.Function1<java.lang.Integer, kotlin.Pair<? extend...
mikhail-dvorkin__competitions__3095312/codeforces/round752/c.kt
package codeforces.round752 const val M = 998244353 private fun solve(): Long { readLn() val a = readInts() val memoNext = IntArray(a.size) val memoValue = LongArray(a.size) fun solve(i: Int, next: Int): Long { if (i == -1) return 0 if (memoNext[i] == next) return memoValue[i] val countHere = (a[i] + next...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round752/CKt.class", "javap": "Compiled from \"c.kt\"\npublic final class codeforces.round752.CKt {\n public static final int M;\n\n private static final long solve();\n Code:\n 0: invokestatic #10 // Method readL...
mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes6/practice/g.kt
package codeforces.kotlinheroes6.practice fun main() { val (_, m) = readInts() val a = readLongs() val capital = a.withIndex().minByOrNull { it.value }!!.index data class Edge(val u: Int, val v: Int, val weight: Long) val edges = List(m) { val (uIn, vIn, weight) = readLongs() Edge((uIn - 1).toInt(), (vIn - 1)...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes6/practice/GKt$main$Edge.class", "javap": "Compiled from \"g.kt\"\npublic final class codeforces.kotlinheroes6.practice.GKt$main$Edge {\n private final int u;\n\n private final int v;\n\n private final long weight;\n\n public...
mikhail-dvorkin__competitions__3095312/codeforces/vk2022/qual/d1.kt
package codeforces.vk2022.qual const val VALUES = "6789TJQKA" const val SUITS = "CDSH" val INIT = VALUES.indexOf('9') fun main() { val totalCards = VALUES.length * SUITS.length val allCardsList = (0 until totalCards).toList() val aliceList = readStrings().map { parseCard(it) } val bobList = allCardsList - aliceLi...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/codeforces/vk2022/qual/D1Kt.class", "javap": "Compiled from \"d1.kt\"\npublic final class codeforces.vk2022.qual.D1Kt {\n public static final java.lang.String VALUES;\n\n public static final java.lang.String SUITS;\n\n private static final int INIT;...
mikhail-dvorkin__competitions__3095312/codeforces/vk2022/qual/c.kt
package codeforces.vk2022.qual private fun solve() { readln() val a = readInts() var ans = 1 var nextHigh = a.last() + 1 val seen = mutableSetOf<Pair<Int, Int>>() for (i in a.indices.reversed()) { for (t in 1 downTo 0) { val high = a[i] + t if (high > nextHigh) continue nextHigh = nextHigh.coerceAtMos...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/codeforces/vk2022/qual/CKt.class", "javap": "Compiled from \"c.kt\"\npublic final class codeforces.vk2022.qual.CKt {\n private static final void solve();\n Code:\n 0: invokestatic #12 // Method kotlin/io/ConsoleKt.readln:()Lj...
mikhail-dvorkin__competitions__3095312/codeforces/vk2022/round1/c.kt
package codeforces.vk2022.round1 const val M = 26 private fun solve() { readln() val s = readln().map { it - 'a' }.toIntArray() val count = IntArray(M) for (c in s) count[c]++ val byFreq = count.indices.sortedByDescending { count[it] } var answer = s.size + 1 var answerString = "" val a = IntArray(s.size) va...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/codeforces/vk2022/round1/CKt.class", "javap": "Compiled from \"c.kt\"\npublic final class codeforces.vk2022.round1.CKt {\n public static final int M;\n\n private static final void solve();\n Code:\n 0: invokestatic #12 // Me...
mikhail-dvorkin__competitions__3095312/codeforces/vk2022/round1/h1_to_upsolve.kt
package codeforces.vk2022.round1 import kotlin.time.ExperimentalTime import kotlin.time.measureTime private fun solve() { val (h, w, k) = readInts() val zero = 0.toModular() val one = 1.toModular() val broken = List(k) { readInts().map { it - 1 } } val powerOfTwo = Array(h * w + 1) { one } for (i in 1 until pow...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/codeforces/vk2022/round1/H1_to_upsolveKt.class", "javap": "Compiled from \"h1_to_upsolve.kt\"\npublic final class codeforces.vk2022.round1.H1_to_upsolveKt {\n private static final void solve();\n Code:\n 0: invokestatic #10 /...
mikhail-dvorkin__competitions__3095312/codeforces/vk2022/round1/d.kt
package codeforces.vk2022.round1 import kotlin.math.roundToLong import kotlin.math.sqrt private fun solve() { readln() val a = readInts() var ans = 1 val toTest = mutableSetOf<Long>() for (i in a.indices) for (j in 0 until i) { val ba = a[i] - a[j] for (d in 1..ba) { if (d * d > ba) break if (ba % d !=...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/codeforces/vk2022/round1/DKt.class", "javap": "Compiled from \"d.kt\"\npublic final class codeforces.vk2022.round1.DKt {\n private static final void solve();\n Code:\n 0: invokestatic #12 // Method kotlin/io/ConsoleKt.readln:...
mikhail-dvorkin__competitions__3095312/codeforces/vk2022/round1/f.kt
package codeforces.vk2022.round1 fun main() { val (n, qIn) = readInts() val pOpenClose = qIn / 10_000.toModular() val one = 1.toModular() val pCloseOpen = one - pOpenClose val cnk = List(n + 1) { i -> Array(i + 1) { one } } for (i in cnk.indices) { for (j in 1 until i) { cnk[i][j] = cnk[i - 1][j - 1] + cnk...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/codeforces/vk2022/round1/FKt.class", "javap": "Compiled from \"f.kt\"\npublic final class codeforces.vk2022.round1.FKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n...
mikhail-dvorkin__competitions__3095312/codeforces/vk2021/qual/e12.kt
package codeforces.vk2021.qual private fun permutation(comparisons: List<Boolean>, n: Int): Pair<Int, List<Int>> { var pos = 0 fun permutation(m: Int): List<Int> { if (m <= 1) return List(m) { 0 } val left = m / 2 val right = m - left val permutationLeft = permutation(left) val permutationRight = permutati...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/codeforces/vk2021/qual/E12Kt.class", "javap": "Compiled from \"e12.kt\"\npublic final class codeforces.vk2021.qual.E12Kt {\n private static final kotlin.Pair<java.lang.Integer, java.util.List<java.lang.Integer>> permutation(java.util.List<java.lang.Bo...
mikhail-dvorkin__competitions__3095312/codeforces/vk2021/qual/ad.kt
package codeforces.vk2021.qual fun main() { val words = "lock, unlock, red, orange, yellow, green, blue, indigo, violet".split(", ") val wordsMap = words.withIndex().associate { it.value to it.index } val init = List(readInt()) { wordsMap[readLn()]!! } val st = SegmentsTreeSimple(init.size) for (i in init.indices...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/codeforces/vk2021/qual/AdKt.class", "javap": "Compiled from \"ad.kt\"\npublic final class codeforces.vk2021.qual.AdKt {\n public static final void main();\n Code:\n 0: ldc #8 // String lock, unlock, red, orange, yel...
mikhail-dvorkin__competitions__3095312/codeforces/vk2021/qual/e3_slow.kt
package codeforces.vk2021.qual import kotlin.math.log2 import kotlin.math.roundToInt private fun permutation(comparisons: List<Boolean>, n: Int): Pair<Int, List<Int>> { var pos = 0 fun permutation(m: Int): List<Int> { if (m <= 1) return List(m) { 0 } val left = m / 2 val right = m - left val permutationLeft...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/codeforces/vk2021/qual/E3_slowKt.class", "javap": "Compiled from \"e3_slow.kt\"\npublic final class codeforces.vk2021.qual.E3_slowKt {\n private static final kotlin.Pair<java.lang.Integer, java.util.List<java.lang.Integer>> permutation(java.util.List<...
mikhail-dvorkin__competitions__3095312/codeforces/vk2021/round1/d.kt
package codeforces.vk2021.round1 import kotlin.random.Random import kotlin.system.exitProcess private fun solveSmart(a: List<Int>): List<Int> { val used = BooleanArray(a.size) val ans = IntArray(a.size) { -1 } for (i in a.indices) { if (a[i] == i) continue if (used[a[i]]) continue used[a[i]] = true ans[i] ...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/codeforces/vk2021/round1/DKt.class", "javap": "Compiled from \"d.kt\"\npublic final class codeforces.vk2021.round1.DKt {\n private static final java.util.List<java.lang.Integer> solveSmart(java.util.List<java.lang.Integer>);\n Code:\n 0: aloa...
mikhail-dvorkin__competitions__3095312/marathons/icpcchallenge/y2020_huaweiGraphMining/a.kt
package marathons.icpcchallenge.y2020_huaweiGraphMining import java.io.BufferedReader import java.io.FileReader import java.io.PrintWriter import java.util.* import kotlin.math.pow import kotlin.random.asJavaRandom fun solve(fileName: String, nei: List<IntArray>) { val outputFile = "$fileName.out" val auxFile = "$f...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/marathons/icpcchallenge/y2020_huaweiGraphMining/AKt.class", "javap": "Compiled from \"a.kt\"\npublic final class marathons.icpcchallenge.y2020_huaweiGraphMining.AKt {\n public static final void solve(java.lang.String, java.util.List<int[]>);\n Code...
mikhail-dvorkin__competitions__3095312/marathons/icpcchallenge/y2020_huaweiGraphMining/practice/b.kt
package marathons.icpcchallenge.y2020_huaweiGraphMining.practice import java.io.* import kotlin.random.Random private fun solve(edges: List<List<Int>>): BooleanArray { val n = edges.flatten().maxOrNull()!! + 1 val nei = List(n) { mutableListOf<Int>() } for ((u, v) in edges) { nei[u].add(v); nei[v].add(u) } val r ...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/marathons/icpcchallenge/y2020_huaweiGraphMining/practice/BKt.class", "javap": "Compiled from \"b.kt\"\npublic final class marathons.icpcchallenge.y2020_huaweiGraphMining.practice.BKt {\n private static final boolean[] solve(java.util.List<? extends ja...
mikhail-dvorkin__competitions__3095312/marathons/atcoder/ahc21_toyota2023_pyramidSorting/pyramidSorting.kt
package marathons.atcoder.ahc21_toyota2023_pyramidSorting import kotlin.random.Random private fun solve(f: List<IntArray>) { val answers = mutableListOf<List<String>>() for (mode in 0 until 5 + 12) { answers.add(solveGreedy(f.map { it.clone() }, mode)) } val ans = answers.minBy { it.size } println("" + ans.siz...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/marathons/atcoder/ahc21_toyota2023_pyramidSorting/PyramidSortingKt.class", "javap": "Compiled from \"pyramidSorting.kt\"\npublic final class marathons.atcoder.ahc21_toyota2023_pyramidSorting.PyramidSortingKt {\n private static final int[] DY;\n\n pri...
mikhail-dvorkin__competitions__3095312/marathons/atcoder/ahc3_shortestPathQueries/shortestPathQueries.kt
package marathons.atcoder.ahc3_shortestPathQueries import kotlin.random.Random private fun solve(queries: Int = 1000, size: Int = 30, averageEdge: Int = 5000) { val noiseLevel = 0.2 val random = Random(566) fun vertexId(y: Int, x: Int) = y * size + x data class Edge(val from: Int, val to: Int, val label: Char, va...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/marathons/atcoder/ahc3_shortestPathQueries/ShortestPathQueriesKt$solve$Edge.class", "javap": "Compiled from \"shortestPathQueries.kt\"\npublic final class marathons.atcoder.ahc3_shortestPathQueries.ShortestPathQueriesKt$solve$Edge {\n private final in...
mikhail-dvorkin__competitions__3095312/gcj/y2022/round3/c_small.kt
package gcj.y2022.round3 private fun solve(letters: String = "ACDEHIJKMORST"): String { val n = readInt() val exits = List(2) { readInts().map { it - 1 } } val dist1 = List(n) { v -> listOf(exits[0][v], exits[1][v]) } val dist2 = List(n) { v -> val d1 = dist1[v]; dist1[d1[0]] + dist1[d1[1]] } val dist12 = List(n)...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2022/round3/C_smallKt.class", "javap": "Compiled from \"c_small.kt\"\npublic final class gcj.y2022.round3.C_smallKt {\n private static final java.lang.String solve(java.lang.String);\n Code:\n 0: invokestatic #10 // Meth...
mikhail-dvorkin__competitions__3095312/gcj/y2022/round3/b_small.kt
package gcj.y2022.round3 private fun solve(): Long { val (n, colors) = readInts() val constraints = List(colors) { readInts() } val hats = readInts().map { it - 1 } val byColor = List(colors) { mutableListOf<Int>() } val indexInColor = IntArray(colors) for (i in hats.indices) { byColor[hats[i]].add(i) } val ...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2022/round3/B_smallKt.class", "javap": "Compiled from \"b_small.kt\"\npublic final class gcj.y2022.round3.B_smallKt {\n private static final long solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/Lis...
mikhail-dvorkin__competitions__3095312/gcj/y2022/round2/a.kt
package gcj.y2022.round2 private fun solve(): String { val (n, k) = readInts() var x = 1 var w = n - 1 val ans = mutableListOf<String>() var toCut = n * n - 1 - k var where = 1 while (w > 0) { val y = x + 4 * w repeat(4) { i -> val from = x + i * w + 1 val to = y + i * (w - 2) val cut = to - from -...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2022/round2/AKt.class", "javap": "Compiled from \"a.kt\"\npublic final class gcj.y2022.round2.AKt {\n private static final java.lang.String solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n ...
mikhail-dvorkin__competitions__3095312/gcj/y2022/round2/c_small.kt
package gcj.y2022.round2 private fun solve(): String { val n = readInt() val kids = List(n) { readInts() } val sweets = List(n + 1) { readInts() } fun sqr(x: Int) = x.toLong() * x fun dist(i: Int, j: Int) = sqr(kids[i][0] - sweets[j][0]) + sqr(kids[i][1] - sweets[j][1]) val dist = List(n) { i -> LongArray(n + 1)...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2022/round2/C_smallKt.class", "javap": "Compiled from \"c_small.kt\"\npublic final class gcj.y2022.round2.C_smallKt {\n private static final java.lang.String solve();\n Code:\n 0: invokestatic #10 // Method readInt:()I\n...
mikhail-dvorkin__competitions__3095312/gcj/y2022/round2/b_wip.kt
package gcj.y2022.round2 import kotlin.math.floor import kotlin.math.round import kotlin.math.sqrt private fun rFloor(x: Int, y: Int) = floor(sqrt(1.0 * x * x + 1.0 * y * y)).toInt() private fun y(x: Int, r: Int): Int { return round(sqrt(1.0 * r * r - 1.0 * x * x)).toInt() } private fun skips(rFloor: Int, x: Int, y:...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2022/round2/B_wipKt.class", "javap": "Compiled from \"b_wip.kt\"\npublic final class gcj.y2022.round2.B_wipKt {\n private static final int rFloor(int, int);\n Code:\n 0: dconst_1\n 1: iload_0\n 2: i2d\n 3: dmul\n ...
mikhail-dvorkin__competitions__3095312/gcj/y2022/round2/b_small.kt
package gcj.y2022.round2 import kotlin.math.round import kotlin.math.sqrt private fun dumb(m: Int): Int { val a = List(m + 2) { BooleanArray(m + 2) } val b = List(m + 2) { BooleanArray(m + 2) } for (r in 0..m) { for (x in 0..r) { val y = round(sqrt(1.0 * r * r - x * x)).toInt() b[x][y] = true b[y][x] = t...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2022/round2/B_smallKt.class", "javap": "Compiled from \"b_small.kt\"\npublic final class gcj.y2022.round2.B_smallKt {\n private static final int dumb(int);\n Code:\n 0: iload_0\n 1: iconst_2\n 2: iadd\n 3: istore_2\n ...
mikhail-dvorkin__competitions__3095312/gcj/y2022/kickstart_c/c.kt
package gcj.y2022.kickstart_c private fun solve(): String { val (n, len) = readInts() val ants = List(n) { readInts() } val falls = ants.map { ant -> (if (ant[1] == 0) ant[0] else len - ant[0]) to ant[1] }.sortedBy { it.first } val order = ants.withIndex().sortedBy { it.value[0] }.map { it.index } var low = 0 ...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2022/kickstart_c/CKt$solve$$inlined$sortedBy$2.class", "javap": "Compiled from \"Comparisons.kt\"\npublic final class gcj.y2022.kickstart_c.CKt$solve$$inlined$sortedBy$2<T> implements java.util.Comparator {\n public gcj.y2022.kickstart_c.CKt$solv...
mikhail-dvorkin__competitions__3095312/gcj/y2022/kickstart_c/d.kt
package gcj.y2022.kickstart_c const val M = 1000000007 private fun solve(): Int { val n = readInt() val s = readLn() val a = List(n + 1) { List(n + 1) { IntArray(n + 1) } } for (i in n downTo 0) for (j in i..n) for (k in 0..j - i) { if (k == 0) { a[i][j][k] = 1 continue } if (k == 1) { a[i][j][k] =...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2022/kickstart_c/DKt.class", "javap": "Compiled from \"d.kt\"\npublic final class gcj.y2022.kickstart_c.DKt {\n public static final int M;\n\n private static final int solve();\n Code:\n 0: invokestatic #9 // Method re...
mikhail-dvorkin__competitions__3095312/gcj/y2022/round1b/c_easy.kt
package gcj.y2022.round1b private fun solve(m: Int = 8) { fun ask(asked: Int): Int { println(asked.toString(2).padStart(m, '0')) return readInt() } val masks = 1 shl m fun rotate(mask: Int, shift: Int): Int { return (((mask shl m) or mask) shr shift) and (masks - 1) } val initOnes = ask(0) var ones = init...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2022/round1b/C_easyKt.class", "javap": "Compiled from \"c_easy.kt\"\npublic final class gcj.y2022.round1b.C_easyKt {\n private static final void solve(int);\n Code:\n 0: iconst_1\n 1: iload_0\n 2: ishl\n 3: istore_1\n ...
mikhail-dvorkin__competitions__3095312/gcj/y2022/round1b/b.kt
package gcj.y2022.round1b import kotlin.math.abs private fun solve(): Long { val (n, _) = readInts() val lists = List(n) { readInts() } var pLow = 0 var pHigh = 0 var costLow = 0L var costHigh = 0L for (list in lists) { val pLowNew = list.minOrNull()!! val pHighNew = list.maxOrNull()!! val costLowNew = m...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2022/round1b/BKt.class", "javap": "Compiled from \"b.kt\"\npublic final class gcj.y2022.round1b.BKt {\n private static final long solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n 3: ic...
mikhail-dvorkin__competitions__3095312/gcj/y2023/farewell_d/e_to_upsolve.kt
package gcj.y2023.farewell_d import kotlin.random.Random fun generate(n: Int, m: Int): MutableList<Pair<Int, Int>> { var toAdd = m val list = mutableListOf<Pair<Int, Int>>() fun addEdge(v: Int, u: Int) { toAdd-- list.add(v to u) } for (i in 0 until n) { addEdge(i, (i + 1) % n) } for (i in 2 until n) { //...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2023/farewell_d/E_to_upsolveKt.class", "javap": "Compiled from \"e_to_upsolve.kt\"\npublic final class gcj.y2023.farewell_d.E_to_upsolveKt {\n public static final java.util.List<kotlin.Pair<java.lang.Integer, java.lang.Integer>> generate(int, int...
mikhail-dvorkin__competitions__3095312/gcj/y2023/farewell_d/b_small_to_upsolve.kt
package gcj.y2023.farewell_d private fun solve(): String { val (a, b, qIn) = readLn().split(" ") val leftMost = HashMap<Long, Int>(a.length * a.length) for (i in a.indices) { var h = 0L for (j in i until a.length) { h = mix(h + a[j].code) leftMost.putIfAbsent(h, j + 1) } } val ans = List(qIn.toInt()) ...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2023/farewell_d/B_small_to_upsolveKt.class", "javap": "Compiled from \"b_small_to_upsolve.kt\"\npublic final class gcj.y2023.farewell_d.B_small_to_upsolveKt {\n private static final java.lang.String solve();\n Code:\n 0: invokestatic #9...
mikhail-dvorkin__competitions__3095312/gcj/y2023/farewell_d/d_small.kt
package gcj.y2023.farewell_d private fun solve(): Modular { val s = readLn() val dp = ModularArray(s.length) { 0.toModularUnsafe() } var ans = 0.toModularUnsafe() for (i in s.indices) { if (s[i] !in ".o") continue if (s.take(i).all { it in ".>" }) dp[i] = 1.toModularUnsafe() for (j in 0 until i) { var goo...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2023/farewell_d/D_smallKt.class", "javap": "Compiled from \"d_small.kt\"\npublic final class gcj.y2023.farewell_d.D_smallKt {\n private static final java.util.List<gcj.y2023.farewell_d.Modular> factorials;\n\n private static final int solve();\n...
mikhail-dvorkin__competitions__3095312/gcj/y2023/farewell_d/a_small.kt
package gcj.y2023.farewell_d private fun solve(): String { val (nLeft, nRight, c) = readInts() val (leftIn, rightIn) = List(2) { readInts().map { it - 1 } } val n = nLeft + nRight return List(c) { val (cu, cvIn) = readInts().map { it - 1 } val cv = nLeft + cvIn val nei = List(n) { mutableListOf<Int>() } fu...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2023/farewell_d/A_smallKt.class", "javap": "Compiled from \"a_small.kt\"\npublic final class gcj.y2023.farewell_d.A_smallKt {\n private static final java.lang.String solve();\n Code:\n 0: invokestatic #10 // Method readI...
mikhail-dvorkin__competitions__3095312/gcj/y2019/round3/a.kt
package gcj.y2019.round3 import java.util.TreeSet private const val M = 1_000_000_000_000L private const val S = 10_000_000_000L private fun play() { val ranges = mutableSetOf(1..M) fun makeMove(p: Long) { val removed = ranges.first { p in it } ranges.remove(removed) val added = listOf(removed.first until p,...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2019/round3/AKt.class", "javap": "Compiled from \"a.kt\"\npublic final class gcj.y2019.round3.AKt {\n private static final long M;\n\n private static final long S;\n\n private static final java.util.Map<kotlin.ranges.LongRange, java.lang.Intege...
mikhail-dvorkin__competitions__3095312/gcj/y2020/round1a/b.kt
package gcj.y2020.round1a private fun solve(n: Int) = (0..n).first { solve(n.toLong(), it, true) } private fun solve(n: Long, p: Int, dir: Boolean): Boolean { if (p < 0) return true if (n <= p || n >= 1L shl (p + 1)) return false val order = if (dir) 0..p else p downTo 0 when { solve(n - (1L shl p), p - 1, !dir...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/round1a/BKt.class", "javap": "Compiled from \"b.kt\"\npublic final class gcj.y2020.round1a.BKt {\n private static final int solve(int);\n Code:\n 0: new #8 // class kotlin/ranges/IntRange\n 3: dup\n ...
mikhail-dvorkin__competitions__3095312/gcj/y2020/round1a/a.kt
package gcj.y2020.round1a private fun solve(impossible: String = "*"): String { return List(readInt()) { readLn() }.fold("**") { s, t -> val split = listOf(s, t).map { it.split("*") } val prefix = unite(split.map { it[0] }, String::startsWith) ?: return impossible val suffix = unite(split.map { it.last() }, Str...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/round1a/AKt$solve$2$prefix$2.class", "javap": "Compiled from \"a.kt\"\nfinal class gcj.y2020.round1a.AKt$solve$2$prefix$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function3<java.lang.String, java.lang....
mikhail-dvorkin__competitions__3095312/gcj/y2020/round1a/c.kt
package gcj.y2020.round1a private fun solve(): Long { val (hei, wid) = readInts() val a = List(hei) { readInts().toMutableList() } val nei = List(DX.size) { d -> List(hei) { x -> MutableList(wid) { y -> val xx = x + DX[d]; val yy = y + DY[d] a.getOrNull(xx)?.getOrNull(yy)?.let { xx to yy } } } } var ans = 0L ...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/round1a/CKt.class", "javap": "Compiled from \"c.kt\"\npublic final class gcj.y2020.round1a.CKt {\n private static final int[] DX;\n\n private static final int[] DY;\n\n private static final long solve();\n Code:\n 0: invokestatic ...
mikhail-dvorkin__competitions__3095312/gcj/y2020/round1a/c_small.kt
package gcj.y2020.round1a private fun solve(): Long { val (hei, wid) = readInts() val a = List(hei) { readInts().toIntArray() } var ans = 0L while (true) { val eliminated = mutableListOf<Pair<Int, Int>>() for (x in 0 until hei) for (y in 0 until wid) if (a[x][y] > 0) { fun nei(d: Int): Int? { var xx = x...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/round1a/C_smallKt.class", "javap": "Compiled from \"c_small.kt\"\npublic final class gcj.y2020.round1a.C_smallKt {\n private static final int[] DX;\n\n private static final int[] DY;\n\n private static final long solve();\n Code:\n ...
mikhail-dvorkin__competitions__3095312/gcj/y2020/qual/c.kt
package gcj.y2020.qual private fun solve(initials: String = "CJ", impossible: String = "IMPOSSIBLE"): String { data class Activity(val start: Int, val end: Int, val id: Int) val activities = List(readInt()) { val (start, end) = readInts(); Activity(start, end, it) } val ans = IntArray(activities.size) val free = I...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/qual/CKt.class", "javap": "Compiled from \"c.kt\"\npublic final class gcj.y2020.qual.CKt {\n private static final java.lang.String solve(java.lang.String, java.lang.String);\n Code:\n 0: invokestatic #10 // Method r...
mikhail-dvorkin__competitions__3095312/gcj/y2020/qual/e.kt
package gcj.y2020.qual private fun solve(possible: String = "POSSIBLE", impossible: String = "IMPOSSIBLE"): String { // for (n in 2..50) { solveDiagonal(n, 0, 0); solveDiagonal(n, 1, 1); solveDiagonal(n, 1, 2) } val (n, trace) = readInts() for (i in 1..n) for (j in 1..n) for (k in 1..n) { if ((i == j) xor (i == k)...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/qual/EKt.class", "javap": "Compiled from \"e.kt\"\npublic final class gcj.y2020.qual.EKt {\n private static final java.util.Map<java.lang.String, java.util.List<int[]>> memo;\n\n private static final java.lang.String solve(java.lang.String,...
mikhail-dvorkin__competitions__3095312/gcj/y2020/qual/d.kt
package gcj.y2020.qual private fun solve(n: Int, period: Int = 10) { val a = IntArray(n) var iter = 0 fun ask(index: Int): Int { iter++ println(index + 1) return readInt() } val first = IntArray(2) { -1 } val negated = IntArray(2) { -1 } fun fetchNegated(d: Int) { negated[d] = if (first[d] == -1) 0 else...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/qual/DKt.class", "javap": "Compiled from \"d.kt\"\npublic final class gcj.y2020.qual.DKt {\n private static final void solve(int, int);\n Code:\n 0: iload_0\n 1: newarray int\n 3: astore_2\n 4: new ...
mikhail-dvorkin__competitions__3095312/gcj/y2020/round3/a.kt
package gcj.y2020.round3 private fun solve(): String { val (s, t) = readStrings() val way = generateSequence(t) { x -> prev(s, x) }.toList() return way[way.size / 2] } private fun prev(s: String, t: String): String? { if (s == t) return null val d = List(s.length + 1) { IntArray(t.length + 1) } for (i in s.indi...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/round3/AKt.class", "javap": "Compiled from \"a.kt\"\npublic final class gcj.y2020.round3.AKt {\n private static final java.lang.String solve();\n Code:\n 0: invokestatic #10 // Method readStrings:()Ljava/util/List;\...
mikhail-dvorkin__competitions__3095312/gcj/y2020/round3/b_small.kt
package gcj.y2020.round3 private fun solve(): Int { val (c, n) = readInts() val xIn = readInts() val x = (xIn.map { it - xIn[0] } + c).map { it * 2 } readLn() var maxMask = (1 shl (2 * c + 1)) - 1 for (v in x) maxMask = maxMask xor (1 shl v) var ans = 2 * n var mask = maxMask while (mask > 0) { if (mask.cou...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/round3/B_smallKt.class", "javap": "Compiled from \"b_small.kt\"\npublic final class gcj.y2020.round3.B_smallKt {\n private static final int solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List...
mikhail-dvorkin__competitions__3095312/gcj/y2020/round2/b.kt
package gcj.y2020.round2 private fun solve(): String { val (n, m) = readInts() val data = (listOf(0) + readInts()).toIntArray() val edges = List(m) { readInts().map { it - 1 } } val added = IntArray(n) data.withIndex().filter { it.value < 0 }.forEach { entry -> added[(-entry.value until n).first { added[it] == ...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/round2/BKt.class", "javap": "Compiled from \"b.kt\"\npublic final class gcj.y2020.round2.BKt {\n private static final java.lang.String solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n ...
mikhail-dvorkin__competitions__3095312/gcj/y2020/round2/c.kt
package gcj.y2020.round2 private fun solve(): Int { val n = readInt() data class Point(val x: Int, val y: Int) val points = List(n) { val (x, y) = readInts(); Point(x, y) } val dirs = points.cartesianTriangle().map { (p, q) -> val (x, y) = dividedByGcd(p.x - q.x, p.y - q.y) if (x > 0 || (x == 0 && y > 0)) (x t...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/round2/CKt$solve$Point.class", "javap": "Compiled from \"c.kt\"\npublic final class gcj.y2020.round2.CKt$solve$Point {\n private final int x;\n\n private final int y;\n\n public gcj.y2020.round2.CKt$solve$Point(int, int);\n Code:\n ...
mikhail-dvorkin__competitions__3095312/gcj/y2020/round2/a.kt
package gcj.y2020.round2 import kotlin.math.pow fun solvePancakes(aIn: Long, bIn: Long): String { var a = aIn; var b = bIn var i = 1L val maxN = (a.toDouble() + b + 100).pow(0.5).toLong() * 2 fun step(): String? { if (maxOf(a, b) < i) return "${i - 1} $a $b" if (a >= b) a -= i else b -= i i++ return null...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/round2/AKt.class", "javap": "Compiled from \"a.kt\"\npublic final class gcj.y2020.round2.AKt {\n public static final java.lang.String solvePancakes(long, long);\n Code:\n 0: new #9 // class kotlin/jvm/inte...
mikhail-dvorkin__competitions__3095312/gcj/y2020/kickstart_b/c.kt
package gcj.y2020.kickstart_b const val M = 1000000000 val DX = intArrayOf(1, 0, M - 1, 0) val DY = intArrayOf(0, 1, 0, M - 1) const val DIR_ROSE = "ESWN" private fun solve(): String { val s = "1(" + readLn() + ")" var i = 0 fun readMove(): Pair<Int, Int> { val c = s[i++] if (c in DIR_ROSE) return DIR_ROSE.ind...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/kickstart_b/CKt.class", "javap": "Compiled from \"c.kt\"\npublic final class gcj.y2020.kickstart_b.CKt {\n public static final int M;\n\n private static final int[] DX;\n\n private static final int[] DY;\n\n public static final java.lang....
mikhail-dvorkin__competitions__3095312/gcj/y2020/kickstart_b/d.kt
package gcj.y2020.kickstart_b import kotlin.math.pow private fun solve(): Double { val (w, h, x1, y1, x2, y2) = readInts() return solve(x1 - 1, y2 - 1, h) + solve(y1 - 1, x2 - 1, w) } private fun solve(x: Int, y: Int, h: Int): Double { if (y + 1 >= h) return 0.0 var res = 0.0 var c = 1.0 var p = x + y for (i ...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/kickstart_b/DKt.class", "javap": "Compiled from \"d.kt\"\npublic final class gcj.y2020.kickstart_b.DKt {\n private static final double solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n ...
mikhail-dvorkin__competitions__3095312/gcj/y2020/kickstart_d/c.kt
package gcj.y2020.kickstart_d private fun solve(): Double { val (n, a, b) = readInts() val p = listOf(0, 0) + readInts() val p1 = probs(p, a) val p2 = probs(p, b) val x = (1 until p.size).map { p1[it].toLong() * p2[it] }.sum() return p.size - 1 - x / (p.size - 1.0) / (p.size - 1) } private fun probs(p: List<Int...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/kickstart_d/CKt.class", "javap": "Compiled from \"c.kt\"\npublic final class gcj.y2020.kickstart_d.CKt {\n private static final double solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n ...
mikhail-dvorkin__competitions__3095312/gcj/y2020/kickstart_d/d.kt
package gcj.y2020.kickstart_d private fun solve(): String { val (n, q) = readInts() val d = readInts().toIntArray() val maxD = d.maxOrNull()!! val st = SparseTable(d) fun canWalk(s: Int, t: Int): Pair<Int, Int> { var low = s var high = n while (low + 1 < high) { val mid = (low + high) / 2 val maxDoor...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/kickstart_d/DKt.class", "javap": "Compiled from \"d.kt\"\npublic final class gcj.y2020.kickstart_d.DKt {\n private static final java.lang.String solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util...
mikhail-dvorkin__competitions__3095312/gcj/y2020/kickstart_c/d.kt
package gcj.y2020.kickstart_c private fun solve(): Long { val (n, q) = readInts() val ft = FenwickTree(n) val ftCoef = FenwickTree(n) fun set(i: Int, value: Int) { ft[i] = minusOnePow(i) * value ftCoef[i] = minusOnePow(i) * value * (i + 1) } fun query(start: Int, end: Int) = (ftCoef.sum(start, end) - ft.sum(...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/kickstart_c/DKt.class", "javap": "Compiled from \"d.kt\"\npublic final class gcj.y2020.kickstart_c.DKt {\n private static final long solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n ...
mikhail-dvorkin__competitions__3095312/gcj/y2020/round1b/b.kt
package gcj.y2020.round1b import kotlin.math.abs private const val SIZE = 1_000_000_000 private fun solve() { val grid = listOf(-SIZE / 3, SIZE / 3).cartesianSquare() val (xInit, yInit) = grid.first { (x, y) -> hit(x, y) } val (xLeft, _) = furthestInside(xInit, yInit, -1, 0) val (xRight, _) = furthestInside(xIni...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/round1b/BKt.class", "javap": "Compiled from \"b.kt\"\npublic final class gcj.y2020.round1b.BKt {\n private static final int SIZE;\n\n private static final void solve();\n Code:\n 0: iconst_2\n 1: anewarray #8 ...
mikhail-dvorkin__competitions__3095312/gcj/y2020/round1b/c.kt
package gcj.y2020.round1b private fun greedy(init: List<Int>): String { var a = init val moves = mutableListOf<String>() while (a.zipWithNext().any { it.first > it.second }) { val pairs = mutableMapOf<Int, Pair<Int, Int>>() loop@for (i in 1 until a.size) for (j in i + 1 until a.size) { val score = sequenceOf...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/round1b/CKt.class", "javap": "Compiled from \"c.kt\"\npublic final class gcj.y2020.round1b.CKt {\n private static final java.lang.String greedy(java.util.List<java.lang.Integer>);\n Code:\n 0: aload_0\n 1: astore_1\n 2: ...
mikhail-dvorkin__competitions__3095312/gcj/y2020/round1b/a.kt
package gcj.y2020.round1b private fun solve(): String { var (x, y) = readInts() val steps = (x.abs() + y.abs()).countSignificantBits() return (steps - 1 downTo 0).map { i -> val dir = DX.indices.maxByOrNull { x * DX[it] + y * DY[it] }!! x -= DX[dir] shl i; y -= DY[dir] shl i DIR_ROSE[dir] }.joinToString("")....
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/round1b/AKt.class", "javap": "Compiled from \"a.kt\"\npublic final class gcj.y2020.round1b.AKt {\n private static final int[] DX;\n\n private static final int[] DY;\n\n private static final java.lang.String DIR_ROSE;\n\n private static fi...
mikhail-dvorkin__competitions__3095312/gcj/y2020/round1b/c_small.kt
package gcj.y2020.round1b private fun search(init: List<Int>): String { val queue = mutableListOf(init) val dist = mutableMapOf(init to 0) val how = mutableMapOf<List<Int>, Way?>() var index = 0 while (true) { val a = queue[index++] if (a.zipWithNext().all { it.first <= it.second }) return "${dist[a]}\n${how[...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/gcj/y2020/round1b/C_smallKt.class", "javap": "Compiled from \"c_small.kt\"\npublic final class gcj.y2020.round1b.C_smallKt {\n private static final java.lang.String search(java.util.List<java.lang.Integer>);\n Code:\n 0: iconst_1\n 1: a...
mikhail-dvorkin__competitions__3095312/facebook/y2023/qual/c.kt
package facebook.y2023.qual private fun solve(): Int { readInt() val a = readInts().sorted() if (a.size == 1) return 1 val inf = Int.MAX_VALUE val ans = listOf(a[0] + a.last(), a[0] + a[a.size - 2], a[1] + a.last()).minOf { sum -> val pool = a.groupBy {it}.mapValues { it.value.size }.toMutableMap() fun remove...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2023/qual/CKt.class", "javap": "Compiled from \"c.kt\"\npublic final class facebook.y2023.qual.CKt {\n private static final int solve();\n Code:\n 0: invokestatic #9 // Method readInt:()I\n 3: pop\n 4: ...
mikhail-dvorkin__competitions__3095312/facebook/y2023/round1/b.kt
package facebook.y2023.round1 private fun precalc(s: Int = 41): List<MutableMap<Int, Sequence<Int>>> { val dp = List(s + 1) { List(it + 1) { mutableMapOf<Int, Sequence<Int>>() } } dp[0][0][1] = emptySequence() for (sum in 0 until s) { for (count in 0..sum) { for (entry in dp[sum][count]) { for (x in 1..s -...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2023/round1/BKt.class", "javap": "Compiled from \"b.kt\"\npublic final class facebook.y2023.round1.BKt {\n private static final java.util.List<java.util.Map<java.lang.Integer, kotlin.sequences.Sequence<java.lang.Integer>>> precalc;\n\n priv...
mikhail-dvorkin__competitions__3095312/facebook/y2019/qual/d.kt
package facebook.y2019.qual import kotlin.random.Random private fun solve(): String { val (n, m) = readInts() val requirements = List(m) { readInts().map { it - 1 } } val ans = IntArray(n) try { construct(ans, -1, List(n) { it }, requirements) } catch (_: IllegalArgumentException) { return "Impossible" } r...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2019/qual/DKt.class", "javap": "Compiled from \"d.kt\"\npublic final class facebook.y2019.qual.DKt {\n private static final java.lang.String solve();\n Code:\n 0: invokestatic #12 // Method readInts:()Ljava/util/Lis...
mikhail-dvorkin__competitions__3095312/facebook/y2019/round1/c.kt
package facebook.y2019.round1 private fun solve(): Int { val (n, hei) = readInts() data class Ladder(val id: Int, val x: Int, val yFrom: Int, val yTo: Int) val ladders = List(n) { val (x, yFrom, yTo) = readInts(); Ladder(it, x, yFrom, yTo) } val e = Array(n + 2) { IntArray(n + 2) } val ys = ladders.flatMap { lis...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2019/round1/CKt$solve$Ladder.class", "javap": "Compiled from \"c.kt\"\npublic final class facebook.y2019.round1.CKt$solve$Ladder {\n private final int id;\n\n private final int x;\n\n private final int yFrom;\n\n private final int yTo;\n\...
mikhail-dvorkin__competitions__3095312/facebook/y2019/round1/a.kt
package facebook.y2019.round1 private const val INF = Int.MAX_VALUE / 3 private fun solve(): String { val (n, m) = readInts() val edgesInput = List(m) { readInts() } val graph = Array(n) { IntArray(n) { INF } } for ((aInput, bInput, d) in edgesInput) { val a = aInput - 1 val b = bInput - 1 graph[a][b] = d ...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2019/round1/AKt.class", "javap": "Compiled from \"a.kt\"\npublic final class facebook.y2019.round1.AKt {\n private static final int INF;\n\n private static final boolean isOnlineJudge;\n\n private static final kotlin.Pair<java.lang.Boolean...
mikhail-dvorkin__competitions__3095312/facebook/y2019/round1/d.kt
package facebook.y2019.round1 private fun solve(): Int { val (n, h, v) = readInts() val (x, y) = List(2) { val (x1, x2, ax, bx, cx, dx) = readInts() val x = IntArray(n) x[0] = x1 x[1] = x2 for (i in 2 until n) { x[i] = ((ax * 1L * x[i - 2] + bx * 1L * x[i - 1] + cx) % dx + 1).toInt() } x } val sor...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2019/round1/DKt.class", "javap": "Compiled from \"d.kt\"\npublic final class facebook.y2019.round1.DKt {\n private static final boolean isOnlineJudge;\n\n private static final kotlin.Pair<java.lang.Boolean, java.lang.Boolean> stdStreams;\n\...
mikhail-dvorkin__competitions__3095312/facebook/y2021/qual/b.kt
package facebook.y2021.qual private fun needed(s: String): Pair<Int, Int>? { return (s.count { it == '.' } to s.indexOf('.')).takeIf { 'O' !in s } } private fun solve(): String { val field = List(readInt()) { readLn() } val options = field.indices.flatMap { i -> listOf( needed(field[i])?.let { it.first to (i to ...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2021/qual/BKt.class", "javap": "Compiled from \"b.kt\"\npublic final class facebook.y2021.qual.BKt {\n private static final kotlin.Pair<java.lang.Integer, java.lang.Integer> needed(java.lang.String);\n Code:\n 0: aload_0\n 1: ...
mikhail-dvorkin__competitions__3095312/facebook/y2021/qual/c1.kt
package facebook.y2021.qual private fun solve(): Int { val n = readInt() val c = readInts() val nei = List(n) { mutableListOf<Int>() } repeat(n - 1) { val (v, u) = readInts().map { it - 1 } nei[v].add(u) nei[u].add(v) } fun dfs(v: Int, p: Int): Int { return c[v] + ((nei[v] - p).maxOfOrNull { dfs(it, v) }...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2021/qual/C1Kt.class", "javap": "Compiled from \"c1.kt\"\npublic final class facebook.y2021.qual.C1Kt {\n private static final int solve();\n Code:\n 0: invokestatic #9 // Method readInt:()I\n 3: istore_0\n ...
mikhail-dvorkin__competitions__3095312/facebook/y2021/qual/a2.kt
package facebook.y2021.qual private fun solve(from: Char = 'A', toInclusive: Char = 'Z'): Int { val s = readLn() val letters = toInclusive - from + 1 val inf = letters + 1 val e = List(letters) { IntArray(letters) { inf } } repeat(readInt()) { val (u, v) = readLn().map { it - from } e[u][v] = 1 } for (k in ...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2021/qual/A2Kt.class", "javap": "Compiled from \"a2.kt\"\npublic final class facebook.y2021.qual.A2Kt {\n private static final int solve(char, char);\n Code:\n 0: invokestatic #10 // Method readLn:()Ljava/lang/Strin...
mikhail-dvorkin__competitions__3095312/facebook/y2021/round1/a3.kt
package facebook.y2021.round1 private fun solve(M: Int = 1_000_000_007): Int { readLn() val s = readLn() var firstChar = 0.toChar() var lastChar = 0.toChar() var firstPos = -1 var lastPos = -1 var length = 0 var pairs = 0 var leftTicks = 0 var rightTicks = 0 var answer = 0 for (i in s.indices) { if (s[...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2021/round1/A3Kt.class", "javap": "Compiled from \"a3.kt\"\npublic final class facebook.y2021.round1.A3Kt {\n private static final int solve(int);\n Code:\n 0: invokestatic #10 // Method readLn:()Ljava/lang/String;\...
mikhail-dvorkin__competitions__3095312/facebook/y2020/qual/d1.kt
package facebook.y2020.qual private fun solve(): Long { val (n, m) = readInts() val c = List(n) { readInt() } val a = mutableListOf(m to 0L) var low = 0 val inf = c.fold(0L, Long::plus) + 1 for (i in c.indices) { while (a[low].first < i) low++ val cost = a[low].second if (i == n - 1) return cost.takeIf { i...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2020/qual/D1Kt.class", "javap": "Compiled from \"d1.kt\"\npublic final class facebook.y2020.qual.D1Kt {\n private static final long solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n ...
mikhail-dvorkin__competitions__3095312/facebook/y2020/qual/c.kt
package facebook.y2020.qual private fun solve(): Int { val n = readInt() val growsHere = mutableMapOf<Int, Int>() val fallsHere = mutableMapOf<Int, MutableList<Int>>() repeat(n) { val (p, h) = readInts() growsHere[p] = h fallsHere.computeIfAbsent(p - h) { mutableListOf() }.add(h) } val best = mutableMapOf<...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2020/qual/CKt.class", "javap": "Compiled from \"c.kt\"\npublic final class facebook.y2020.qual.CKt {\n private static final int solve();\n Code:\n 0: invokestatic #9 // Method readInt:()I\n 3: istore_0\n ...
mikhail-dvorkin__competitions__3095312/facebook/y2020/round3/b.kt
package facebook.y2020.round3 import java.util.* private fun solve(): Int { val (n, m, k, x) = readInts() val (sIn, pIn) = listOf(n, m).map { length -> val array = readInts().toIntArray() + IntArray(length - k) { 0 } val (a, b, c, d) = readInts() for (i in k until length) { array[i] = ((a.toLong() * array[...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2020/round3/BKt.class", "javap": "Compiled from \"b.kt\"\npublic final class facebook.y2020.round3.BKt {\n private static final int solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n ...
mikhail-dvorkin__competitions__3095312/facebook/y2020/round3/c.kt
package facebook.y2020.round3 private fun solve(): String { val (n, k) = readInts() data class Measurement(val time: Int, val p: Int, val r: Int) val measurements = List(n) { val (p, r) = readInts() Measurement(it, p, r) } val ps = measurements.map { it.p }.toSet().sorted() var a = Array(k + 1) { n + 1 to 0 ...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2020/round3/CKt$solve$Measurement.class", "javap": "Compiled from \"c.kt\"\npublic final class facebook.y2020.round3.CKt$solve$Measurement {\n private final int time;\n\n private final int p;\n\n private final int r;\n\n public facebook.y...
mikhail-dvorkin__competitions__3095312/facebook/y2020/round3/a.kt
package facebook.y2020.round3 import java.lang.StringBuilder private fun solve(): String { var k = readInt() / 2 val main = minOf(100, k + 2) var vertices = main val edges = mutableListOf<Pair<Int, Int>>() for (i in 1 until main) { edges.add(i - 1 to i) } k -= main - 2 for (i in 1..main - 2) { var deg = 2...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2020/round3/AKt.class", "javap": "Compiled from \"a.kt\"\npublic final class facebook.y2020.round3.AKt {\n private static final java.lang.String solve();\n Code:\n 0: invokestatic #10 // Method readInt:()I\n 3...
mikhail-dvorkin__competitions__3095312/facebook/y2020/round2/b.kt
package facebook.y2020.round2 private fun solve(): DoubleArray { val s = readStrings() val n = s[0].toInt() val p = s[1].toDouble() var a = DoubleArray(2) { 1.0 } for (m in 3..n) { val pairs = m * (m - 1L) / 2 val b = DoubleArray(m) { i -> val smaller = a.getOrElse(i - 1) { 0.0 } val same = a.getOrElse(...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2020/round2/BKt.class", "javap": "Compiled from \"b.kt\"\npublic final class facebook.y2020.round2.BKt {\n private static final double[] solve();\n Code:\n 0: invokestatic #10 // Method readStrings:()Ljava/util/List...
mikhail-dvorkin__competitions__3095312/facebook/y2020/round2/c.kt
package facebook.y2020.round2 import java.util.* private fun solve(MOD: Int = 1_000_000_007, maxWeight: Int = 1_000_000_000): Int { val (n, m, events, k) = readInts() val edges = n * m + n val (x, y, ids, weights) = listOf(m to n, m to n, edges to events, maxWeight to events).map { (modulo, length) -> val array ...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2020/round2/CKt.class", "javap": "Compiled from \"c.kt\"\npublic final class facebook.y2020.round2.CKt {\n private static final int solve(int, int);\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List...
mikhail-dvorkin__competitions__3095312/facebook/y2020/round2/a.kt
package facebook.y2020.round2 private fun solve(): Long { val (n, k) = readInts() val (s, x, y) = List(3) { val array = readInts().toIntArray() + IntArray(n - k) { 0 } val (a, b, c, d) = readInts() for (i in k until n) { array[i] = ((a.toLong() * array[i - 2] + b.toLong() * array[i - 1] + c) % d).toInt() ...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2020/round2/AKt.class", "javap": "Compiled from \"a.kt\"\npublic final class facebook.y2020.round2.AKt {\n private static final long solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n ...
mikhail-dvorkin__competitions__3095312/facebook/y2020/round1/b.kt
package facebook.y2020.round1 private fun solve(): Int { val (n, m, k, _) = readInts() val (p, q) = listOf(n, m).map { size -> readInts().toMutableList().also { list -> val (a, b, c, d) = readInts() for (i in k until size) { list.add(((a.toLong() * list[i - 2] + b.toLong() * list[i - 1] + c) % d + 1).toInt())...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2020/round1/BKt.class", "javap": "Compiled from \"b.kt\"\npublic final class facebook.y2020.round1.BKt {\n private static final int solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n ...
mikhail-dvorkin__competitions__3095312/facebook/y2020/round1/a2.kt
package facebook.y2020.round1 import java.util.* private fun solve(M: Int = 1_000_000_007): Int { val (n, k) = readInts() val (L, w, h) = List(3) { readInts().toMutableList().also { list -> val (a, b, c, d) = readInts() for (i in k until n) { list.add(((a.toLong() * list[i - 2] + b.toLong() * list[i - 1] + c...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2020/round1/A2Kt.class", "javap": "Compiled from \"a2.kt\"\npublic final class facebook.y2020.round1.A2Kt {\n private static final int solve(int);\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\...
mikhail-dvorkin__competitions__3095312/facebook/y2020/round1/a1.kt
package facebook.y2020.round1 private fun solve(M: Int = 1_000_000_007): Int { val (n, k, w) = readInts() val (L, h) = List(2) { readInts().toMutableList().also { list -> val (a, b, c, d) = readInts() for (i in k until n) { list.add(((a.toLong() * list[i - 2] + b.toLong() * list[i - 1] + c) % d + 1).toInt()) ...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/facebook/y2020/round1/A1Kt.class", "javap": "Compiled from \"a1.kt\"\npublic final class facebook.y2020.round1.A1Kt {\n private static final int solve(int);\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\...
mikhail-dvorkin__competitions__3095312/atcoder/agc044/b.kt
package atcoder.agc044 fun main() { val n = readInt() val p = readInts().map { it - 1 } val dist = List(n) { x -> IntArray(n) { y -> sequenceOf(x, y, n - 1 - x, n - 1 - y).minOrNull()!! + 1 } } val on = List(n) { x -> BooleanArray(n) { true } } var ans = 0 val stack = IntArray(n * n) for (r in p) { val rx = r...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/atcoder/agc044/BKt.class", "javap": "Compiled from \"b.kt\"\npublic final class atcoder.agc044.BKt {\n private static final int[] DX;\n\n private static final int[] DY;\n\n public static final void main();\n Code:\n 0: invokestatic #10 ...
mikhail-dvorkin__competitions__3095312/atcoder/agc043/d_wrong.kt
package atcoder.agc043 fun main() { // val (n, m) = readInts() val memo = HashMap<Long, Int>() fun solve(x: Int, y: Int, z: Int): Int { if (z == 0 && y == x - 1) return 1 if (y < 0 || y >= x || z >= x) return 0 val code = (x.toLong() shl 42) + (y.toLong() shl 21) + z if (memo.containsKey(code)) return memo[...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/atcoder/agc043/D_wrongKt.class", "javap": "Compiled from \"d_wrong.kt\"\npublic final class atcoder.agc043.D_wrongKt {\n public static final void main();\n Code:\n 0: new #8 // class java/util/HashMap\n 3: dup...
mikhail-dvorkin__competitions__3095312/atcoder/arc155/c.kt
package atcoder.arc155 private fun solve(a: List<Int>, b: List<Int>): Boolean { if (a.sorted() != b.sorted()) return false val aIsOmnipotent = isOmnipotent(a) val bIsOmnipotent = isOmnipotent(b) val aEven = mutableListOf<Int>() val bEven = mutableListOf<Int>() fun canSortEven(): Boolean { return (aEven.size >=...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/atcoder/arc155/CKt.class", "javap": "Compiled from \"c.kt\"\npublic final class atcoder.arc155.CKt {\n private static final boolean solve(java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>);\n Code:\n 0: aload_0\n 1: c...
mikhail-dvorkin__competitions__3095312/atcoder/arc155/a.kt
package atcoder.arc155 private fun solve(): Boolean { val (_, qIn) = readLongs() val s = readLn() val q = minOf(qIn % (2 * s.length) + 4 * s.length, qIn).toInt() val c = (s + " ".repeat(q)).toCharArray() val mark = BooleanArray(c.size) { false } var answer = true val queue = IntArray(c.size) for (i in c.indice...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/atcoder/arc155/AKt.class", "javap": "Compiled from \"a.kt\"\npublic final class atcoder.arc155.AKt {\n private static final boolean solve();\n Code:\n 0: invokestatic #10 // Method readLongs:()Ljava/util/List;\n 3: icon...
mikhail-dvorkin__competitions__3095312/atcoder/arc154/c.kt
package atcoder.arc154 private fun solve(): Boolean { val (_, a, b) = List(3) { readInts() } if (a == b) return true if (b.toSet().size == 1) return b[0] in a val want = b.filterIndexed { i, it -> it != b.getCycled(i + 1) } if (want.size == b.size) return false for (aShifted in a.allShifts()) { var k = 0 for...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/atcoder/arc154/CKt.class", "javap": "Compiled from \"c.kt\"\npublic final class atcoder.arc154.CKt {\n private static final boolean solve();\n Code:\n 0: iconst_3\n 1: istore_1\n 2: new #8 // class java/...
mikhail-dvorkin__competitions__3095312/atcoder/arc154/d.kt
package atcoder.arc154 import kotlin.random.Random fun main() { val n = readInt() val random = Random(566) val shuffle = (0 until n).shuffled(random) val memo = mutableMapOf<Triple<Int, Int, Int>, Boolean>() // p[i] + p[j] > p[k] fun ask(i: Int, j: Int, k: Int): Boolean { if (i > j) return ask(j, i, k) retu...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/atcoder/arc154/DKt.class", "javap": "Compiled from \"d.kt\"\npublic final class atcoder.arc154.DKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInt:()I\n 3: istore_0\n 4: sipush...
mikhail-dvorkin__competitions__3095312/atcoder/arc153/c.kt
package atcoder.arc153 private const val M = 1e12.toLong() private fun solve(s: IntArray): LongArray? { val n = s.size val sSum = s.sum() val a = LongArray(n) { it + 1L } fun aSum() = a.indices.sumOf { i -> a[i] * s[i] } if (sSum != 0) { val x = M / 4 val delta = (-x - aSum()) / sSum for (i in a.indices) a...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/atcoder/arc153/CKt.class", "javap": "Compiled from \"c.kt\"\npublic final class atcoder.arc153.CKt {\n private static final long M;\n\n private static final long[] solve(int[]);\n Code:\n 0: aload_0\n 1: arraylength\n 2: istore_1...
mikhail-dvorkin__competitions__3095312/atcoder/arc158/e_slow.kt
package atcoder.arc158 fun main() { readLn() val top = readInts() val bottom = readInts() val inf = Long.MAX_VALUE / 4 data class Score(val score: Long, val improve: Long) fun solve(from: Int, to: Int): Modular1 { if (from + 1 == to) { return (top[from] + bottom[from]).toModular() * 3.toModularUnsafe() } ...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/atcoder/arc158/E_slowKt.class", "javap": "Compiled from \"e_slow.kt\"\npublic final class atcoder.arc158.E_slowKt {\n private static final java.io.BufferedReader bufferedReader;\n\n private static final java.util.List<atcoder.arc158.Modular1> factori...
mikhail-dvorkin__competitions__3095312/atcoder/arc158/e.kt
package atcoder.arc158 fun main() { readLn() val top = readInts() val bottom = readInts() val inf = Long.MAX_VALUE / 4 fun solve(from: Int, to: Int): Modular { if (from + 1 == to) { return (top[from] + bottom[from]).toModular() * 3.toModularUnsafe() } val mid = (from + to) / 2 var result = solve(from, ...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/atcoder/arc158/EKt.class", "javap": "Compiled from \"e.kt\"\npublic final class atcoder.arc158.EKt {\n private static final java.io.BufferedReader bufferedReader;\n\n private static final java.util.List<atcoder.arc158.Modular> factorials;\n\n public...
mikhail-dvorkin__competitions__3095312/atcoder/arc156/b.kt
package atcoder.arc156 fun main() { var (_, k) = readInts() val a = readInts().toSet() val f = (0..a.size).first { it !in a } var ans = if (f > 0) take(k, f) else 0.toModularUnsafe() for (x in f..Int.MAX_VALUE) { ans += take(k - 1, x + 1) if (x !in a && --k == 0) break } println(ans) } private fun take(n: ...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/atcoder/arc156/BKt.class", "javap": "Compiled from \"b.kt\"\npublic final class atcoder.arc156.BKt {\n private static final java.util.List<atcoder.arc156.Modular> factorials;\n\n public static final void main();\n Code:\n 0: invokestatic #1...
mikhail-dvorkin__competitions__3095312/atcoder/arc156/c_research.kt
package atcoder.arc156 import kotlin.random.Random fun main() { val n = readInt() val nei = List(n) { mutableListOf<Int>() } repeat(n - 1) { val (u, v) = readInts().map { it - 1 } nei[u].add(v); nei[v].add(u) } val r = Random(566) val byDegree = nei.indices.sortedBy { nei[it].size } val p = IntArray(n) fo...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/atcoder/arc156/C_researchKt$main$$inlined$sortedBy$1.class", "javap": "Compiled from \"Comparisons.kt\"\npublic final class atcoder.arc156.C_researchKt$main$$inlined$sortedBy$1<T> implements java.util.Comparator {\n final java.util.List $nei$inlined;\...
mikhail-dvorkin__competitions__3095312/atcoder/arc159/c.kt
package atcoder.arc159 fun main() { readInt() val a = readInts().toIntArray() val ans = mutableListOf<IntArray>() fun apply(p: IntArray) { for (i in a.indices) a[i] += p[i] ans.add(p) } var sumOk = false for (j in a.indices) { if (a.sum() % a.size == 0) { sumOk = true break } val b = a.indices...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/atcoder/arc159/CKt.class", "javap": "Compiled from \"c.kt\"\npublic final class atcoder.arc159.CKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInt:()I\n 3: pop\n 4: invokestati...
mikhail-dvorkin__competitions__3095312/atcoder/arc128/d.kt
package atcoder.arc128 fun main() { readLn() val a = readInts() val cumSum = mutableListOf(0.toModular()) fun sum(from: Int, to: Int) = cumSum[maxOf(to, from)] - cumSum[from] var same = 0 var diff = 0 var ans = 1.toModular() for (i in a.indices) { if (i < 2 || a[i] != a[i - 2]) diff = i if (i < 1 || a[i] =...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/atcoder/arc128/DKt.class", "javap": "Compiled from \"d.kt\"\npublic final class atcoder.arc128.DKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readLn:()Ljava/lang/String;\n 3: pop\n ...
mikhail-dvorkin__competitions__3095312/yandex/y2022/qual/d.kt
package yandex.y2022.qual import kotlin.random.Random fun main() { val (n, _) = readInts() val s = List(n) { readLn().map { "ACGT".indexOf(it) }.toIntArray() } .let { it.plus(IntArray(it[0].size)) } data class Edge(val u: Int, val v: Int, val len: Int) val edges = mutableListOf<Edge>() for (i in s.indices) for...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/yandex/y2022/qual/DKt$main$Edge.class", "javap": "Compiled from \"d.kt\"\npublic final class yandex.y2022.qual.DKt$main$Edge {\n private final int u;\n\n private final int v;\n\n private final int len;\n\n public yandex.y2022.qual.DKt$main$Edge(int...
mikhail-dvorkin__competitions__3095312/yandex/y2022/qual/e.kt
package yandex.y2022.qual import kotlin.random.Random fun main() { val (n, q) = readInts() val dsu = DisjointSetUnionRPS(n) val three = IntArray(n + 1) three[0] = 1 for (i in 1 until three.size) three[i] = (3 * three[i - 1].toModular()).x repeat(q) { val (uIn, vIn, resultIn) = readStrings() val u = uIn.toIn...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/yandex/y2022/qual/EKt.class", "javap": "Compiled from \"e.kt\"\npublic final class yandex.y2022.qual.EKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n 3: asto...
mikhail-dvorkin__competitions__3095312/yandex/y2022/finals/c.kt
package yandex.y2022.finals fun main() { val (a, m) = readLongs() val ps = mutableListOf<Long>() var b = a for (p in 2..b) { if (b == 1L) break if (p * p > b) { ps.add(b) break } if (b % p != 0L) continue ps.add(p) while (b % p == 0L) b /= p } var ans = Long.MAX_VALUE for (r in 0..2) { if ((...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/yandex/y2022/finals/CKt.class", "javap": "Compiled from \"c.kt\"\npublic final class yandex.y2022.finals.CKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readLongs:()Ljava/util/List;\n 3:...
mikhail-dvorkin__competitions__3095312/yandex/y2022/finals/a_small.kt
package yandex.y2022.finals import java.util.* import kotlin.math.sign fun main() { readLn() val our = readInts() val their = readInts() val e = List(our.size) { i -> IntArray(their.size) { j -> -(our[i] - their[j]).sign } } val h = hungarian(e) println(-h) } fun hungarian(e: List<IntArray>): Int { val ans = ...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/yandex/y2022/finals/A_smallKt.class", "javap": "Compiled from \"a_small.kt\"\npublic final class yandex.y2022.finals.A_smallKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readLn:()Ljava/lang/S...
mikhail-dvorkin__competitions__3095312/yandex/y2023/qual/b.kt
package yandex.y2023.qual private fun solve() { val (n, m) = readInts() val a = readInts() val aSorted = a.sorted() val y = aSorted[m - 1] val yTake = aSorted.take(m).count { it == y } val xDefinitely = a.indices.filter { a[it] < y } val xY = a.indices.filter { a[it] == y } val xLeft = xDefinitely.firstOrNull(...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/yandex/y2023/qual/BKt.class", "javap": "Compiled from \"b.kt\"\npublic final class yandex.y2023.qual.BKt {\n private static final void solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n 3: as...
mikhail-dvorkin__competitions__3095312/yandex/y2023/qual/d_wrong.kt
package yandex.y2023.qual private fun solve() { val (n, m) = readInts() val nei = List(2) { List(n + 1) { mutableListOf<Pair<Int, Int>>() } } repeat(m) { val tokens = readStrings() val a = tokens[0].toInt() - 1 val b = tokens[1].toInt() val greater = (tokens[2][0] == '>').toInt() val value = tokens[3].toI...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/yandex/y2023/qual/D_wrongKt.class", "javap": "Compiled from \"d_wrong.kt\"\npublic final class yandex.y2023.qual.D_wrongKt {\n private static final void solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/L...
mikhail-dvorkin__competitions__3095312/yandex/y2023/qual/d.kt
package yandex.y2023.qual private fun solve(): String { val (n, m) = readInts() data class Edge(val from: Int, val to: Int, val weight: Int) val edges = List(m) { val tokens = readStrings() val a = tokens[0].toInt() - 1 val b = tokens[1].toInt() val greater = (tokens[2][0] == '>') val value = tokens[3].to...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/yandex/y2023/qual/DKt.class", "javap": "Compiled from \"d.kt\"\npublic final class yandex.y2023.qual.DKt {\n private static final java.lang.String solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n...
mikhail-dvorkin__competitions__3095312/yandex/y2021/qual/e.kt
package yandex.y2021.qual fun main() { val (hei, wid) = readInts() val f = List(hei) { readLn().map { it - '0' } } val countZero = f.sumOf { row -> row.count { it == 0 } } val inf = hei * wid * 3 val a = List(wid + 1) { List(hei + 1) { IntArray(wid * hei + 1) { inf } } } for (y in 0..hei) a[0][y][0] = 0 for (x ...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/yandex/y2021/qual/EKt.class", "javap": "Compiled from \"e.kt\"\npublic final class yandex.y2021.qual.EKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n 3: asto...
mikhail-dvorkin__competitions__3095312/yandex/y2020/qual/c.kt
package yandex.y2020.qual private fun solve(): Boolean { readLn() val a = readInts().sorted() readLn() val b = readInts().sorted() if (a.size != b.size) return false if (a.isEmpty()) return true val aSame = a.all { it == a[0] } val bSame = b.all { it == b[0] } if (aSame && bSame) return true if (aSame || bSa...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/yandex/y2020/qual/CKt.class", "javap": "Compiled from \"c.kt\"\npublic final class yandex.y2020.qual.CKt {\n private static final boolean solve();\n Code:\n 0: invokestatic #10 // Method readLn:()Ljava/lang/String;\n 3:...
mikhail-dvorkin__competitions__3095312/yandex/y2020/qual/a.kt
package yandex.y2020.qual fun main() { val s = readLn() fun solve(s: String): Pair<Int, String>? { if (s.length == 1) return 0 to s if (s.length == 2) { if (s[0] == s[1]) return null return 0 to s } val (even, odd) = List(2) { s.filterIndexed { index, _ -> index % 2 == it } } if (even.all { it == eve...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/yandex/y2020/qual/AKt.class", "javap": "Compiled from \"a.kt\"\npublic final class yandex.y2020.qual.AKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readLn:()Ljava/lang/String;\n 3: asto...
mikhail-dvorkin__competitions__3095312/yandex/y2020/qual/e.kt
package yandex.y2020.qual import kotlin.random.Random fun main() { readLn() var treap: PersistentTreap? = null var ans = 0.toBigInteger() val a = readInts() println(a.mapIndexed { index, x -> ans += (PersistentTreap.split(treap, (x + 1L) * a.size)[1]?.sum ?: 0).toBigInteger() treap = PersistentTreap.add(trea...
[ { "class_path": "mikhail-dvorkin__competitions__3095312/yandex/y2020/qual/EKt.class", "javap": "Compiled from \"e.kt\"\npublic final class yandex.y2020.qual.EKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readLn:()Ljava/lang/String;\n 3: pop\...
Juuxel__Basiks__411506c/src/main/kotlin/juuxel/basiks/iterable/CombinedIterable.kt
package juuxel.basiks.iterable /** * A combined iterable of types [A] and [B]. * * @param outer the outer iterable of type [A] * @param inner the inner iterable of type [B] */ private class CombinedIterable<A, B>( private val outer: Iterable<A>, private val inner: Iterable<B> ): Iterable<Pair<A, B>> { ...
[ { "class_path": "Juuxel__Basiks__411506c/juuxel/basiks/iterable/CombinedIterable.class", "javap": "Compiled from \"CombinedIterable.kt\"\nfinal class juuxel.basiks.iterable.CombinedIterable<A, B> implements java.lang.Iterable<kotlin.Pair<? extends A, ? extends B>>, kotlin.jvm.internal.markers.KMappedMarker ...