Skip to content

Instantly share code, notes, and snippets.

@hendrawd
Last active February 2, 2018 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hendrawd/74b1e7c97948218117c0692b19b575b4 to your computer and use it in GitHub Desktop.
Save hendrawd/74b1e7c97948218117c0692b19b575b4 to your computer and use it in GitHub Desktop.
As Uwi's recommendation to create my own libary, so i create an IntelliJ File Template in kotlin for faster solve competitive programming problem. This use the fastest I/O that we can achieve in kotlin.
import java.io.PrintWriter
import java.math.BigInteger
/**
* ${Website}
* Created on ${DAY} ${MONTH_NAME_FULL} ${YEAR}
* @author ${USER}
*/
fun main(args: Array<String>) {
${NAME}()
}
@Suppress("ClassName", "unused")
private class ${NAME} {
private val fastOutput by lazy {
PrintWriter(System.out)
}
init {
var t = nextInt()
while (t-- > 0) {
// TODO please do your logic here
}
fastOutput.close()
}
private fun print(o: Any) {
fastOutput.print(o)
}
private fun println(o: Any) {
fastOutput.println(o)
}
private fun nextBigInteger(): BigInteger {
return BigInteger(nextString())
}
private fun nextCharArray(): CharArray {
return nextString().toCharArray()
}
private fun nextDouble(): Double {
return nextString().toDouble()
}
private fun nextFloat(): Float {
return nextString().toFloat()
}
private fun nextInt(): Int {
return nextString().toInt()
}
private fun nextIntList(): List<Int> {
return nextString().split(" ").map { it.toInt() }
}
private fun nextIntMutableList(): MutableList<Int> {
return nextIntList().toMutableList()
}
private fun nextLong(): Long {
return nextString().toLong()
}
private fun nextString(): String {
return readLine()!!
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment