Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n,k=map(int, input().split())
a=list(map(int, input().split())) 
cnt = 0
tmp = 1

for i in range(n):
    if cnt < k:
        tmp = tmp * a[i]
        cnt += 1
    else:
        tmp2 = tmp / a[i-k] * a[i]
        if tmp < tmp2:
           print('Yes')
        else:
            print('No')
        tmp = tmp2
    #print(tmp)

### FIXED CODE ###

n,k=map(int, input().split())
a=list(map(int, input().split())) 

for i in range(n):
    if i >= k:
        if a[i-k] < a[i]:
            #print(a[i])
            print('Yes')
        else:
            print('No')
### BUGGY CODE ###

import sys

n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for c in range(2,n):
    a = 0
    b = 1
    while True:
        if l[a]<l[b]+l[c] and  l[c]<l[a]+l[b] and l[b]<l[c]+l[a]:
            ans += 1
        b += 1
        if b == c:
            a += 1
            if a == c-1:
                break
            b = a+1
print(ans)


### FIXED CODE ###

n = int(input())
l = list(map(int, input().split()))
l.sort()

# a, bをfixしてcを探索
# n*n*logn
# c_i < a+b をにぶたん
def binary_search(list, item):
    # listからitem未満の最大のindexを取得
    low = 0
    high = len(list) - 1
    if list[high] < item:
        return high+1
    if list[low] >= item:
        return low
    while True:
        mid = (low + high) //2
        guess = list[mid]
        if high - low <= 1:
            return high
        if guess >= item:
            high = mid
        else:
            low = mid

ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        a = l[i]
        b = l[j]
        c = binary_search(l, b+a)
        ans += c-(j+1)
print(ans)
### BUGGY CODE ###

def Zalgorithm(s):
    z = [0 for _ in range(len(s))]
    z[0] = len(s)
    i, j = 1, 0
    while i < len(s):
        while i+j < len(s) and s[j] == s[i+j]:
            j += 1
        z[i] = j
        if j == 0:
            i += 1
            continue
        k = 1
        while i+k < len(s) and k+z[k] < j:
            z[i+k] = z[k]
            k += 1
        i += k
        j -= k
    return z

n = int(input())
s = input().strip()
ans = 0
for i in range(len(s)):
    zarr = Zalgorithm(s[i:])
    for j in range(len(zarr)):
        ans = max(ans, min(j, zarr[j]))
print(ans)


### FIXED CODE ###

def Zalgorithm(s):
    z = [0 for _ in range(len(s))]
    z[0] = len(s)
    i, j = 1, 0
    while i < len(s):
        while i+j < len(s) and s[j] == s[i+j]:
            j += 1
        z[i] = j
        if j == 0:
            i += 1
            continue
        k = 1
        while i+k < len(s) and k+z[k] < j:
            z[i+k] = z[k]
            k += 1
        i += k
        j -= k
    return z

n = int(input())
s = input().strip()
ans = 0
for i in range(len(s)):
    zarr = Zalgorithm(s[i:])
    for j in range(len(zarr)):
        ans = max(ans, min(j, zarr[j]))
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

import sys
import math

def main():
    input = sys.stdin.readline
    N = int(input())

    result = 0
    small_ok_flag = False
    ok_flag = False
    for n in range(1,N+1):
        root_n = int(math.sqrt(n)) + 1
        if n < 3:
            print(0) 
            continue
        for i in range(1,root_n):
            for j in range(1,root_n):
                if i*i + j*j + i*j > n:
                    break
                for k in range(i,root_n):
                    if i*i + j*j + k*k + i*j + i*k + j*k > n:
                        break
                    if i*i + j*j + k*k + i*j + i*k + j*k == n:
                        if i == j and j == k:
                            result += 1
                        elif i == j or j == k or i == k:
                            result += 3
                        else:
                            result += 6
                        print(result)
                        result = 0
                        ok_flag = True
                        break
                if ok_flag:
                    break
            if ok_flag:
                break

        if not ok_flag:
            print(0)
        ok_flag = False
        
                        

    return


if __name__ == '__main__':
    main()

### FIXED CODE ###

# -*- coding: utf-8 -*-

import sys
import math

