source_code
stringlengths
26
62k
lang_cluster
stringclasses
11 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
difficulty
int32
-1
3.5k
exec_outcome
stringclasses
1 value
fun main() { val (n1, n2, m) = readLine()!!.split(' ').map { it.toInt() } val k = readLine()!!.split(' ').map { it.toInt() } // size == n1 val map = MutableList(n2) { mutableListOf<Int>() } repeat(m) { val (x, y) = readLine()!!.split(' ').map { it.toInt() - 1 } map[y].add(x) }...
Kotlin
5af6d6c2bd70a1122de56503a91cc9a5
b1d88465e779625366b017bc96df29e1
-1
PASSED
import java.io.* import java.util.* import kotlin.math.* val input = BufferedReader(InputStreamReader(System.`in`)) val output = StringBuilder() fun main() { var (n1, n2, m) = ints() var k = ints() var uf = dsu(n1 + n2) for (i in 0..n1 - 1) { uf.v[i] = k[i] } for (i in 0....
Kotlin
5af6d6c2bd70a1122de56503a91cc9a5
57b12667248b2db663fd5eda8bf2b60b
-1
PASSED
import java.io.* import java.util.* import kotlin.math.* val input = BufferedReader(InputStreamReader(System.`in`)) val output = StringBuilder() // editorial fun main() { var (n1, n2, m) = ints() var k = longs() var z = n1 + n2 var fg = mcmf(z + 2, z, z + 1) for (i in 0..n1 - 1) { ...
Kotlin
5af6d6c2bd70a1122de56503a91cc9a5
c20d7d80bd5fdb45688b81c2efe129f2
-1
PASSED
import kotlin.math.min private fun readLn() = readLine()!! private fun readInt() = readLn().toInt() private fun readStrings() = readLn().split(" ") private fun readInts() = readStrings().map { it.toInt() } private fun readLong() = readLn().toLong() private fun readLongs() = readStrings().map { it.toLong() } ...
Kotlin
5af6d6c2bd70a1122de56503a91cc9a5
51319363dd337d58e783e932a794dd34
-1
PASSED
import java.io.BufferedReader import java.io.InputStreamReader import java.io.PrintWriter import java.util.* fun sortBy(a: IntArray, n: Int, v: IntArray) { if (n == 0) { return } for (i in 1 until n) { var j = i val ca = a[i] val cv = v[ca] do { val nj = ...
Kotlin
5af6d6c2bd70a1122de56503a91cc9a5
1f84f0b176f80748bfd941abfc949ec3
-1
PASSED
import java.util.Queue import java.util.LinkedList fun main() { val (n1, n2, m) = readLine()!!.split(" ").map { it.toInt() } val S = n1 + n2 val T = S + 1 val V = T + 1 data class Edge(val y : Int, val c : Int, var f : Int, val cost : Int) val e = ArrayList<Edge>() val g = Array(V) { Ar...
Kotlin
5af6d6c2bd70a1122de56503a91cc9a5
b2dbaa59244f237116f9f15411641a5b
-1
PASSED
import java.lang.AssertionError private fun readLn() = readLine()!! // string line private fun readInt() = readLn().toInt() // single int private fun readLong() = readLn().toLong() // single long private fun readDouble() = readLn().toDouble() // single double private fun readStrings() = readLn().split(" ") // li...
Kotlin
5af6d6c2bd70a1122de56503a91cc9a5
71ca6c9dae928fc57e79bfd3eb3d21c2
-1
PASSED
import java.io.BufferedReader import java.io.InputStream import java.io.InputStreamReader import java.lang.Integer.min import java.util.* import kotlin.collections.HashMap import kotlin.math.max class MyReader(inputStream: InputStream) { private val reader = BufferedReader(InputStreamReader(inputStream)) ...
Kotlin
5af6d6c2bd70a1122de56503a91cc9a5
8b146301c79cf6c960a3de365b746507
-1
PASSED
import java.io.BufferedReader import java.io.InputStream import java.io.InputStreamReader import java.lang.Integer.min import java.util.* import kotlin.collections.HashMap import kotlin.math.max class MyReader(inputStream: InputStream) { private val reader = BufferedReader(InputStreamReader(inputStream)) ...
Kotlin
5af6d6c2bd70a1122de56503a91cc9a5
03f4dc0d9ddba986b2f6a2e3448becaa
-1
PASSED
import java.io.BufferedReader import java.io.InputStreamReader import kotlin.time.ExperimentalTime import kotlin.time.measureTime class IntStack(size: Int) { private val array = IntArray(size) private var ptr = 0 fun add(x: Int) { array[ptr++] = x } fun last(): Int = array[pt...
Kotlin
b5e4a0534213da1719abb0fa54ae3b57
da4e3e14cd2dc08e918ca4b66c1fac4e
-1
PASSED
import kotlin.jvm.JvmStatic import java.io.BufferedReader import java.util.StringTokenizer import java.io.IOException import java.io.InputStreamReader import java.lang.Exception object programkt { var scanner = FastScanner() const val full = (1 shl 5) - 1 @JvmStatic fun main(args: Array<Stri...
Kotlin
b5e4a0534213da1719abb0fa54ae3b57
29f232bdbce0e56799ad207c178a1487
-1
PASSED
import java.util.* fun main(){ val (N, M) = readLine()!!.split(" ").map { it.toInt() } val S = Array<String>(N, {""}) for(i in 0 until N)S[i] = readLine()!! val B = Array<BooleanArray>(N, { BooleanArray(M) }) val max = 1 shl 5 val cnt = LongArray(max, {0}) for(mask in 1 until max...
Kotlin
b5e4a0534213da1719abb0fa54ae3b57
5b5eb9f9b2bfe00f7210fa2c412fb8c4
-1
PASSED
import java.io.* import java.util.* //https://codeforces.com/contest/1532/submission/120882023 class FastScanner { var br: BufferedReader? = null var st: StringTokenizer? = null constructor(f: File?) { try { br = BufferedReader(FileReader(f)) } catch (e: FileNotFound...
Kotlin
b5e4a0534213da1719abb0fa54ae3b57
017e1b318da18edbe7f258a8e3bb10ab
-1
PASSED
import java.util.* import kotlin.Comparator import kotlin.collections.HashMap // Thanks BenQ! /* sorting * 1 (ok) val a = nextLongs().sorted() // a is mutable list * 2 (ok) val a = arrayListOf<Long>() // or ArrayList<Long>() a.addAll(nextLongs()) a.sort() * 3 (ok) val A = nextLongs() val a = Arr...
Kotlin
b5e4a0534213da1719abb0fa54ae3b57
998aa7476e52c82dad97c691d8db2cbe
-1
PASSED
import java.io.BufferedReader import java.io.InputStreamReader import java.util.* fun main() { val jin = BufferedReader(InputStreamReader(System.`in`)) val (n, m) = jin.readLine().split(" ").map { it.toInt() } val matrix = Array(n) { jin.readLine().map { 1 shl (it - 'A') } } val above = Array(n + 1) { ...
Kotlin
b5e4a0534213da1719abb0fa54ae3b57
ada12c3c7f444d38651a77817bd68383
-1
PASSED
// taken from purplecrayon import java.util.* /** IO */ //@JvmField val ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null //const val PATH = "src/main/resources/" //@JvmField val INPUT = File(PATH + "input.txt").inputStream() //@JvmField val OUTPUT = File(PATH + "output.txt").outputStream() private...
Kotlin
b5e4a0534213da1719abb0fa54ae3b57
8d9f1636e8cc3fdc71411231d69e81da
-1
PASSED
import kotlin.math.*; import java.util.*; class Main(val input : InputReader){ fun solve() { var (n : Int,m : Int) = input.nextInts(); var a : Array < CharArray > = Array < CharArray > (n + 2) {CharArray (m + 2) }; for(i in 1..n){ val s : String = input.next(); ...
Kotlin
b5e4a0534213da1719abb0fa54ae3b57
a450061d5ebb729aad64cc75c34e0030
-1
PASSED
import kotlin.math.*; import java.util.*; class Main(val input : InputReader){ fun solve() { var (n : Int,m : Int) = input.nextInts(); var a : Array < CharArray > = Array < CharArray > (n + 2) {CharArray (m + 2) }; for(i in 1..n){ val s : String = input.next(); ...
Kotlin
b5e4a0534213da1719abb0fa54ae3b57
fc706365f25b4fc36bdca73873fa1627
-1
PASSED
import java.util.* import kotlin.collections.ArrayList import kotlin.math.* import kotlin.random.Random fun readInt(): Int{return readLine()!!.toInt()} fun readLong(): Long{return readLine()!!.toLong()} fun readList(): MutableList<Int> {return readLine()!!.split(' ').map{it.toInt()}.toMutableList()} fun readLi...
Kotlin
b5e4a0534213da1719abb0fa54ae3b57
e9b3f5960d879b7a393a451cea5576a8
-1
PASSED
// ref: Heltion fun main() { repeat(readLine()!!.toInt()) { val (n, m) = readInts(2) val a = Array(n) { readInts(m) } val ans = mutableListOf<Int>() val visited = mutableSetOf(0) fun dfs(y: Int, x: Int): Boolean { val id = a.getOrNull(y)?.getOrNull(x) ?:...
Kotlin
2b66858fef223f21246b4ac102940f6b
52436f88187b8eb3a7fbf4d23a946975
-1
PASSED
// ref: Heltion fun main() { repeat(readLine()!!.toInt()) { val (n, m) = readInts(2) val a = Array(n) { readInts(m) } val ans = mutableListOf<Int>() val visited = mutableSetOf(0) fun dfs(y: Int, x: Int): Boolean { val id = a.getOrNull(y)?.getOrNull(x) ?:...
Kotlin
2b66858fef223f21246b4ac102940f6b
f9583c904fe6aa89a691c4a840b3610d
-1
PASSED
// ref: Heltion fun main() { repeat(readLine()!!.toInt()) { val (n, m) = readInts(2) val a = Array(n) { readInts(m) } val ans = mutableListOf<Int>() val visited = mutableSetOf<Int>() fun dfs(y: Int, x: Int): Boolean { val id = a[y, x, 0] ret...
Kotlin
2b66858fef223f21246b4ac102940f6b
a64cc333aeccfd776013cc285ef32e00
-1
PASSED
// ref: Heltion fun main() { repeat(readLine()!!.toInt()) { val (n, m) = readInts(2) val a = Array(n) { readInts(m) } val visited = Array(n) { Array(m) { false } } val ans = mutableListOf<Int>() fun dfs(y: Int, x: Int): Boolean = if (!visited[y, x, false] && a[y, x, ...
Kotlin
2b66858fef223f21246b4ac102940f6b
83f3827d235bcc3db584653dacc10ce6
-1
PASSED
fun main(){ val t=readLine()!!.toInt() for (tests in 0..t-1){ val (n,m) = readLine()!!.split(' ').map { it.toInt() } val MAP=Array(n) {IntArray(m) } for (i in 0..n-1){ val X=readLine()!!.split(' ').map { it.toInt() } for (j in 0..m-1){ ...
Kotlin
2b66858fef223f21246b4ac102940f6b
1379575db1e3bad75198e8bc1faf9a7a
-1
PASSED
import java.io.* import java.util.* object Main { var `in`: IO? = null var out: PrintWriter? = null @Throws(Exception::class) fun init_io(filename: String) { if (filename == "") { `in` = IO(System.`in`) out = PrintWriter(BufferedWriter(OutputStreamWriter(Syst...
Kotlin
2b66858fef223f21246b4ac102940f6b
4510c09c8db636bc2b457ffd0ea11ce9
-1
PASSED
//region TEMPLATE @file:Suppress("CanBeVal") import java.io.*; import java.io.BufferedReader import java.util.* fun main(args: Array<String>) { if (args.isNotEmpty() && args.first() == "file") { out = PrintWriter(FileWriter("output.txt")) reader = BufferedReader(FileReader("input.txt")) ...
Kotlin
2b66858fef223f21246b4ac102940f6b
ffd12247fa6b29f5bbc435b8ee3d2eb4
-1
PASSED
import java.io.File import java.io.PrintWriter import java.util.StringTokenizer import kotlin.math.* import kotlin.random.* //@JvmField val OUTPUT = File("output.txt").outputStream() @JvmField val OUTPUT = System.out //@JvmField val INPUT = File("input.txt").inputStream() @JvmField val INPUT = System.`in`...
Kotlin
2b66858fef223f21246b4ac102940f6b
0e3d2d621cdb98184080d2d899712d62
-1
PASSED
import java.util.* private fun readLn() = readLine()!! // string line private fun readInt() = readLn().toInt() // single int private fun readLong() = readLn().toLong() // single long private fun readDouble() = readLn().toDouble() // single double private fun readStrings() = readLn().split(" ") // list of strings ...
Kotlin
2b66858fef223f21246b4ac102940f6b
6e68bc0e920986e2b49ba357c2698f65
-1
PASSED
fun main() { val out = StringBuilder() repeat(readLine()!!.toInt()) { val (n, m) = readLine()!!.split(" ").map { it.toInt() } val biomes = Array(n) { readLine()!!.split(" ").map { it.toInt() } } val adj = Array(101) { mutableListOf<Int>() } fun addEdge(a: Int, b: Int) { ...
Kotlin
2b66858fef223f21246b4ac102940f6b
19d917f93f7573e6e41494ab9719dfb0
-1
PASSED
// ref: Anumish fun main() { val s = readLine()!!.map { it - '0' }.toIntArray() val (pos0, pos1) = s.indices.partition { s[it] == 0 }.toList().map(List<Int>::toIntArray) val acc0 = s.runningFold(0) { acc, i -> acc + 1 - i }.toIntArray() for (k in 1..s.size) { generateSequence(0) { i -> ...
Kotlin
66d71e440675c7454ca7c50072db5f91
333451344d6381509b0e1d2f76997946
-1
PASSED
fun main() { val s = readLine()!!.map { it - '0' }.toIntArray() val (pos0, pos1) = s.indices.partition { s[it] == 0 }.toList().map(List<Int>::toIntArray) val acc0 = s.runningFold(0) { acc, i -> acc + 1 - i }.toIntArray() (1..s.size).map { k -> generateSequence(0) { i -> val v0 ...
Kotlin
66d71e440675c7454ca7c50072db5f91
b990f5f8f551750d726edc263aed6428
-1
PASSED
fun main() { val s = readLine()!!.map { it - '0' } val (pos0, pos1) = s.indices.partition { s[it] == 0 }.toList().map(List<Int>::toIntArray) val acc0 = s.runningFold(0) { acc, i -> acc + 1 - i }.toIntArray() (1..s.size).map { k -> var count = 1 var i = 0 while (acc0[i] + k...
Kotlin
66d71e440675c7454ca7c50072db5f91
1643b15c10647ec178c344dff924bc10
-1
PASSED
fun main() { val s = readLine()!!.map { it - '0' } val (pos0, pos1) = s.indices.partition { s[it] == 0 }.toList().map(List<Int>::toIntArray) val acc0 = s.runningFold(0) { acc, i -> acc + 1 - i }.toIntArray() (1..s.size).map { k -> generateSequence(0) { i -> if (acc0[i] + k > po...
Kotlin
66d71e440675c7454ca7c50072db5f91
b7010e7358c36c92a01acfb9786ef340
-1
PASSED
fun main() { val s = readLine()!!.map { it - '0' } val (pos0, pos1) = s.indices.partition { s[it] == 0 }.toList().map(List<Int>::toIntArray) val acc0 = s.runningFold(0) { acc, i -> acc + 1 - i }.toIntArray() (1..s.size).map { k -> generateSequence(0) { i -> val v0 = pos0.getOrN...
Kotlin
66d71e440675c7454ca7c50072db5f91
8b0be7152b3bd1da05a926c2b0fb1cc7
-1
PASSED
fun main() { val s = readLine()!!.map { it - '0' }.toIntArray() val (pos0, pos1) = s.indices.partition { s[it] == 0 }.toList().map(List<Int>::toIntArray) val acc0 = s.runningFold(0) { acc, i -> acc + 1 - i }.toIntArray() val acc1 = acc0.mapIndexed { index, i -> index - i }.toIntArray() (1..s.si...
Kotlin
66d71e440675c7454ca7c50072db5f91
30f4b3163499fe69e78eab3c96570d41
-1
PASSED
fun main() { val s = readLine()!!.map { it - '0' } val (pos0, pos1) = s.indices.partition { s[it] == 0 }.toList().map(List<Int>::toIntArray) val acc0 = s.runningFold(0) { acc, i -> acc + 1 - i }.toIntArray() val acc1 = acc0.mapIndexed { index, i -> index - i }.toIntArray() (1..s.size).map { k -...
Kotlin
66d71e440675c7454ca7c50072db5f91
f19f9f2fddc8f3e54bdc876939ff37d5
-1
PASSED
fun main() { val s = readLine()!!.map { it - '0' } val (pos0, pos1) = s.indices.partition { s[it] == 0 } val acc0 = s.runningFold(0) { acc, i -> acc + 1 - i }.toIntArray() val acc1 = acc0.mapIndexed { index, i -> index - i }.toIntArray() (1..s.size).map { k -> generateSequence(0) { i -...
Kotlin
66d71e440675c7454ca7c50072db5f91
8095dc4143333a8d06e51fca930cc138
-1
PASSED
fun main() { val s = readLine()!!.map { it - '0' } val (pos0, pos1) = s.indices.partition { s[it] == 0 } val acc0 = s.runningFold(0) { acc, i -> acc + 1 - i } val acc1 = acc0.mapIndexed { index, i -> index - i } (1..s.size).map { k -> generateSequence(0) { i -> val v0 = po...
Kotlin
66d71e440675c7454ca7c50072db5f91
bd67deb4bc3b82b0373041fcfad5471b
-1
PASSED
// ref: Anumish fun main() { val s = readLine()!!.map { (it - '0') } val pos = Array(2) { c -> s.indices.filter { s[it] == c } } val sum = Array(2) { c -> s.runningFold(0) { cur, x -> cur + if (x == c) 1 else 0 } } val result = (1..s.size).map { k -> generateSequence(0) { i -> ...
Kotlin
66d71e440675c7454ca7c50072db5f91
a6a6f81094d8409e4586d40691c7a77b
-1
PASSED
fun readLn() = readLine()!! // string line fun readInt() = readLn().toInt() // single int fun readStrings() = readLn().split(" ") // list of strings fun readInts() = readStrings().map { it.toInt() } // list of ints fun main() { val n = readInt() val a = readInts().toIntArray() val b = readInts().t...
Kotlin
94daa544d7577a133406ffddd1ff341b
bd1b3c4c283937b7468572abf0945283
-1
PASSED
fun main(args: Array<String>) { fun next() = readLine()!! fun nextInt() = next().toInt() fun nextList() = next().split(" ").map{it.toInt()} val n = nextInt() val p = n+1 val a = nextList().toIntArray() val b = nextList().toIntArray() val m = nextInt() val c = nextList() val prefix = IntArray(p){Int....
Kotlin
94daa544d7577a133406ffddd1ff341b
428dd81f9a49b87698fdac60bac798e0
-1
PASSED
import java.io.* import java.util.* import java.math.* fun main(args: Array<String>) { val cin = BufferedReader(InputStreamReader(System.`in`)) fun next() = cin.readLine()!! fun nextInt() = next().toInt() fun nextList() = next().split(" ").map{it.toInt()} val n = nextInt() val p = n+1 val a = nextLi...
Kotlin
94daa544d7577a133406ffddd1ff341b
c5938fd6aecc6023b294e0e2c08d125d
-1
PASSED
import java.io.* import java.util.* import java.math.* fun main(args: Array<String>) { val cin = BufferedReader(InputStreamReader(System.`in`)) fun next() = cin.readLine()!! fun nextInt() = next().toInt() fun nextList() = next().split(" ").map{it.toInt()} val n = nextInt() val p = n+1 val a = nextLi...
Kotlin
94daa544d7577a133406ffddd1ff341b
bc0e22ce00b2e3f31ecd4d5b08066849
-1
PASSED
import java.io.* import java.util.* import java.math.* val cin = BufferedReader(InputStreamReader(System.`in`)) fun next() = cin.readLine()!! fun nextInt() = next().toInt() fun nextList() = next().split(" ").map{it.toInt()} fun main(args: Array<String>) { val n = nextInt() val p = n+1 val A = nextLi...
Kotlin
94daa544d7577a133406ffddd1ff341b
6b653c65496f22177d5a0d13e36790c9
-1
PASSED
import java.io.* import java.util.* import java.math.* val cin = BufferedReader(InputStreamReader(System.`in`)) fun next() = cin.readLine()!! fun nextInt() = next().toInt() fun nextList() = next().split(" ") fun main(args: Array<String>) { val n = nextInt() val p = n+1 val A = nextList() val B = n...
Kotlin
94daa544d7577a133406ffddd1ff341b
45b9dd38b2a450cc06bf1c9411161c91
-1
PASSED
import java.io.* import java.util.* import java.math.* val cin = BufferedReader(InputStreamReader(System.`in`)) fun next() = cin.readLine()!! fun nextInt() = next().toInt() fun nextList() = next().split(" ").map{it.toInt()} fun main(args: Array<String>) { val n = nextInt() val p = n+1 val A = nextLi...
Kotlin
94daa544d7577a133406ffddd1ff341b
6ad3672ad980e5cfc620f72311070a06
-1
PASSED
import java.io.* import java.util.* import java.math.* fun main(args: Array<String>) { val cin = BufferedReader(InputStreamReader(System.`in`)) fun next() = cin.readLine()!! fun nextInt() = next().toInt() fun nextList() = next().split(" ").map{it.toInt()} fun update(seg: IntArray, i: Int, v: Int) { v...
Kotlin
94daa544d7577a133406ffddd1ff341b
f71287ed65511d2b1a2cfc7c22d8792b
-1
PASSED
import java.io.* import java.util.* import java.math.* fun main(args: Array<String>) { val cin = BufferedReader(InputStreamReader(System.`in`)) fun next() = cin.readLine()!! fun nextInt() = next().toInt() fun nextList() = next().split(" ").map{it.toInt()} fun update(seg: IntArray, i: Int, v: Int) { v...
Kotlin
94daa544d7577a133406ffddd1ff341b
0c55631c8d8918d45d7d304a7e8fde05
-1
PASSED
import java.io.* import java.util.* import java.math.* fun main(args: Array<String>) { val cin = BufferedReader(InputStreamReader(System.`in`)) fun next() = cin.readLine()!! fun nextInt() = next().toInt() fun nextList() = next().split(" ").map{it.toInt()} fun binary_search(f: IntArray, key: Int): Int { ...
Kotlin
94daa544d7577a133406ffddd1ff341b
0b60fada30a81896a2cfccab575f645d
-1
PASSED