A sliding-window-LOG rate limiter admits at most m requests within any trailing window of w milliseconds. You are given n requests' arrival timestamps (integers, milliseconds since start, given in non-decreasing order). Process requests one at a time, in the given order. For a request with timestamp t:
- Its window is the half-open interval
(t - w, t]- that is, ADMITTED requests with timestamp strictly greater thant - wand less than or equal tot. - The request is ADMITTED if the number of PREVIOUSLY ADMITTED requests whose timestamp falls in that window is strictly less than
m; otherwise it is REJECTED. - Only ADMITTED requests are ever added to the log used for future window checks - rejected requests are discarded and never counted again.
Print the total number of ADMITTED requests.
Input format
Line 1: three integers n, w, m.
Line 2: n space-separated non-decreasing integers, the request timestamps.
Output format
A single integer: the total number of admitted requests.
Constraints
- 1 <= n <= 100000
- 1 <= w <= 1000000
- 1 <= m <= 100000
- 0 <= timestamp <= 10000000, non-decreasing