def main():
    input = sys.stdin.readline
    N = int(input())

    result = 0
    ans_list = [0]*(N+1)
    root_n =int(math.sqrt(N))+1

    for i in range(1,root_n):
        for j in range(1,root_n):
            for k in range(1,root_n):
                f = i**2+j**2+k**2+i*j+i*k+j*k
                if f <= N:
                    ans_list[f] += 1 
    
    for i in range(1,N+1):
        print(ans_list[i])
        
                        

    return


if __name__ == '__main__':
    main()
### BUGGY CODE ###

N,K=map(int,input().split())
A=list(map(int,input().split()))
A.sort()

#A[num]が必要な数か判定
def condition(num):
    if N-1>num:
        test=A[:num]+A[num+1:]
    else:
        test=A[:num]
    if A[num]>=K:
        dp=[[False for i in range(0,K)] for i in range(0,N)]
        for i in range(0,K):
            dp[0][i]=True

        for i in range(1,N):
            for j in range(0,K):
                if K>j+test[i-1]:
                    dp[i][j]=dp[i-1][j] or dp[i-1][j+test[i-1]]
                else:
                    dp[i][j]=dp[i-1][j]

        return dp[N-1][0]

    else:
        dp=[[False for i in range(0,K)] for i in range(0,N)]
        for i in range(0,K):
            if i>=K-A[num]:
                dp[0][i]=True

        for i in range(1,N):
            for j in range(0,K):
                if K>j+test[i-1]:
                    dp[i][j]=dp[i-1][j] or dp[i-1][j+test[i-1]]
                else:
                    dp[i][j]=dp[i-1][j]

        return dp[N-1][0]

#必要な数のうち最小のもの
if N==1:
    if A[0]>=K:
        print(0)
    else:
        print(1)
else:
    start=0
    end=N-1
    while end-start>1:
        t=(end+start)//2
        if condition(t):
            end=t
        else:
            start=t

    if condition(start):
        print(start)
    elif condition(end):
        print(end)
    else:
        print(N)


### FIXED CODE ###

N,K=map(int,input().split())
A=list(map(int,input().split()))
A.sort()

l=N
for i in range(0,N):
    if A[i]>=K:
        l=i
        break
A=A[:l]
N=l
#A[num]が必要な数か判定
def condition(num):
    if N-1>num:
        test=A[:num]+A[num+1:]
    else:
        test=A[:num]
    if A[num]>=K:
        return True
    else:
        check=0
        for i in range(K-A[num],K):
            check+=pow(2,i)

        for i in range(1,N):
            check=check|(check>>test[i-1])

        return check%2==1
        

#必要な数のうち最小のもの
if N==0:
    print(0)
elif N==1:
    if A[0]>=K:
        print(0)
    else:
        print(1)
else:
    start=0
    end=N-1
    while end-start>1:
        t=(end+start)//2
        if condition(t):
            end=t
        else:
            start=t

    if condition(start):
        print(start)
    elif condition(end):
        print(end)
    else:
        print(N)
### BUGGY CODE ###

i=int(input())
x=[int(x) for x in input().split()]
for i in x:
  if x.count(i)>1:
    c=0
    break
  else:
      c=1
if(c==1):
    print("YES")
else:
    print("NO")      

### FIXED CODE ###

i=int(input())
x=[int(x) for x in input().split()]
y=set(x)
if(len(y)==len(x)):
    print("YES")
else:
    print("NO")
### BUGGY CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))

ans =1
now = [1]
ed = set([1])

for i in range(n+1):
    if a[now[i]-1] in ed:
        break
    now.append(a[now[i]-1])
    ed = set(now)
    
t = len(now)-now.index(a[now[i]-1])
f = now.index(a[now[i]-1])


if k >= f + t:
    p = (k-f)%t
    k = f + p
    

print(now[k])

### FIXED CODE ###

import sys
n, k = map(int, input().split())
a = list(map(int, input().split())) 

visited = [None]*n
cur = 0
for i in range(k):
    if visited[cur] is None:
        visited[cur] = i
        cur = a[cur]-1
    else:
        break
else:
    print(cur+1)
    sys.exit()

k -= i
k %= i-visited[cur]

for i in range(k):
    cur = a[cur]-1

