A hiker starts on peak 0 of a ridge with n peaks of given positive integer heights and moves to higher-indexed peaks one step at a time. Moving from peak i to peak i + 1:
- If
height[i + 1] <= height[i], the move is free. - Otherwise it is an upward gap of size
height[i + 1] - height[i], which must be crossed using either one ladder (covers any single gap) or bricks equal to the gap size.
You have b bricks and l ladders total. Choosing allocations to travel as far as possible, report the furthest peak index (0-based) the hiker can reach.
Input format
Line 1: three integers n, b, and l — the number of peaks, bricks, and ladders.
Line 2: n space-separated positive integers, the peak heights.
Output format
A single integer: the furthest reachable peak index (0-based).
Constraints
- 1 <= n <= 100000
- 0 <= b <= 1000000000
- 0 <= l <= n
- 1 <= each height <= 1000000