kt_path stringlengths 35 167 | kt_source stringlengths 626 28.9k | classes listlengths 1 17 |
|---|---|---|
abdurakhmonoff__data-structures-and-algorithms-kotlin__cd9746d/src/algorithms/sorting/quick_sort/QuickSort.kt | package algorithms.sorting.quick_sort
/**
* Implementation of the quick sort algorithm for sorting a list of integers in ascending order.
*/
class QuickSort {
/**
* Sorts an array of integers in ascending order using QuickSort algorithm.
*
* @param arr the array to be sorted.
* @param low th... | [
{
"class_path": "abdurakhmonoff__data-structures-and-algorithms-kotlin__cd9746d/algorithms/sorting/quick_sort/QuickSort.class",
"javap": "Compiled from \"QuickSort.kt\"\npublic final class algorithms.sorting.quick_sort.QuickSort {\n public algorithms.sorting.quick_sort.QuickSort();\n Code:\n 0: al... |
afranken__advent-of-code-kotlin__0140f68/2021/src/main/kotlin/com/github/afranken/aoc/Day202104.kt | package com.github.afranken.aoc
object Day202104 {
fun part1(inputs: Array<String>): Int {
val draws = inputs[0].split(',')
val boards = inputs
.drop(1)
.filter { it.isNotEmpty() }
.chunked(5)
.map {
Board.of(it.map {
... | [
{
"class_path": "afranken__advent-of-code-kotlin__0140f68/com/github/afranken/aoc/Day202104$Board.class",
"javap": "Compiled from \"Day202104.kt\"\npublic final class com.github.afranken.aoc.Day202104$Board {\n public static final com.github.afranken.aoc.Day202104$Board$Companion Companion;\n\n private fi... |
afranken__advent-of-code-kotlin__0140f68/2021/src/main/kotlin/com/github/afranken/aoc/Day202106.kt | package com.github.afranken.aoc
object Day202106 {
fun part1(inputs: Array<String>): Long {
val fish = fishMap(inputs.map { Integer.valueOf(it) })
val agedFish = age(fish, 80)
return agedFish.values.sum()
}
fun part2(inputs: Array<String>): Long {
val fish = fishMap(inpu... | [
{
"class_path": "afranken__advent-of-code-kotlin__0140f68/com/github/afranken/aoc/Day202106.class",
"javap": "Compiled from \"Day202106.kt\"\npublic final class com.github.afranken.aoc.Day202106 {\n public static final com.github.afranken.aoc.Day202106 INSTANCE;\n\n private com.github.afranken.aoc.Day2021... |
afranken__advent-of-code-kotlin__0140f68/2021/src/main/kotlin/com/github/afranken/aoc/Day202103.kt | package com.github.afranken.aoc
import kotlin.math.pow
object Day202103 {
fun part1(inputs: Array<String>): Int {
//every input is expected to have the same size. Take inputs[0] to initialize.
val inputLength = inputs[0].length
val zeroes = IntArray(inputLength)
val ones = IntArra... | [
{
"class_path": "afranken__advent-of-code-kotlin__0140f68/com/github/afranken/aoc/Day202103.class",
"javap": "Compiled from \"Day202103.kt\"\npublic final class com.github.afranken.aoc.Day202103 {\n public static final com.github.afranken.aoc.Day202103 INSTANCE;\n\n private com.github.afranken.aoc.Day2021... |
afranken__advent-of-code-kotlin__0140f68/2021/src/main/kotlin/com/github/afranken/aoc/Day202105.kt | package com.github.afranken.aoc
object Day202105 {
fun part1(inputs: Array<String>): Int {
val coordinates = getCoordinates(inputs)
val matrix = createMatrix(coordinates)
coordinates.forEach {
val from = Pair(it[0], it[1])
val to = Pair(it[2], it[3])
m... | [
{
"class_path": "afranken__advent-of-code-kotlin__0140f68/com/github/afranken/aoc/Day202105.class",
"javap": "Compiled from \"Day202105.kt\"\npublic final class com.github.afranken.aoc.Day202105 {\n public static final com.github.afranken.aoc.Day202105 INSTANCE;\n\n private com.github.afranken.aoc.Day2021... |
afranken__advent-of-code-kotlin__0140f68/2021/src/main/kotlin/com/github/afranken/aoc/Day202108.kt | package com.github.afranken.aoc
object Day202108 {
fun part1(inputs: Array<String>): Int {
val input = convert(inputs)
var count = 0
input.forEach {
it.second.forEach {
when (it.length) {
2 -> count++ // 1
4 -> count++ //... | [
{
"class_path": "afranken__advent-of-code-kotlin__0140f68/com/github/afranken/aoc/Day202108.class",
"javap": "Compiled from \"Day202108.kt\"\npublic final class com.github.afranken.aoc.Day202108 {\n public static final com.github.afranken.aoc.Day202108 INSTANCE;\n\n private static final java.util.Map<java... |
somei-san__atcoder-kotline__43ea45f/src/lib/lib.kt | package lib
import java.util.*
// 約数のList
fun divisor(value: Long): List<Long> {
val max = Math.sqrt(value.toDouble()).toLong()
return (1..max)
.filter { value % it == 0L }
.map { listOf(it, value / it) }
.flatten()
.sorted()
}
// 範囲内の素数を取得
// fromだけ指定すると戻り値の個数で素数判定ができる
fun pr... | [
{
"class_path": "somei-san__atcoder-kotline__43ea45f/lib/LibKt.class",
"javap": "Compiled from \"lib.kt\"\npublic final class lib.LibKt {\n public static final java.util.List<java.lang.Long> divisor(long);\n Code:\n 0: lload_0\n 1: l2d\n 2: invokestatic #14 // Method j... |
sollecitom__chassis__e4e3403/logger/core/src/main/kotlin/org/sollecitom/chassis/logger/core/implementation/datastructure/Trie.kt | package org.sollecitom.chassis.logger.core.implementation.datastructure
internal interface Trie {
/**
* Returns the word in the trie with the longest prefix in common to the given word.
*/
fun searchLongestPrefixWord(word: String): String
/**
* Returns the longest prefix in the trie common... | [
{
"class_path": "sollecitom__chassis__e4e3403/org/sollecitom/chassis/logger/core/implementation/datastructure/Trie$Mutable.class",
"javap": "Compiled from \"Trie.kt\"\npublic interface org.sollecitom.chassis.logger.core.implementation.datastructure.Trie$Mutable extends org.sollecitom.chassis.logger.core.imp... |
mdenburger__aoc-2021__e890eec/src/main/kotlin/day07/Day07.kt | package day07
import java.io.File
import kotlin.math.abs
import kotlin.math.min
fun main() {
println("Answer 1: " + minimumFuel(::constantCost))
println("Answer 2: " + minimumFuel(::increasingCost))
}
fun minimumFuel(cost: (positions: List<Int>, position: Int) -> Int): Int {
val positions = File("src/mai... | [
{
"class_path": "mdenburger__aoc-2021__e890eec/day07/Day07Kt.class",
"javap": "Compiled from \"Day07.kt\"\npublic final class day07.Day07Kt {\n public static final void main();\n Code:\n 0: new #8 // class java/lang/StringBuilder\n 3: dup\n 4: invokespecial #... |
mdenburger__aoc-2021__e890eec/src/main/kotlin/day04/Day04.kt | package day04
import java.io.File
fun main() {
val lines = File("src/main/kotlin/day04/day04-input.txt").readLines().toMutableList()
val numbers = lines.removeAt(0).split(",").map { it.toInt() }
val boards = mutableListOf<Board>()
while (lines.isNotEmpty()) {
boards.add(parseBoard(lines))
... | [
{
"class_path": "mdenburger__aoc-2021__e890eec/day04/Day04Kt.class",
"javap": "Compiled from \"Day04.kt\"\npublic final class day04.Day04Kt {\n public static final void main();\n Code:\n 0: new #8 // class java/io/File\n 3: dup\n 4: ldc #10 ... |
mdenburger__aoc-2021__e890eec/src/main/kotlin/day05/Day05.kt | package day05
import java.io.File
fun main() {
val lines: List<Line> = File("src/main/kotlin/day05/day05-input.txt")
.readLines()
.map { it.split(" -> ") }
.map { Line(it.first().asPoint(), it.last().asPoint()) }
println("Part 1: " + countOverlappingPoints(lines.filter { it.isHorizont... | [
{
"class_path": "mdenburger__aoc-2021__e890eec/day05/Day05Kt.class",
"javap": "Compiled from \"Day05.kt\"\npublic final class day05.Day05Kt {\n public static final void main();\n Code:\n 0: new #8 // class java/io/File\n 3: dup\n 4: ldc #10 ... |
chimbersaw__debtislav__be24597/src/main/kotlin/com/chimber/debtislav/util/Graph.kt | package com.chimber.debtislav.util
data class Edge<T>(val a: T, val b: T, var weight: Int)
class Graph<T>(edgesList: List<Edge<T>>) {
val edges: MutableList<Edge<T>>
private var start: T? = null
init {
val edgeMap = HashMap<Pair<T, T>, Int>()
for (edge in edgesList) {
edgeMap.... | [
{
"class_path": "chimbersaw__debtislav__be24597/com/chimber/debtislav/util/Graph.class",
"javap": "Compiled from \"Graph.kt\"\npublic final class com.chimber.debtislav.util.Graph<T> {\n private final java.util.List<com.chimber.debtislav.util.Edge<T>> edges;\n\n private T start;\n\n public com.chimber.deb... |
NyCodeGHG__regenbogen-ice__65738ee/bot/src/main/kotlin/util/DamerauLevenshtein.kt | package dev.nycode.regenbogenice.util
import kotlin.math.min
/**
* Calculates the string distance between source and target strings using
* the Damerau-Levenshtein algorithm. The distance is case-sensitive.
*
* @param source The source String.
* @param target The target String.
* @return The distance between so... | [
{
"class_path": "NyCodeGHG__regenbogen-ice__65738ee/dev/nycode/regenbogenice/util/DamerauLevenshteinKt$minByDistanceOrNull$1.class",
"javap": "Compiled from \"DamerauLevenshtein.kt\"\npublic final class dev.nycode.regenbogenice.util.DamerauLevenshteinKt$minByDistanceOrNull$1 implements kotlin.jvm.functions.... |
woody-lam__git-training-rebasing__c9c8885/src/main/kotlin/com/gitTraining/Fibbonaci.kt | package com.gitTraining
fun computeFibbonaciNumber(position: Int?, recursion: Boolean = false): Int {
if (recursion) return recursiveFibbonachi(position!!)
var notNullPosition = position
if (notNullPosition == null) {
notNullPosition = 1
}
if (position == 0) return 0
if (position != nul... | [
{
"class_path": "woody-lam__git-training-rebasing__c9c8885/com/gitTraining/FibbonaciKt.class",
"javap": "Compiled from \"Fibbonaci.kt\"\npublic final class com.gitTraining.FibbonaciKt {\n public static final int computeFibbonaciNumber(java.lang.Integer, boolean);\n Code:\n 0: iload_1\n 1: if... |
BobString__kotlin-exercises__a3ef283/src/com/talkspace/exercises/sum3.kt | package com.talkspace.exercises
// Write a function that takes as its arguments a sorted array of unique integers, `intArray`, and an integer, `int`, and returns 3 integers from `intArray` that sum up to `int`.
fun main(args: Array<String>) {
println(threeSum(listOf(-1, 2, 3, 4, 5, 7, 8, 12), 6)) // [4, 3, -1]
... | [
{
"class_path": "BobString__kotlin-exercises__a3ef283/com/talkspace/exercises/Sum3Kt.class",
"javap": "Compiled from \"sum3.kt\"\npublic final class com.talkspace.exercises.Sum3Kt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 ... |
cgnik__euler__fe70459/src/main/kotlin/com/zer0rez/euler/util/Util.kt | package com.zer0rez.euler.util
import kotlin.math.sqrt
fun Int.isDivisibleBy(i: Int): Boolean = this % i == 0
fun Int.isDivisibleByAll(i: IntArray): Boolean = i.all { this.isDivisibleBy(it) }
fun Long.isDivisibleBy(i: Long): Boolean = this % i == 0L
fun Long.isDivisibleByAny(i: Collection<Long>): Boolean = i.any { t... | [
{
"class_path": "cgnik__euler__fe70459/com/zer0rez/euler/util/UtilKt.class",
"javap": "Compiled from \"Util.kt\"\npublic final class com.zer0rez.euler.util.UtilKt {\n public static final boolean isDivisibleBy(int, int);\n Code:\n 0: iload_0\n 1: iload_1\n 2: irem\n 3: ifne ... |
zys0909__CodeLabs__869c7c2/src/com/leecode/array/Code1.kt | package com.leecode.array
/**
* 一个长度为n-1的递增排序数组中的所有数字都是唯一的,并且每个数字都在范围0~n-1之内。在范围0~n-1内的n个数字中有且只有一个数字不在该数组中,请找出这个数字。
如何在一个1到100的整数数组中找到丢失的数字? google, Amazon,tencent
示例 1:
输入: [0,1,3]
输出: 2
示例 2:
输入: [0,1,2]
输出: 3
示例 3:
输入: [0,1,2,3,4,5,6,7,9]
输出: 8
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/pro... | [
{
"class_path": "zys0909__CodeLabs__869c7c2/com/leecode/array/Code1Kt.class",
"javap": "Compiled from \"Code1.kt\"\npublic final class com.leecode.array.Code1Kt {\n public static final int missingNumber1(int[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String nums\n ... |
zys0909__CodeLabs__869c7c2/src/com/leecode/array/Code2.kt | package com.leecode.array
/**
找出数组中重复的数字。
在一个长度为 n 的数组 nums 里的所有数字都在 0~n-1 的范围内。数组中某些数字是重复的,但不知道有几个数字重复了,也不知道每个数字重复了几次。请找出数组中任意一个重复的数字。
示例 1:
输入:[2, 3, 1, 0, 2, 5, 3]
输出:2 或 3
限制:2 <= n <= 100000
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/shu-zu-zhong-zhong-fu-de-shu-zi-lcof
*/
/**
* 用一个容器装已经确定的数
... | [
{
"class_path": "zys0909__CodeLabs__869c7c2/com/leecode/array/Code2Kt.class",
"javap": "Compiled from \"Code2.kt\"\npublic final class com.leecode.array.Code2Kt {\n public static final int findRepeatNumber1(int[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String nums\n ... |
zys0909__CodeLabs__869c7c2/src/com/leecode/array/Code3.kt | package com.leecode.array
/**
输入一个整数数组,实现一个函数来调整该数组中数字的顺序,使得所有奇数位于数组的前半部分,所有偶数位于数组的后半部分。
示例:
输入:nums = [1,2,3,4]
输出:[1,3,2,4]
注:[3,1,2,4] 也是正确的答案之一。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/diao-zheng-shu-zu-shun-xu-shi-qi-shu-wei-yu-ou-shu-qian-mian-lcof
*/
/**
* 申请一个新数组,T(n) ,O(n)
*/
fun ex... | [
{
"class_path": "zys0909__CodeLabs__869c7c2/com/leecode/array/Code3Kt.class",
"javap": "Compiled from \"Code3.kt\"\npublic final class com.leecode.array.Code3Kt {\n public static final int[] exchange1(int[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String nums\n ... |
zys0909__CodeLabs__869c7c2/src/com/leecode/array/Code7.kt | package com.leecode.array
/**
给定一个排序数组,你需要在 原地 删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。
不要使用额外的数组空间,你必须在 原地 修改输入数组 并在使用 O(1) 额外空间的条件下完成。
示例 1:
给定数组 nums = [1,1,2],
函数应该返回新的长度 2, 并且原数组 nums 的前两个元素被修改为 1, 2。
你不需要考虑数组中超出新长度后面的元素。
示例 2:
给定 nums = [0,0,1,1,1,2,2,3,3,4],
函数应该返回新的长度 5, 并且原数组 nums 的前五个元素被修改为 0, 1, 2, 3, 4。
你不需要考虑数组... | [
{
"class_path": "zys0909__CodeLabs__869c7c2/com/leecode/array/Code7Kt.class",
"javap": "Compiled from \"Code7.kt\"\npublic final class com.leecode.array.Code7Kt {\n public static final void main();\n Code:\n 0: bipush 10\n 2: newarray int\n 4: astore_1\n 5: aload_1\n... |
vishal-sehgal__kotlin-coding-interview__f83e929/ctci/arrays_and_strings/_02_check_permutation/CheckPermutation.kt | package ctci.arrays_and_strings._02_check_permutation
/**
* #1.2
*
* Check Permutation: Given two strings, write a method to decide if one is a permutation
* of the other.
*/
class CheckPermutation {
/**
* Determines whether two given strings are permutations of each other.
*
* Time Complexit... | [
{
"class_path": "vishal-sehgal__kotlin-coding-interview__f83e929/ctci/arrays_and_strings/_02_check_permutation/CheckPermutation.class",
"javap": "Compiled from \"CheckPermutation.kt\"\npublic final class ctci.arrays_and_strings._02_check_permutation.CheckPermutation {\n public ctci.arrays_and_strings._02_c... |
vishal-sehgal__kotlin-coding-interview__f83e929/ctci/arrays_and_strings/_01_is_unique/IsUnique.kt | package ctci.arrays_and_strings._01_is_unique
/**
* #1.1
*
* Is Unique: Implement an algorithm to determine if a string has all unique characters.
* What if you can not use additional data structures?
*/
fun main() {
val string1 = "vishal"
val string2 = "sehgal"
val string3 = "linkedin"
val strin... | [
{
"class_path": "vishal-sehgal__kotlin-coding-interview__f83e929/ctci/arrays_and_strings/_01_is_unique/IsUnique.class",
"javap": "Compiled from \"IsUnique.kt\"\npublic final class ctci.arrays_and_strings._01_is_unique.IsUnique {\n public ctci.arrays_and_strings._01_is_unique.IsUnique();\n Code:\n ... |
mikhail-dvorkin__competitions__3095312/codechef/snackdown2021/round1a/d.kt | package codechef.snackdown2021.round1a
import kotlin.math.abs
private fun solve(): Int {
readLn()
val a = readInts().sorted()
if (a.size == 2) return 0
var ans = minOf(makeEqual(a.drop(1)), makeEqual(a.dropLast(1))).coerceInInt()
var i = 1
var j = a.lastIndex - 1
val borders = a[0] + a.last()
while (i < j) {
... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codechef/snackdown2021/round1a/DKt.class",
"javap": "Compiled from \"d.kt\"\npublic final class codechef.snackdown2021.round1a.DKt {\n private static final int solve();\n Code:\n 0: invokestatic #10 // Method readLn:()Ljava/l... |
mikhail-dvorkin__competitions__3095312/codechef/snackdown2021/qual/d_tl.kt | package codechef.snackdown2021.qual
private fun solve() {
val (n, m) = readInts()
val nei = List(n) { mutableListOf<Int>() }
repeat(m) {
val (u, v) = readInts().map { it - 1 }
nei[u].add(v); nei[v].add(u)
}
val degree = IntArray(n) { nei[it].size }
val byDegree = List(n) { mutableSetOf<Int>() }
for (v in ne... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codechef/snackdown2021/qual/D_tlKt.class",
"javap": "Compiled from \"d_tl.kt\"\npublic final class codechef.snackdown2021.qual.D_tlKt {\n private static final void solve();\n Code:\n 0: invokestatic #10 // Method readInts:()L... |
mikhail-dvorkin__competitions__3095312/codechef/snackdown2021/preelim/goodranking_randomized.kt | package codechef.snackdown2021.preelim
import java.util.*
private fun solve(magic: Int = 96): List<Int> {
val n = readInt()
val e = List(n) { readLn() }
val diff = (n + 1) / 2
fun won(i: Int, j: Int) = e[i][j] == '1'
val level = IntArray(n)
val r = Random(566)
var tries = 0
for (mid in e.indices.shuffled(r)) ... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codechef/snackdown2021/preelim/Goodranking_randomizedKt$solve$$inlined$sortBy$1.class",
"javap": "Compiled from \"Comparisons.kt\"\npublic final class codechef.snackdown2021.preelim.Goodranking_randomizedKt$solve$$inlined$sortBy$1<T> implements java.ut... |
mikhail-dvorkin__competitions__3095312/codechef/snackdown2021/preelim/slippers.kt | package codechef.snackdown2021.preelim
private const val MAX_S = 200_000
@Suppress("UNUSED_PARAMETER") // Kotlin 1.2
fun main(args: Array<String>) {
readLn()
val a = readInts()
val fenwickTree = FenwickTree(MAX_S + 1)
var ans = 1.toModular()
for (x in a) {
val added = 1 + fenwickTree.sum(x).toModular()
fenwi... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codechef/snackdown2021/preelim/SlippersKt.class",
"javap": "Compiled from \"slippers.kt\"\npublic final class codechef.snackdown2021.preelim.SlippersKt {\n private static final int MAX_S;\n\n public static final void main(java.lang.String[]);\n Co... |
mikhail-dvorkin__competitions__3095312/codechef/snackdown2021/preelim/guessrow.kt | package codechef.snackdown2021.preelim
import java.util.*
@Suppress("UNUSED_PARAMETER") // Kotlin 1.2
fun main(args: Array<String>) {
val (tests, n) = readInts()
val desired = n / 2
val all = 1..n
val cnk = List(n + 1) { LongArray(it + 1) { 1 } }
for (i in 2..n) for (j in 1 until i) cnk[i][j] = cnk[i - 1][j - 1... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codechef/snackdown2021/preelim/GuessrowKt.class",
"javap": "Compiled from \"guessrow.kt\"\npublic final class codechef.snackdown2021.preelim.GuessrowKt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc... |
mikhail-dvorkin__competitions__3095312/codechef/snackdown2021/preelim/decsubk.kt | package codechef.snackdown2021.preelim
private fun solve(): IntArray {
val (_, k) = readInts()
val a = readInts().sorted()
val b = IntArray(a.size)
val used = BooleanArray(a.size)
for (x in a.indices) {
fun isGood(i: Int): Boolean {
b[x] = a[i]
var y = x + 1
for (j in a.indices) if (!used[j] && j != i)... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codechef/snackdown2021/preelim/DecsubkKt.class",
"javap": "Compiled from \"decsubk.kt\"\npublic final class codechef.snackdown2021.preelim.DecsubkKt {\n private static final int[] solve();\n Code:\n 0: invokestatic #10 // Met... |
mikhail-dvorkin__competitions__3095312/workshops/moscow_prefinals2020/day4/k.kt | package workshops.moscow_prefinals2020.day4
fun main() {
val (n, m) = readInts()
val g = MutableList(n) { DoubleArray(n) }
repeat(m) {
val (uIn, vIn, resistance) = readInts()
for ((u, v) in listOf(uIn, vIn).map { it - 1 }.withReversed()) {
g[u][v] += 1.0 / resistance
g[u][u] -= 1.0 / resistance
}
}
va... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/workshops/moscow_prefinals2020/day4/KKt.class",
"javap": "Compiled from \"k.kt\"\npublic final class workshops.moscow_prefinals2020.day4.KKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInt... |
mikhail-dvorkin__competitions__3095312/workshops/moscow_prefinals2020/day4/c.kt | package workshops.moscow_prefinals2020.day4
fun main() {
val s = readLine()!!
val initMask = s.reversed().replace("(", "0").replace(")", "1").toLong(2)
val memo = List(s.length + 1) { mutableMapOf<Long, Double>() }
memo[0][0] = 1.0
fun solve(n: Int, mask: Long): Double {
memo[n][mask]?.also { return it }
if (... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/workshops/moscow_prefinals2020/day4/CKt.class",
"javap": "Compiled from \"c.kt\"\npublic final class workshops.moscow_prefinals2020.day4.CKt {\n public static final void main();\n Code:\n 0: invokestatic #12 // Method kotlin/... |
mikhail-dvorkin__competitions__3095312/workshops/moscow_prefinals2020/day3/k.kt | package workshops.moscow_prefinals2020.day3
fun main() {
val (x, y, z) = List(3) { readInts().drop(1).reversed() }
var (low, high) = maxOf((x + y + z).maxOrNull()!!, 1).toLong() to Long.MAX_VALUE / 2
binarySearch@while (low + 1 < high) {
val b = (low + high) / 2
val zNew = LongArray(z.size)
var tooLarge = fal... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/workshops/moscow_prefinals2020/day3/KKt.class",
"javap": "Compiled from \"k.kt\"\npublic final class workshops.moscow_prefinals2020.day3.KKt {\n public static final void main();\n Code:\n 0: iconst_3\n 1: istore_1\n 2: new ... |
mikhail-dvorkin__competitions__3095312/workshops/moscow_prefinals2020/day3/l.kt | package workshops.moscow_prefinals2020.day3
private fun solve() {
val a = mutableMapOf<Int, MutableMap<Int, Int>>()
var ans = 0
repeat(readInt()) {
val (s, vIn) = readStrings()
val v = vIn.toInt()
if (v <= 0) return@repeat
val hashing = Hashing(s)
var maxSeen = 0
for (len in a.keys) if (len < s.length) ... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/workshops/moscow_prefinals2020/day3/LKt.class",
"javap": "Compiled from \"l.kt\"\npublic final class workshops.moscow_prefinals2020.day3.LKt {\n private static final int M;\n\n private static final void solve();\n Code:\n 0: new #8... |
mikhail-dvorkin__competitions__3095312/workshops/moscow_prefinals2020/day3/e.kt | package workshops.moscow_prefinals2020.day3
private typealias State = Int
private fun solve() {
val (hei, wid) = readInts()
val field = List(hei) { readLn().toCharArray() }
val state = IntArray(hei) { -1 }
fun arrayToInt(): Int {
var m = 0
for (i in 0 until hei) {
val bits = state[i] and 15
m = m or (b... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/workshops/moscow_prefinals2020/day3/EKt.class",
"javap": "Compiled from \"e.kt\"\npublic final class workshops.moscow_prefinals2020.day3.EKt {\n private static final void solve();\n Code:\n 0: invokestatic #10 // Method readI... |
mikhail-dvorkin__competitions__3095312/codeforces/round584/e1.kt | package codeforces.round584
private fun solve() {
val (n, m) = readInts()
val a = List(n) { readInts() }
val b = List(m) { i -> a.map { it[i] } }.sortedByDescending { it.maxOrNull() }.take(n)
println(solve(b, 1, b[0]))
}
private fun solve(b: List<List<Int>>, x: Int, best: List<Int>): Int {
val bestInit = best.su... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round584/E1Kt.class",
"javap": "Compiled from \"e1.kt\"\npublic final class codeforces.round584.E1Kt {\n private static final void solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n ... |
mikhail-dvorkin__competitions__3095312/codeforces/round584/f.kt | package codeforces.round584
private const val M = 1_000_000_007
fun main() {
val (n, m) = readInts()
val nei = List(n) { mutableListOf<Pair<String, Int>>() }
repeat(m) { i ->
val label = (i + 1).toString()
val (a, b) = readInts().map { it - 1 }
nei[a].add(label to b)
nei[b].add(label to a)
}
val gap = m.... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round584/FKt.class",
"javap": "Compiled from \"f.kt\"\npublic final class codeforces.round584.FKt {\n private static final int M;\n\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readIn... |
mikhail-dvorkin__competitions__3095312/codeforces/round773/b.kt | package codeforces.round773
private fun solve() {
readInt()
val a = readInts().toIntArray()
val groups = a.groupBy { it }
if (groups.values.any { it.size % 2 != 0 }) return println(-1)
var start = 0
val insertions = mutableListOf<Pair<Int, Int>>()
val tandems = mutableListOf<Int>()
var x = 0
while (start < a.... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round773/BKt.class",
"javap": "Compiled from \"b.kt\"\npublic final class codeforces.round773.BKt {\n private static final void solve();\n Code:\n 0: invokestatic #10 // Method readInt:()I\n 3: pop\n 4:... |
mikhail-dvorkin__competitions__3095312/codeforces/round576/e.kt | package codeforces.round576
fun main() {
val (n, rectNum) = readInts()
val rectangles = Array(rectNum) { readInts() }
val xSet = mutableSetOf(0, n)
val ySet = mutableSetOf(0, n)
for ((x1, y1, x2, y2) in rectangles) {
xSet.add(x1 - 1)
xSet.add(x2)
ySet.add(y1 - 1)
ySet.add(y2)
}
val xs = xSet.sorted()
v... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round576/EKt.class",
"javap": "Compiled from \"e.kt\"\npublic final class codeforces.round576.EKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n 3: ... |
mikhail-dvorkin__competitions__3095312/codeforces/round576/d.kt | package codeforces.round576
fun main() {
val n = readInt()
val f = Array(n) { readLn().map { if (it == '#') 1 else 0 } }
val cum = Array(n + 1) { IntArray(n + 1) }
for (i in 0 until n) {
for (j in 0 until n) {
cum[i + 1][j + 1] = cum[i][j + 1] + cum[i + 1][j] - cum[i][j] + f[i][j]
}
}
val dp = Array(n + 1... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round576/DKt.class",
"javap": "Compiled from \"d.kt\"\npublic final class codeforces.round576.DKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInt:()I\n 3: istore_0\n ... |
mikhail-dvorkin__competitions__3095312/codeforces/round631/c.kt | package codeforces.round631
private fun solve(): String {
val (h, g) = readInts()
val a = (listOf(0) + readInts()).toIntArray()
val bottomLevel = 1 shl (h - 1)
tailrec fun siftDown(i: Int, act: Boolean): Int {
val j = if (i >= bottomLevel) 0 else if (a[2 * i] >= a[2 * i + 1]) 2 * i else 2 * i + 1
if (act) a[i]... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round631/CKt.class",
"javap": "Compiled from \"c.kt\"\npublic final class codeforces.round631.CKt {\n private static final java.lang.String solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/Lis... |
mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes1/f.kt | package codeforces.kotlinheroes1
fun main() {
val (n, m, canIncrease) = readInts()
val a = readInts().sorted()
val acc = mutableListOf(0L)
for (i in 0 until n) { acc.add(acc[i] + a[i]) }
var ans = a.fold(0L, Long::plus)
for (left in 0..n - m) {
var low = a[left]
var high = a[lef... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes1/FKt.class",
"javap": "Compiled from \"f.kt\"\npublic final class codeforces.kotlinheroes1.FKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n... |
mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes6/c.kt | package codeforces.kotlinheroes6
import kotlin.math.abs
private fun solve() {
val (n, xIn, yIn) = readInts()
val (x, y) = listOf(xIn, yIn).sorted().map { it - 1 }
val ans = List(n) { m ->
maxOf(solve(0, m, x), solve(m, n, y))
}.minOrNull()
println(ans)
}
private fun solve(from: Int, to: Int, x: Int): Int {
i... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes6/CKt.class",
"javap": "Compiled from \"c.kt\"\npublic final class codeforces.kotlinheroes6.CKt {\n private static final void solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;... |
mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes6/g_wrong.kt | package codeforces.kotlinheroes6
import java.util.*
import kotlin.system.exitProcess
fun main() {
for (n in 1..20) solve(n)
solve(readInt())
}
private fun solve(n: Int) {
val set = List(2 * n + 1) { TreeSet<Int>() }
val score = IntArray(n + 1) { 0 }
val divs = List(n + 1) { mutableListOf<Int>() }
for (i in 1..n... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes6/G_wrongKt.class",
"javap": "Compiled from \"g_wrong.kt\"\npublic final class codeforces.kotlinheroes6.G_wrongKt {\n public static final void main();\n Code:\n 0: iconst_1\n 1: istore_0\n 2: iload_0\n ... |
mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes6/e.kt | package codeforces.kotlinheroes6
private fun solve() {
readLn()
val a = readInts()
val st = SegmentsTreeMax(a.size)
val seen = IntArray(a.size + 1) { -1 }
for (i in a.indices) {
val x = a[i]
val prev = seen[x]
if (prev == -1) {
seen[x] = i
continue
}
val best = maxOf(st.get(prev, i), if (prev + 1 ... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes6/EKt.class",
"javap": "Compiled from \"e.kt\"\npublic final class codeforces.kotlinheroes6.EKt {\n private static final void solve();\n Code:\n 0: invokestatic #10 // Method readLn:()Ljava/lang/String;... |
mikhail-dvorkin__competitions__3095312/codeforces/round606/c.kt | package codeforces.round606
import kotlin.math.sqrt
fun main() {
readLn()
val a = readInts()
val groups = a.groupBy { it }.toList().sortedByDescending { it.second.size }
val b = groups.map { it.second.size }
var bSelf = b.size
var bSum = 0
val (h, w) = (1..sqrt(a.size.toDouble()).toInt()).map { h ->
while (b... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round606/CKt.class",
"javap": "Compiled from \"c.kt\"\npublic final class codeforces.round606.CKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readLn:()Ljava/lang/String;\n 3: ... |
mikhail-dvorkin__competitions__3095312/codeforces/round637/b.kt | package codeforces.round637
private val digits = listOf("1110111", "0010010", "1011101", "1011011", "0111010",
"1101011", "1101111", "1010010", "1111111", "1111011").map { it.toInt(2) }
fun main() {
val (n, k) = readInts()
val a = List(n) {
val shown = readLn().toInt(2)
digits.mapIndexedNotNull { d, digit ->
... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round637/BKt.class",
"javap": "Compiled from \"b.kt\"\npublic final class codeforces.round637.BKt {\n private static final java.util.List<java.lang.Integer> digits;\n\n public static final void main();\n Code:\n 0: invokestatic #... |
mikhail-dvorkin__competitions__3095312/codeforces/round637/c.kt | package codeforces.round637
fun main() {
readLn()
val d = readInts().sorted()
val (g, r) = readInts()
val inf = Int.MAX_VALUE
val mark = Array(g) { BooleanArray(d.size) { false } }
val queue = Array(g) { IntArray(d.size) }
val queueLow = IntArray(g)
val queueHigh = IntArray(g)
mark[0][0] = true
queueHigh[0] ... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round637/CKt.class",
"javap": "Compiled from \"c.kt\"\npublic final class codeforces.round637.CKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readLn:()Ljava/lang/String;\n 3: ... |
mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes8/i.kt | package codeforces.kotlinheroes8
import java.util.*
private fun solve() {
val n = readInt()
val (from, toIn) = List(2) { readInts() }
data class Doctor(val id: Int, val from: Int, val to: Int)
val doctors = List(n) { Doctor(it, from[it], toIn[it] + 1) }
val low = doctors.sortedBy { it.from }.withIndex().maxOf { ... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes8/IKt$solve$Doctor.class",
"javap": "Compiled from \"i.kt\"\npublic final class codeforces.kotlinheroes8.IKt$solve$Doctor {\n private final int id;\n\n private final int from;\n\n private final int to;\n\n public codeforces.k... |
mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes8/h.kt | package codeforces.kotlinheroes8
fun main() {
val den = 1_000_000.toModular()
val (n, wid, hei) = readInts()
val (pSlash, pBackslash) = List(2) { Array(wid + hei + 1) { 1.toModular() } } // prob of being free
val (vertical, horizontal) = listOf(wid, hei).map { s -> BooleanArray(s + 1).also { it[0] = true; it[s] = ... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes8/HKt.class",
"javap": "Compiled from \"h.kt\"\npublic final class codeforces.kotlinheroes8.HKt {\n public static final void main();\n Code:\n 0: ldc #7 // int 1000000\n 2: invokestatic ... |
mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes8/e.kt | package codeforces.kotlinheroes8
private fun solve(): Int {
val n = readInt()
val s = readLn().map { "()".indexOf(it) }
val a = readLn()
val must = IntArray(n) { -1 }
val diff = BooleanArray(n)
for (i in a.indices) {
if (a[i] == '0') continue
if (must[i] == 1) return -1
must[i] = 0
must[i + 3] = 1
diff... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes8/EKt.class",
"javap": "Compiled from \"e.kt\"\npublic final class codeforces.kotlinheroes8.EKt {\n private static final int solve();\n Code:\n 0: invokestatic #9 // Method readInt:()I\n 3: istor... |
mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes8/g.kt | 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]) }
... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes8/GKt$main$$inlined$sortedBy$1.class",
"javap": "Compiled from \"Comparisons.kt\"\npublic final class codeforces.kotlinheroes8.GKt$main$$inlined$sortedBy$1<T> implements java.util.Comparator {\n public codeforces.kotlinheroes8.G... |
mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes8/f.kt | 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... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes8/FKt.class",
"javap": "Compiled from \"f.kt\"\npublic final class codeforces.kotlinheroes8.FKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n... |
mikhail-dvorkin__competitions__3095312/codeforces/globalround5/d.kt | 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) {
... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/globalround5/DKt.class",
"javap": "Compiled from \"d.kt\"\npublic final class codeforces.globalround5.DKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInt:()I\n 3: istore_0... |
mikhail-dvorkin__competitions__3095312/codeforces/round614/b.kt | 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(... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round614/BKt.class",
"javap": "Compiled from \"b.kt\"\npublic final class codeforces.round614.BKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readLongs:()Ljava/util/List;\n 3:... |
mikhail-dvorkin__competitions__3095312/codeforces/round614/c.kt | 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(... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round614/CKt.class",
"javap": "Compiled from \"c.kt\"\npublic final class codeforces.round614.CKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInt:()I\n 3: istore_0\n ... |
mikhail-dvorkin__competitions__3095312/codeforces/round614/d.kt | package codeforces.round614
fun main() {
readLn()
val a = readInts()
val aCount = a.groupBy { it }.mapValues { it.value.size }
var b = aCount.keys.toList()
val (primes, factPrimes) = List(2) { MutableList(2) { listOf<Int>() } }
for (i in 2..b.maxOrNull()!!) {
val j = (2..i).first { i % it == 0 }
primes.add(p... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round614/DKt.class",
"javap": "Compiled from \"d.kt\"\npublic final class codeforces.round614.DKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readLn:()Ljava/lang/String;\n 3: ... |
mikhail-dvorkin__competitions__3095312/codeforces/educationalround95/e.kt | package codeforces.educationalround95
fun main() {
val M = 998244353
val (n, m) = readInts()
val d = readInts().sorted()
val sum = d.sumOf { it.toLong() }
val ab = List(m) { readInts() }.withIndex().sortedBy { -it.value[1] }
var i = n - 1
var large = 0
var sumLarge = 0L
val ans = IntArray(m)
for (p in ab) {
... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/educationalround95/EKt$main$$inlined$sortedBy$1.class",
"javap": "Compiled from \"Comparisons.kt\"\npublic final class codeforces.educationalround95.EKt$main$$inlined$sortedBy$1<T> implements java.util.Comparator {\n public codeforces.educa... |
mikhail-dvorkin__competitions__3095312/codeforces/polynomial2022/e_slow.kt | package codeforces.polynomial2022
fun main() {
val (n, d) = readInts()
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 arrays = List(2) { readInts().drop(1).map { it - 1 } }
val needed = List(2) { BooleanArray(n).also { it[... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/polynomial2022/E_slowKt.class",
"javap": "Compiled from \"e_slow.kt\"\npublic final class codeforces.polynomial2022.E_slowKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInts:()L... |
mikhail-dvorkin__competitions__3095312/codeforces/polynomial2022/b_slow.kt | package codeforces.polynomial2022
import java.util.TreeSet
private fun solve(): String {
val (n, _, k) = readInts()
val a = readInts()
val allow = LongArray(n) { -1 }
val allowed = TreeSet<Long>()
fun encode(count: Int, index: Int) = (count.toLong() shl 32) + index.toLong()
for (i in a.indices) {
allowed.add(... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/polynomial2022/B_slowKt.class",
"javap": "Compiled from \"b_slow.kt\"\npublic final class codeforces.polynomial2022.B_slowKt {\n private static final java.lang.String solve();\n Code:\n 0: invokestatic #10 // Metho... |
mikhail-dvorkin__competitions__3095312/codeforces/polynomial2022/d.kt | package codeforces.polynomial2022
import java.lang.StringBuilder
private fun solve() {
val (hei, wid) = readInts()
val a = List(hei) { readInts() }
val aSum = a.map { it.sum() }.toIntArray()
val totalOnes = aSum.sum()
if (totalOnes % hei != 0) return println(-1)
val needOnes = totalOnes / hei
val ans = StringB... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/polynomial2022/DKt.class",
"javap": "Compiled from \"d.kt\"\npublic final class codeforces.polynomial2022.DKt {\n private static final void solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/Lis... |
mikhail-dvorkin__competitions__3095312/codeforces/deltix2021summer/b.kt | package codeforces.deltix2021summer
import kotlin.math.abs
private fun solve(a: List<Int>, first: Int): Long {
val aIndices = a.indices.filter { a[it] == 1 }
val neededIndices = a.indices.filter { it % 2 == 1 - first }
return aIndices.zip(neededIndices) { x, y -> abs(x - y).toLong() }.sum()
}
private fun solve(): ... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/deltix2021summer/BKt.class",
"javap": "Compiled from \"b.kt\"\npublic final class codeforces.deltix2021summer.BKt {\n private static final long solve(java.util.List<java.lang.Integer>, int);\n Code:\n 0: aload_0\n 1: checkcas... |
mikhail-dvorkin__competitions__3095312/codeforces/deltix2021summer/d.kt | package codeforces.deltix2021summer
fun ask(or: Boolean, i: Int, j: Int): Int {
val s = if (or) "or" else "and"
println("$s ${i + 1} ${j + 1}")
return readInt()
}
fun main() {
val (n, k) = readInts()
val (ands, ors) = List(2) { or -> List(n - 1) { ask(or == 1, 0, it + 1) } }
val and12 = ask(false, 1, 2)
val a ... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/deltix2021summer/DKt.class",
"javap": "Compiled from \"d.kt\"\npublic final class codeforces.deltix2021summer.DKt {\n public static final int ask(boolean, int, int);\n Code:\n 0: iload_0\n 1: ifeq 9\n 4: ldc ... |
mikhail-dvorkin__competitions__3095312/codeforces/deltix2021summer/f.kt | package codeforces.deltix2021summer
fun main() {
readLn()
val strengths = readInts().map { it.toModular() }
val n = strengths.size
val probWin = Array(n) { i -> Array(n) { j -> strengths[i] / (strengths[i] + strengths[j]) } }
val masks = 1 shl n
val pScc = Array(masks) { 1.toModular() }
var ans = 0.toModular()
... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/deltix2021summer/FKt.class",
"javap": "Compiled from \"f.kt\"\npublic final class codeforces.deltix2021summer.FKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readLn:()Ljava/lang/Str... |
mikhail-dvorkin__competitions__3095312/codeforces/round580/d.kt | package codeforces.round580
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)
}
nei.indices.flatMap { v ->
val (sizes, vertices) = nei[v].map { Pair(dfs(it, setOf(v), 0, nei), it) }.sortedBy { it.fir... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round580/DKt$main$lambda$7$$inlined$sortedBy$1.class",
"javap": "Compiled from \"Comparisons.kt\"\npublic final class codeforces.round580.DKt$main$lambda$7$$inlined$sortedBy$1<T> implements java.util.Comparator {\n public codeforces.round58... |
mikhail-dvorkin__competitions__3095312/codeforces/round580/c.kt | package codeforces.round580
fun main() {
val n = readInt()
val a = List(n) { IntArray(n) }
a[0][0] = 1
propagate3(0, 1, 1, 2, a)
propagate3(1, 2, 1, 0, a)
for (i in a.indices) {
for (j in a.indices) {
if (i + j in setOf(0, 1, 2 * n - 2) || i == 1 && j == 2) continue
val ii = maxOf(i - 2, 0)
val jj = i... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round580/CKt.class",
"javap": "Compiled from \"c.kt\"\npublic final class codeforces.round580.CKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInt:()I\n 3: istore_0\n ... |
mikhail-dvorkin__competitions__3095312/codeforces/round783/b_wrong.kt | package codeforces.round783
import kotlin.math.sign
fun solve(a: List<Int>): Int {
val pref = mutableListOf(0L)
val prefIndex = mutableListOf(0)
val prefIndexRight = mutableListOf(0)
var prefSum = 0L
val dp = IntArray(a.size + 1)
for (i in a.indices) {
prefSum -= a[i]
dp[i + 1] = dp[i] + a[i].sign
if (pre... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round783/B_wrongKt.class",
"javap": "Compiled from \"b_wrong.kt\"\npublic final class codeforces.round783.B_wrongKt {\n public static final int solve(java.util.List<java.lang.Integer>);\n Code:\n 0: aload_0\n 1: ldc ... |
mikhail-dvorkin__competitions__3095312/codeforces/round740/b.kt | package codeforces.round740
fun main() {
val (n, m) = readInts()
Modular.M = m
val primeDivisors = primeDivisors(n)
val a = Array(n + 1) { it.toModular() }
for (i in 3..n) {
a[i] = 1 + 2 * a[i - 1]
for (r in divisorsOf(i, primeDivisors)) {
if (r == 1 || r == i) continue
a[i] += a[r] - a[r - 1]
}
}
p... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round740/BKt.class",
"javap": "Compiled from \"b.kt\"\npublic final class codeforces.round740.BKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n 3: ... |
mikhail-dvorkin__competitions__3095312/codeforces/round572/c.kt | package codeforces.round572
private const val M = 998244353
private fun solve() {
val (n, m) = readInts()
val a = readInts().sorted()
val maxDiff = (a.last() - a.first()) / (m - 1)
val d = Array(m) { IntArray(n + 1) }
var ans = 0
for (diff in 1..maxDiff) {
var iPrev = 0
for (i in a.indices) {
while (a[i]... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round572/CKt.class",
"javap": "Compiled from \"c.kt\"\npublic final class codeforces.round572.CKt {\n private static final int M;\n\n private static final void solve();\n Code:\n 0: invokestatic #10 // Method read... |
mikhail-dvorkin__competitions__3095312/codeforces/round572/a2.kt | package codeforces.round572
private fun solve() {
val n = readInt()
val nei = List(n) { mutableListOf<Edge>() }
repeat(n - 1) {
val (aInput, bInput, value) = readInts()
val a = aInput - 1
val b = bInput - 1
nei[a].add(Edge(a, b, value))
nei[b].add(Edge(b, a, value))
}
if (nei.any { it.size == 2 }) {
p... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round572/A2Kt.class",
"javap": "Compiled from \"a2.kt\"\npublic final class codeforces.round572.A2Kt {\n private static final void solve();\n Code:\n 0: invokestatic #10 // Method readInt:()I\n 3: istore_0\n ... |
mikhail-dvorkin__competitions__3095312/codeforces/ozon2020/f.kt | package codeforces.ozon2020
import kotlin.random.Random
val r = Random(566)
fun main() {
readLn()
val a = readStrings().map { it.toLong() }.shuffled(r)
val toCheck = List(1 shl 6) { a[it % a.size] + r.nextInt(3) - 1 }.toSet()
val primes = toCheck.flatMap { primes(it) }.toSet().sorted()
val ans = primes.fold(a.s... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/ozon2020/FKt.class",
"javap": "Compiled from \"f.kt\"\npublic final class codeforces.ozon2020.FKt {\n private static final kotlin.random.Random r;\n\n public static final kotlin.random.Random getR();\n Code:\n 0: getstatic #11... |
mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes3/h.kt | package codeforces.kotlinheroes3
private fun solve() {
val s = readLn()
val inf = (s.maxOrNull()!! + 1).toString()
val init = listOf(listOf(inf to listOf<Boolean>()), listOf("" to listOf()))
val ans = s.foldIndexed(init) { i, (sure, unsure), c ->
val next = List(2) { MutableList(i + 1) { inf to listOf<Boolean>()... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes3/HKt.class",
"javap": "Compiled from \"h.kt\"\npublic final class codeforces.kotlinheroes3.HKt {\n private static final void solve();\n Code:\n 0: invokestatic #10 // Method readLn:()Ljava/lang/String;... |
mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes3/f.kt | package codeforces.kotlinheroes3
private fun solve() {
val (n, m) = readInts()
data class Segment(val start: Int, val end: Int, val id: Int)
val segments = List(n) { val data = readInts(); Segment(data[0], data[1], it) }
val byOpening = segments.sortedByDescending { it.start }.toMutableList()
val ans = MutableLis... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes3/FKt$solve$$inlined$sortedByDescending$1.class",
"javap": "Compiled from \"Comparisons.kt\"\npublic final class codeforces.kotlinheroes3.FKt$solve$$inlined$sortedByDescending$1<T> implements java.util.Comparator {\n public code... |
mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes3/e.kt | package codeforces.kotlinheroes3
private fun solve() {
val (n, k) = readInts()
val nei = List(n) { mutableSetOf<Int>() }
repeat(n - 1) {
val (u, v) = readInts().map { it - 1 }
nei[u].add(v); nei[v].add(u)
}
val leaves = nei.indices.filter { nei[it].size == 1 }.toMutableList()
if (k == 1) return println("Yes\... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes3/EKt.class",
"javap": "Compiled from \"e.kt\"\npublic final class codeforces.kotlinheroes3.EKt {\n private static final void solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;... |
mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes3/g.kt | package codeforces.kotlinheroes3
private val digits = 1..9
fun main() {
val (m, kIn) = readInts()
listOf(2, 3, 5, 7).fold(m) { acc, p ->
var temp = acc
while (temp % p == 0) temp /= p
temp
}.takeIf { it == 1 } ?: return println(-1)
val memo = mutableMapOf<Pair<Int, Int>, Long>()
fun count(m: Int, len: Int... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes3/GKt.class",
"javap": "Compiled from \"g.kt\"\npublic final class codeforces.kotlinheroes3.GKt {\n private static final kotlin.ranges.IntRange digits;\n\n public static final void main();\n Code:\n 0: invokestatic #1... |
mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes4/i.kt | package codeforces.kotlinheroes4
fun main() {
val (n, m, _, sIn) = readInts()
val s = sIn - 1
val a = readInts()
val inf = n * n * n
val e = List(n) { IntArray(n) { inf } }
repeat(m) {
val (u, v) = readInts().map { it - 1 }
e[u][v] = 1
}
for (k in e.indices) for (i in e.indices) for (j in e.indices) e[i][... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes4/IKt.class",
"javap": "Compiled from \"i.kt\"\npublic final class codeforces.kotlinheroes4.IKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n... |
mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes4/g.kt | package codeforces.kotlinheroes4
private fun solve(p: List<Int>, x: List<Int>): List<Int>? {
val k = (0..x.size - 3).minByOrNull { x[it + 2] - x[it] }
?: return listOf(x[0], p[0], x[1], p[0])
for (i in k..k + 2) for (j in k until i) for (aPeriod in p) {
val rem = x[i] % aPeriod
if (x[j] % aPeriod != rem) conti... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes4/GKt.class",
"javap": "Compiled from \"g.kt\"\npublic final class codeforces.kotlinheroes4.GKt {\n private static final java.util.List<java.lang.Integer> solve(java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer... |
mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes2/g.kt | package codeforces.kotlinheroes2
private fun solve() {
val n = readInt()
val flag = readInts()
val want = readInts()
val changed = flag.zip(want) { a, b -> a != b }
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 w = chan... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/kotlinheroes2/GKt.class",
"javap": "Compiled from \"g.kt\"\npublic final class codeforces.kotlinheroes2.GKt {\n private static final void solve();\n Code:\n 0: invokestatic #10 // Method readInt:()I\n 3: isto... |
mikhail-dvorkin__competitions__3095312/codeforces/round633/b.kt | package codeforces.round633
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 mark = BooleanArray(n)
val dist = IntArray(n)
fun dfs(v: Int) {
mark[v] = true
for (u in nei[v]) if (!mark[u]) {... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round633/BKt.class",
"javap": "Compiled from \"b.kt\"\npublic final class codeforces.round633.BKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInt:()I\n 3: istore_0\n ... |
mikhail-dvorkin__competitions__3095312/codeforces/round633/d.kt | package codeforces.round633
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 canTake = IntArray(n) { 1 }
val cannotTake = IntArray(n)
val canTakeAnswer = IntArray(n) { 1 }
val cannotTakeAnswer... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round633/DKt.class",
"javap": "Compiled from \"d.kt\"\npublic final class codeforces.round633.DKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInt:()I\n 3: istore_0\n ... |
mikhail-dvorkin__competitions__3095312/codeforces/globalround8/e.kt | package codeforces.globalround8
private fun solve(out: List<MutableList<Int>>): String {
val layer = IntArray(out.size)
for (u in out.indices) {
if (layer[u] == 2) continue
for (v in out[u]) layer[v] = maxOf(layer[v], layer[u] + 1)
}
val ans = layer.indices.filter { layer[it] == 2 }
return "${ans.size}\n${ans... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/globalround8/EKt.class",
"javap": "Compiled from \"e.kt\"\npublic final class codeforces.globalround8.EKt {\n private static final java.lang.StringBuilder output;\n\n private static final java.lang.String solve(java.util.List<? extends jav... |
mikhail-dvorkin__competitions__3095312/codeforces/round616/c.kt | package codeforces.round616
fun solve(k: Int, toSwitch: List<Int>, where: List<List<Int>>): List<Int> {
val p = MutableList(k) { it }
val odd = MutableList(k) { 0 }
val d = List(k) { mutableListOf(0, 1) }
fun get(x: Int): Int {
if (p[x] == x) return x
val par = p[x]
p[x] = get(par)
odd[x] = odd[x] xor odd[... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round616/CKt.class",
"javap": "Compiled from \"c.kt\"\npublic final class codeforces.round616.CKt {\n public static final java.util.List<java.lang.Integer> solve(int, java.util.List<java.lang.Integer>, java.util.List<? extends java.util.Lis... |
mikhail-dvorkin__competitions__3095312/codeforces/round872/c_to_upsolve.kt | package codeforces.round872
import java.util.*
fun main() {
val n = readInt()
val a = readInts()
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 price = IntArray(n)
val niceXor = IntArray(n)
val temp = TreeSet<Int>()
val... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round872/C_to_upsolveKt.class",
"javap": "Compiled from \"c_to_upsolve.kt\"\npublic final class codeforces.round872.C_to_upsolveKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readIn... |
mikhail-dvorkin__competitions__3095312/codeforces/round680/a.kt | package codeforces.round680
private fun solve(): Long {
val (p, q) = readLongs()
if (p % q != 0L) return p
val xs = primeFactorization(q)
var ans = 1L
for (i in xs) {
var pp = p
while (pp % q == 0L && pp % i == 0L) pp /= i
if (pp % q != 0L) ans = maxOf(ans, pp)
}
return ans
}
fun primeFactorization(n: Lo... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round680/AKt.class",
"javap": "Compiled from \"a.kt\"\npublic final class codeforces.round680.AKt {\n private static final long solve();\n Code:\n 0: invokestatic #10 // Method readLongs:()Ljava/util/List;\n ... |
mikhail-dvorkin__competitions__3095312/codeforces/codeton6/c.kt | package codeforces.codeton6
private fun solve() {
val (_, k) = readInts()
fun rightmost(a: List<Int>): IntArray {
val res = IntArray(k) { -1 }
for (i in a.indices) res[a[i]] = i
for (i in k - 2 downTo 0) res[i] = maxOf(res[i], res[i + 1])
return res
}
val a = readInts().map { it - 1 }
val present = Boolea... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/codeton6/CKt.class",
"javap": "Compiled from \"c.kt\"\npublic final class codeforces.codeton6.CKt {\n private static final void solve();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n 3... |
mikhail-dvorkin__competitions__3095312/codeforces/codeton6/e.kt | package codeforces.codeton6
import java.util.BitSet
private fun solve(): Int {
readln()
val a = readInts()
val highMex = (a.size + 1).takeHighestOneBit() * 2
val mark = IntArray(a.size + 1) { -1 }
val memo = List(highMex) { BitSet() }
val dp = mutableListOf(BitSet())
val (dpMax, dpSum) = List(2) { IntArray(a.s... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/codeton6/EKt.class",
"javap": "Compiled from \"e.kt\"\npublic final class codeforces.codeton6.EKt {\n private static final int solve();\n Code:\n 0: invokestatic #12 // Method kotlin/io/ConsoleKt.readln:()Ljava/lan... |
mikhail-dvorkin__competitions__3095312/codeforces/codeton6/e_tl.kt | package codeforces.codeton6
private fun solve(): Int {
readln()
val a = readInts()
val mark = IntArray(a.size + 1) { -1 }
val dp0 = mutableSetOf(0)
val dp = MutableList(a.size + 1) { dp0 }
val dpMax = IntArray(a.size + 1) { 0 }
val dpHashCode = IntArray(a.size + 1) { 0 }
val used = mutableSetOf<Long>()
var le... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/codeton6/E_tlKt.class",
"javap": "Compiled from \"e_tl.kt\"\npublic final class codeforces.codeton6.E_tlKt {\n private static final int solve();\n Code:\n 0: invokestatic #12 // Method kotlin/io/ConsoleKt.readln:()... |
mikhail-dvorkin__competitions__3095312/codeforces/codeton6/f.kt | package codeforces.codeton6
val toBaseArray = LongArray(Long.SIZE_BITS)
private fun solve(): Long {
val (n, k) = readLongs()
val threshold = (n + 1) / k
fun timesK(m: Long) = if (m <= threshold) m * k else n + 1
fun toBase(m: Long): Int {
var i = 0
var mm = m
do {
toBaseArray[i++] = mm % k
mm /= k
... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/codeton6/FKt.class",
"javap": "Compiled from \"f.kt\"\npublic final class codeforces.codeton6.FKt {\n private static final long[] toBaseArray;\n\n public static final long[] getToBaseArray();\n Code:\n 0: getstatic #11 ... |
mikhail-dvorkin__competitions__3095312/codeforces/round626/b.kt | package codeforces.round626
fun main() {
readLn()
var a = readInts().sorted()
val powers = a.last().toString(2).length downTo 0
val ans = powers.sumBy { k ->
val two = 1 shl k
val res = (1..4).sumBy { countLess(a, it * two) } and 1
a = a.map { it and two - 1 }.sorted()
two * res
}
println(ans)
}
private... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round626/BKt.class",
"javap": "Compiled from \"b.kt\"\npublic final class codeforces.round626.BKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readLn:()Ljava/lang/String;\n 3: ... |
mikhail-dvorkin__competitions__3095312/codeforces/round626/c.kt | package codeforces.round626
import java.io.*
private fun solve(): Long {
val (n, m) = readInts()
val c = readLongs()
val nei = List(n) { mutableListOf<Int>() }
repeat(m) {
val (u, v) = readInts().map { it - 1 }
nei[v].add(u)
}
val hashed = nei.map { it.sorted().fold(1L) { acc: Long, x: Int -> acc * 566239L ... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round626/CKt.class",
"javap": "Compiled from \"c.kt\"\npublic final class codeforces.round626.CKt {\n private static final java.io.BufferedReader in;\n\n private static final long solve();\n Code:\n 0: invokestatic #10 ... |
mikhail-dvorkin__competitions__3095312/codeforces/globalround20/f1.kt | package codeforces.globalround20
private fun solve() {
val n = readInt()
val a = readInts()
val count = IntArray(n + 1)
val pos = List(n + 1) { mutableListOf<Int>() }
for (i in a.indices) {
count[a[i]]++
pos[a[i]].add(i)
}
val often = count.indices.sortedBy { count[it] }
val mostOften = often.last()
val a... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/globalround20/F1Kt$solve$$inlined$sortedBy$1.class",
"javap": "Compiled from \"Comparisons.kt\"\npublic final class codeforces.globalround20.F1Kt$solve$$inlined$sortedBy$1<T> implements java.util.Comparator {\n final int[] $count$inlined;\n... |
mikhail-dvorkin__competitions__3095312/codeforces/globalround7/e.kt | package codeforces.globalround7
fun main() {
val n = readInt()
val p = readInts().map { it - 1 }
val q = readInts().map { it - 1 }
val pRev = IntArray(n)
for (i in p.indices) pRev[p[i]] = i
val st = SegmentsTreeSimple(2 * n)
var alive = n
val ans = q.map {
while (st.getMinBalance() >= 0) st[2 * n - 2 * pRev... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/globalround7/EKt.class",
"javap": "Compiled from \"e.kt\"\npublic final class codeforces.globalround7.EKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInt:()I\n 3: istore_0... |
mikhail-dvorkin__competitions__3095312/codeforces/globalround7/d.kt | package codeforces.globalround7
private fun solve() {
val s = readLn()
var i = 0
while (i < s.length - 1 - i && s[i] == s[s.length - 1 - i]) i++
println(s.take(i) + solve(s.drop(i).dropLast(i)) + s.takeLast(i))
}
private fun solve(s: String): String {
val n = s.length
val h = Hashing(s + s.reversed())
for (i i... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/globalround7/DKt.class",
"javap": "Compiled from \"d.kt\"\npublic final class codeforces.globalround7.DKt {\n private static final int M;\n\n private static final void solve();\n Code:\n 0: invokestatic #10 // Met... |
mikhail-dvorkin__competitions__3095312/codeforces/round621/e.kt | package codeforces.round621
const val M = 1_000_000_007
fun main() {
val (n, m) = readInts()
val a = readInts().map { it - 1 }
val indices = List(n) { mutableListOf<Int>() }
for (x in a.indices) { indices[a[x]].add(x) }
val eaters = List(n) { mutableSetOf<Int>() }
repeat(m) {
val (id, hunger) = readInts().map... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round621/EKt.class",
"javap": "Compiled from \"e.kt\"\npublic final class codeforces.round621.EKt {\n public static final int M;\n\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInt... |
mikhail-dvorkin__competitions__3095312/codeforces/round621/d.kt | package codeforces.round621
fun main() {
val (n, m, _) = readInts()
val special = readInts().map { it - 1 }
val nei = List(n) { mutableListOf<Int>() }
repeat(m) {
val (u, v) = readInts().map { it - 1 }
nei[u].add(v); nei[v].add(u)
}
val (s, t) = listOf(0, n - 1).map { bfs(nei, it) }
val best = special.sorte... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round621/DKt.class",
"javap": "Compiled from \"d.kt\"\npublic final class codeforces.round621.DKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method readInts:()Ljava/util/List;\n 3: ... |
mikhail-dvorkin__competitions__3095312/codeforces/globalround16/d.kt | package codeforces.globalround16
private fun solve() {
val (hei, wid) = readInts()
val a = readInts()
val places = mutableMapOf<Int, MutableList<Pair<Int, Int>>>()
val aSorted = a.sorted()
for (i in aSorted.indices) {
places.getOrPut(aSorted[i]) { mutableListOf() }.add(i / wid to i % wid)
}
places.forEach { (... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/globalround16/DKt$solve$lambda$2$$inlined$sortBy$1.class",
"javap": "Compiled from \"Comparisons.kt\"\npublic final class codeforces.globalround16.DKt$solve$lambda$2$$inlined$sortBy$1<T> implements java.util.Comparator {\n final int $wid$in... |
mikhail-dvorkin__competitions__3095312/codeforces/globalround16/f.kt | package codeforces.globalround16
private fun solve() {
val (_, m) = readInts()
val points = readInts().sorted()
val segments = List(m) { readInts().let { it[0] to it[1] } }
val groups = List(points.size + 1) { mutableListOf<Pair<Int, Int>>() }
for (segment in segments) {
val index = (-1..points.size).binarySear... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/globalround16/FKt$solve$$inlined$sortBy$1.class",
"javap": "Compiled from \"Comparisons.kt\"\npublic final class codeforces.globalround16.FKt$solve$$inlined$sortBy$1<T> implements java.util.Comparator {\n public codeforces.globalround16.FKt... |
mikhail-dvorkin__competitions__3095312/codeforces/globalround16/e.kt | package codeforces.globalround16
private fun solve() {
val n = readInt()
val nei = List(n) { mutableListOf<Int>() }
repeat(n - 1) {
val (v, u) = readInts().map { it - 1 }
nei[v].add(u)
nei[u].add(v)
}
val kids = IntArray(n)
val isLeaf = BooleanArray(n)
val isBud = BooleanArray(n)
var ans = 0
fun dfs(v: ... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/globalround16/EKt.class",
"javap": "Compiled from \"e.kt\"\npublic final class codeforces.globalround16.EKt {\n private static final void solve();\n Code:\n 0: invokestatic #10 // Method readInt:()I\n 3: isto... |
mikhail-dvorkin__competitions__3095312/codeforces/round901/b.kt | package codeforces.round901
private fun precalc(mask: Int): IntArray {
val (a, b, m) = listOf(0x55, 0x33, 0x0F).map { it and mask }
val source = a with b
val queue = mutableListOf<Int>()
val dist = IntArray(1 shl 14) { -1 }
queue.add(source)
dist[source] = 0
var low = 0
while (low < queue.size) {
val v = que... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round901/BKt.class",
"javap": "Compiled from \"b.kt\"\npublic final class codeforces.round901.BKt {\n private static final java.util.List<int[]> precalc;\n\n private static final int[] precalc(int);\n Code:\n 0: iconst_3\n 1... |
mikhail-dvorkin__competitions__3095312/codeforces/round901/d_ok_but_should_be_wa.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 kBest = 0
for (s in d[i].indices) {
val range = maxOf(kBest - 5, 0)..minOf(kBest + 11, s)
var best = Double.MAX_VALUE
for (k in range) {
val new = (... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round901/D_ok_but_should_be_waKt.class",
"javap": "Compiled from \"d_ok_but_should_be_wa.kt\"\npublic final class codeforces.round901.D_ok_but_should_be_waKt {\n private static final double solve();\n Code:\n 0: invokestatic #10 ... |
mikhail-dvorkin__competitions__3095312/codeforces/round901/b_slow.kt | package codeforces.round901
private fun solve() {
fun encode(a: Int, b: Int) = (a.toLong() shl 32) or b.toLong()
val (a, b, c, d, m) = readIntArray()
val source = encode(a, b)
val dest = encode(c, d)
val queue = mutableListOf<Long>()
val dist = mutableMapOf<Long, Int>()
queue.add(source)
dist[source] = 0
var ... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round901/B_slowKt.class",
"javap": "Compiled from \"b_slow.kt\"\npublic final class codeforces.round901.B_slowKt {\n private static final java.io.BufferedReader in;\n\n private static final java.io.BufferedWriter out;\n\n private static f... |
mikhail-dvorkin__competitions__3095312/codeforces/round901/c.kt | package codeforces.round901
private fun precalc(n: Int = 5000): List<DoubleArray> {
val p = List(n + 1) { DoubleArray(it) }
for (i in 1..n) {
p[i][0] = 1.0 / i
for (j in 1 until i) {
if (j >= 2) p[i][j] = (j - 1.0) / i * p[i - 2][j - 2]
if (j < i - 1) p[i][j] += (i - j - 1.0) / i * p[i - 2][j - 1]
}
}
... | [
{
"class_path": "mikhail-dvorkin__competitions__3095312/codeforces/round901/CKt.class",
"javap": "Compiled from \"c.kt\"\npublic final class codeforces.round901.CKt {\n private static final java.util.List<double[]> precalc;\n\n private static final java.util.List<double[]> precalc(int);\n Code:\n ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.