print(cur+1)
### BUGGY CODE ###

n=int(input())
s=input()
ans=0
r=[]
g=[]
b=[]
for i in range(n):
    tmp=s[i]
    if tmp=="R":
        r.append(i+1)
    elif tmp=="G":
        g.append(i+1)
    else:
        b.append(i+1)
for i in r:
    for j in g:
        for k in b:
            if (i<j and j<k):
                if j-i!=k-j:
                    ans+=1
            elif (i<k and k<j):
                if k-i!=j-k:
                    ans+=1
            elif (j<i and i<k):
                if i-j!=k-i:
                    ans+=1
            elif (j<k and k<i):
                if k-j!=i-k:
                    ans+=1
            elif (k<i and i<j):
                if i-k!=j-i:
                    ans+=1
            elif (k<j and j<i):
                if j-k!=i-j:
                    ans+=1
print(ans)


### FIXED CODE ###

n=int(input())
s=input()
r=s.count("R")
g=s.count("G")
b=s.count("B")
ans=r*g*b
for i in range(n):
    for j in range(n):
        if i+j+j>=n:
            break
        s1=s[i]
        s2=s[i+j]
        s3=s[i+j*2]
        if s1!=s2 and s2!=s3 and s1!=s3:
            ans-=1
print(ans)
### BUGGY CODE ###

N = int(input())
c = [list(map(int, input().split())) for _ in range(N - 1)]
anslst = [0] * N
for i in range(N - 1):
    ans = c[i][1] + c[i][0]
    for j in range(i + 1, N - 1):
        if ans <= c[j][1]:
            ans = c[j][1] + c[j][0]
        else:
            index = 1
            tmp = c[j][1] + c[j][2]
            while ans > tmp:
                tmp = c[j][1] + index * c[j][2]
                index += 1
            ans += (tmp - ans) + c[j][0]

    anslst[i] = ans

for i in anslst:
    print(i)

### FIXED CODE ###

N = int(input())
c = [list(map(int, input().split())) for _ in range(N - 1)]
anslst = [0] * N
for i in range(N - 1):
    ans = c[i][1] + c[i][0]
    for j in range(i + 1, N - 1):
        if ans <= c[j][1]:
            ans += (c[j][1] - ans) + c[j][0]
        else:
            sho, amari = divmod(ans, c[j][2])
            if amari == 0:
                ans += c[j][0]
            else:
                ans += c[j][0] + (((sho + 1) * c[j][2]) - ans)

    anslst[i] = ans

for i in anslst:
    print(i)
### BUGGY CODE ###

n, m, q = map(int, input().split())


abcdList = []
for _ in range(q):
  abcd = list(map(int, input().split()))
  abcdList.append(abcd)
aList = []
def createA(tempA, x, t):
  if x!=0:
      tempA.append(t)
  if x == n:
    abc = []
    for item in tempA:
        abc.append(item)
    aList.append(abc)
    return
  x += 1
  for i in range(t, m+1):
    if x == 1:
        tempA = []
    createA(tempA, x, i)
    tempA.pop(-1)



x = 0
createA([], x, 1)
maxAns = 0
for item in aList:
  ans = 0
  for i in range(q):
    b = abcdList[i][1]
    a = abcdList[i][0]
    c = abcdList[i][2]
    d = abcdList[i][3]
    if item[b-1] - item[a-1] == c:
      ans += d
  if ans > maxAns:
    maxAns = ans
print(maxAns)
    
  
  




### FIXED CODE ###

n, m, q = map(int, input().split())

abcd = [list(map(int, input().split())) for _ in range(q)]
from itertools import combinations_with_replacement as cwr
AList = list(cwr(range(1, m+1), n))


maxPoint = 0
for A in AList:
  point = 0
  for abc in abcd:
    a = abc[0]
    b = abc[1]
    c = abc[2]
    d = abc[3]
    if A[b-1] - A[a-1] == c:
      point += d
  if point > maxPoint:
    maxPoint = point
print(maxPoint)
### BUGGY CODE ###

L, R = map(int,input().split())
mod = 2019

ans = pow(10,9)+7
for i in range(L,R):
  for j in range(i+1,R+1):
    val = ((i%mod) * (j%mod))%mod
    ans = min(ans, val)
    if ans == 0:
      break

