Problem:
Score : 100 points

Problem Statement

Serval is fighting with a monster.

The health of the monster is H.

In one attack, Serval can decrease the monster's health by A.
There is no other way to decrease the monster's health.

Serval wins when the monster's health becomes 0 or below.

Find the number of attacks Serval needs to make before winning.

Constraints

1 \leq H \leq 10^4

1 \leq A \leq 10^4

All values in input are integers.

Input

Input is given from Standard Input in the following format:

H A

Output

Print the number of attacks Serval needs to make before winning.

Sample Input 1

10 4

Sample Output 1

3

After one attack, the monster's health will be 6.

After two attacks, the monster's health will be 2.

After three attacks, the monster's health will be -2.

Thus, Serval needs to make three attacks to win.

Sample Input 2

1 10000

Sample Output 2

1

Sample Input 3

10000 1

Sample Output 3

10000

Solution in Kotlin (1.0.0) (judge verdict: Runtime Error)

import java.util.*
fun main(args:Array<String>) {
    data class Monster(val x:Long=0L, var hp:Long=0L)
    var (n,d,a) = readLine()!!.split(" ").map { it.toInt() }
    var monster = Array(n){Monster(0,0)}
    /*
    fun createTestSet() {
        n = 200000
        d =  Random.nextInt(1..1000000000)
        a = Random.nextInt(1..1000000000)
        monster = Array(n){Monster(0,0)}
        val s = HashSet<Int>()
        for(i in 0 until n) {
            var x = Random.nextInt(0..1000000000)
            val hp = Random.nextInt(1..1000000000)
            while(s.contains(x)) {
                x = Random.nextInt(1..1000000000)
            }
            s.add(x)
            monster[i] = Monster(x.toLong(), hp.toLong())

        }
    }
     */

    for(i in 0 until n) {
        val (x,h) = readLine()!!.split(" ").map { it.toInt() }
        monster[i] = Monster(x.toLong(), h.toLong())
    }
    monster.sortBy { it.x }
    var answer = 0L
    var acc = 0L
    val q = LinkedList<Pair<Long,Long>>()
    for(i in 0 until n) {
        var (x, h) = monster[i]
        while(q.isNotEmpty() && q.peekFirst()!!.first + d * 2 < x) {
            val p = q.pollFirst()
            acc -= p.second
        }
        h -= acc
        if(h <= 0) continue
        var cnt = h / a //+ min(h%a, 1)
        if((h%a) >= 1) {
            cnt += 1
        }
        q.add(x to  cnt * a)
        acc += cnt * a
        answer += cnt
    }
    println(answer)
    /*
    var nCase = 1000
    repeat(nCase) {
        createTestSet()
    }
     */
    // x 의 범위가 무지막지하게 크다.
    //


}