Enforcing a Max-Depth Limit
Left alone, Ashby Mutual's rule-book grows until every leaf holds a single claim — which reproduces the archive exactly and predicts nothing. The usual brake is a depth limit: a cap on how many rules a claim may pass through before it has to land in a leaf. A build has just finished and the tool logged how deep each leaf ended up sitting. Compliance wants to know how far the cap was breached. A leaf sitting exactly at the cap is fine; the cap is the deepest level allowed, not the first level forbidden.
Task: Print how many of the logged leaves sit deeper than the cap.
Input
Two lines. The first holds n, the number of leaves logged, followed by the depth cap, separated by a space. The second holds the n leaf depths separated by single spaces. Every value is a whole number.
Output
One line holding a single whole number: how many leaves sit deeper than the cap. Print 0 if none do.
Example:
Input:
4 3
2 3 5 4
Output:
2
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in