print(ans)

### FIXED CODE ###

L, R = map(int,input().split())
mod = 2019

ans = pow(10,9)+7
for i in range(L,R):
  for j in range(i+1,R+1):
    val = ((i%mod) * (j%mod))%mod
    ans = min(ans, val)
    if ans == 0:
      break
  if ans == 0:
    break

print(ans)
### BUGGY CODE ###

from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    x = int(input())
    ma_ = 1
    for i in range(1,x):
        for j in range(2,x):
            if i**j <= x:
                ma_ = max(ma_,i**j)
    print(ma_)
if __name__ == '__main__':
  main()


### FIXED CODE ###

#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  x = int(input())
  ans = 1
  for i in range(1,x):
    for j in range(2,x):
      if i**j <= x:
        ans = max(ans, i**j)
      else:
        break
  print(ans)
  
if __name__ == '__main__':
  main()
### BUGGY CODE ###

def insert(a, data):
    a.append(data)
    heapinc(a, len(a)-1)

def heapinc(a, index):
    parent = (index - 1) // 2
    if parent >= 0:
        if a[parent] < a[index]:
            memo = a[parent]
            a[parent] = a[index]
            a[index] = memo
            heapinc(a, parent)

def extract(a):
    root = a[0]
    a[0] = a[-1]
    del a[-1]
    maxheapify(a, 0)
    return root

def maxheapify(a, i):
    l = i*2 + 1
    r = i*2 + 2

    if r < len(a):
        if a[l] > a[i]:
            largest = l
        else:
            largest = i
        if a[r] > a[largest]:
            largest = r

        if largest != i:
            memo = a[i]
            a[i] = a[largest]
            a[largest] = memo
            maxheapify(a, largest)

    elif l < len(a):
        if a[l] > a[i]:
            largest = l
        else:
            largest = i
        if largest != i:
            memo = a[i]
            a[i] = a[largest]
            a[largest] = memo
            maxheapify(a, largest)

a = []
for i in range(2000000001):
    com = input().split()
    if com[0] == 'insert':
        insert(a, int(com[1]))
    elif com[0] == 'extract':
        print(extract(a))
    else:
        break


### FIXED CODE ###

from heapq import *

a = []
while 1:
    com = input().split()
    if com[0] == 'end':
        break
    elif com[0] == 'insert':
        heappush(a, -int(com[1]))
    else:
        print(-heappop(a))
### BUGGY CODE ###

import heapq
n = int(input())
p = []
q = []
for i in range(n):
    x,y = map(int, input().split())
    p.append((x, y, i))
    q.append((y, x, i))

p.sort()
q.sort()
pid = [0 for i in range(n)]
qid = [0 for i in range(n)]
for i in range(n):
    pid[p[i][2]] = i
    qid[q[i][2]] = i
used = [False] * n

total = 0

hq = [(0, 0)]
cnt = 0
s = set()
while hq and cnt < n:
    c, i = heapq.heappop(hq)
    # print(c, i)
    if i not in s:
        cnt += 1
        s.add(i)
        total += c
    else:
        continue
    pi = pid[i]
    qi = qid[i]
    if pi > 0 and p[pi-1][2] not in s:
        heapq.heappush(hq, (p[pi][0] - p[pi-1][0], p[pi-1][2]))
    if pi < n-1 and p[pi+1][2] not in s:
        heapq.heappush(hq, (p[pi+1][0] - p[pi][0], p[pi+1][2]))
    if qi > 0 and q[qi-1][2] not in s:
        heapq.heappush(hq, (q[qi][0] - q[qi-1][0], q[qi-1][2]))
    if qi < n-1 and q[qi+1][2] not in s:
        heapq.heappush(hq, (q[qi+1][0] - q[qi][0], q[qi+1][2]))
    
        

print(total)

### FIXED CODE ###

import heapq
n = int(input())
p = []
q = []
for i in range(n):
    x,y = map(int, input().split())
    p.append((x, y, i))
    q.append((y, x, i))

p.sort()
q.sort()
pid = [0 for i in range(n)]
qid = [0 for i in range(n)]
for i in range(n):
    pid[p[i][2]] = i
    qid[q[i][2]] = i
used = [False] * n

total = 0

hq = [(0, 0)]
cnt = 0
s = set()
while hq and cnt < n:
    c, i = heapq.heappop(hq)
    # print(c, i)
    if i not in s:
        cnt += 1
        s.add(i)
        total += c
    else:
        continue
    pi = pid[i]
    qi = qid[i]
    if pi > 0 and p[pi-1][2] not in s:
        heapq.heappush(hq, (p[pi][0] - p[pi-1][0], p[pi-1][2]))
    if pi < n-1 and p[pi+1][2] not in s:
        heapq.heappush(hq, (p[pi+1][0] - p[pi][0], p[pi+1][2]))
    if qi > 0 and q[qi-1][2] not in s:
        heapq.heappush(hq, (q[qi][0] - q[qi-1][0], q[qi-1][2]))
    if qi < n-1 and q[qi+1][2] not in s:
        heapq.heappush(hq, (q[qi+1][0] - q[qi][0], q[qi+1][2]))
    
        

print(total)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
 
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n-1)]
 
graph = [[] for _ in range(n)]
 
for a, b in ab:
    graph[a-1].append((b-1, -1))
    graph[b-1].append((a-1, -1))
 
# print(graph)
k = 0
for i in graph:
    if k< len(i):
        k = len(i)

stack = [(0, -1)]
visited = [-1]*n
 
# k = 0
while stack:
    node, color = stack.pop()
    visited[node] = 1
 
    # if k < len(graph[node]):
    #     k = len(graph[node])
    tmp = 1
    for i, (child, child_color) in enumerate(graph[node]):
        if visited[child] == 1:
            continue
        if tmp == color:
            tmp += 1
        graph[node][i] = (child, tmp)
        stack.append((child, tmp))
        tmp +=1
 
print(k)
for a, b in ab:
   for node, color in graph[a-1]:
       if node == b-1:
           print(color) 


### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import deque
 
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n-1)]
 
graph = [[] for _ in range(n)]
for a, b in ab:
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

stack = deque([0])
parent = [None]*n
colors = [0]*n
while stack:
    node = stack.popleft()
    color = 1
    for child in graph[node]:
        if child == parent[node]:
            continue
        parent[child] = node
        if color == colors[node]:
            color += 1
        colors[child] = color
        color += 1
        stack.append(child)

 
k = max(colors)
print(k)
for a, b in ab:
    if (a-1) == parent[b-1]:
        print(colors[b-1])
    else:
        print(colors[a-1])
### BUGGY CODE ###

from collections import defaultdict

n = int(input())
s = input()
passwords = defaultdict(int)
for i in range(1000):
    password = [str(i // 100), str((i // 10) % 10), str(i % 10)]
    #print(password)
    for j in range(n):
        if s[j] == password[0]:
            #print("OK1", password)
            for k in range(j + 1, n):
                if s[k] == password[1]:
                    #print("OK2")
                    for l in range(k + 1, n):
                        if s[l] == password[2]:
                            #print("OK3", password)
                            passwords["".join(password)] += 1
                            break
                
                    break
            break

print(len(passwords))

### FIXED CODE ###

N = int(input())
S = input()

ans = 0
for i in range(1000):
    num = str(i).zfill(3)
    if S.find(num[0]) == -1:
        continue
    S1 = S[S.find(num[0]) + 1:]
    if S1.find(num[1]) == -1:
        continue
    S2 = S1[S1.find(num[1]) + 1:]
    if S2.find(num[2]) == -1:
        continue
    ans += 1

print(ans)
### BUGGY CODE ###

import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

le = [S.count(s) for s in set(S)]
cnt = 0
for i in range(len(le)):
    for s in itertools.combinations(le,i+1):
        t=1
        for tt in s:
            t*=tt
        cnt+=t
print(cnt%((10**9)+7))

### FIXED CODE ###

import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

le = [S.count(s)+1 for s in set(S)]
cnt=1
for i in le:
    cnt*=i
print((cnt-1)%((10**9)+7))
### BUGGY CODE ###

#!/usr/bin/env python3
 
import sys
# 以下を記述しないとTLEになる, 何故？
from heapq import heappush, heappop
from collections import defaultdict
# ---- ここまで -----------------------
 
S = input()
T = input()
lenS = len(S)
lenT = len(T)
F1 = [False]*26
F2 = [False]*26
alpha = 'abcdefghijklmnopqrstuvwxyz'
for i in range(lenS):
    F1[alpha.index(S[i])] = True
for i in range(lenT):
    F2[alpha.index(T[i])] = True
for i in range(26):
    if not F1[i] and F2[i]:
        print(-1)
        sys.exit()
 
ind = S.index(T[0])
ans = ind+1
for i in range(1,lenT):
    S = S[ind+1:] + S[:ind+1]
    ind = S.index(T[i])
    ans += ind+1
 
print(ans)

### FIXED CODE ###

import bisect
s = input().rstrip()
t = input().rstrip()

a_ord = ord("a")
ch_place = [[] for _ in range(26)]
for i, ch in enumerate(s):
    ch_place[ord(ch) - a_ord].append(i)

# print(ch_place)

count = 0
idx = -1 
for ch in t:
    ch_num = ord(ch) - a_ord
    if len(ch_place[ch_num]) == 0:
        print(-1)
        exit()
    place = bisect.bisect_right(ch_place[ch_num], idx)
    # print(ch_place[ch_num], idx, place)
    if place == len(ch_place[ch_num]):
        idx = ch_place[ch_num][0]
        count += 1
    else:
        idx = ch_place[ch_num][place]

# print(count, idx)
print(count * len(s) + idx + 1)
### BUGGY CODE ###

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n,d,a = mi()
lis = []
for  i in range(n):
    x,h = mi()
    h = (h + a - 1) // a
    lis.append([x,h])

lis.sort()
dis = []
hp = []
for i in range(n):
    dis.append(lis[i][0])
    hp.append(lis[i][1])
#bit
class BIT():
    """区間加算、区間取得クエリをそれぞれO(logN)で答える
    add: 区間[l, r)にvalを加える
    get_sum: 区間[l, r)の和を求める
    l, rは0-indexed
    """
    def __init__(self, n):
        self.n = n
        self.bit0 = [0] * (n + 1)
        self.bit1 = [0] * (n + 1)

    def _add(self, bit, i, val):
        i = i + 1
        while i <= self.n:
            bit[i] += val
            i += i & -i

    def _get(self, bit, i):
        s = 0
        while i > 0:
            s += bit[i]
            i -= i & -i
        return s

    def add(self, l, r, val):
        """区間[l, r)にvalを加える"""
        self._add(self.bit0, l, -val * l)
        self._add(self.bit0, r,  val * r)
        self._add(self.bit1, l,  val)
        self._add(self.bit1, r, -val)

    def get_sum(self, l, r):
        """区間[l, r)の和を求める"""
        return self._get(self.bit0, r) + r * self._get(self.bit1, r) \
               - self._get(self.bit0, l) - l * self._get(self.bit1, l)

import bisect
hp_now = 0
dis_now = 0

ans = 0
bit = BIT(n+1)
for i in range(n):
    diff = hp[i] - bit.get_sum(i+1,i+2)
    if diff > 0:
        ans += diff
        migi = bisect.bisect_right(dis,dis[i] + 2 *d)
        bit.add(1,migi+1,diff)
print(ans)



### FIXED CODE ###

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n,d,a = mi()
lis = []
for  i in range(n):
    x,h = mi()
    h = (h + a - 1) // a
    lis.append([x,h])

lis.sort()
dis = []
hp = []
for i in range(n):
    dis.append(lis[i][0])
    hp.append(lis[i][1])
#imos?
from collections import deque
hiku = deque()
sums = hp[0]
ans = hp[0]
hiku.append([dis[0] + 2 * d,hp[0]])
imadis,imahp = hiku.popleft()
for i in range(1,n):
    while True:
        if dis[i] <= imadis:
            break
        else:
            sums -= imahp
            imahp = 0
            if hiku:
                imadis,imahp = hiku.popleft()
            else:
                break
    diff = hp[i] - sums
    if diff > 0:
        ans += diff
        sums += diff
        hiku.append([dis[i] + 2 * d,diff])

print(ans)