Company: Squarepoint
Difficulty: medium
Tick Sizes An exchange publishes `n` contiguous price bands. Each band has an inclusive lower bound, an inclusive upper bound, and the minimum tick increment permitted while a price is in that band. Prices and increments are expressed in cents, so all values are integers. First, produce the human-readable rules: scan the bands from left to right and retain a band exactly when its increment differs from the preceding retained increment. A retained rule contains that band's lower bound and its increment. Then, for every requested valid current price `p`, print the next valid price. Add the tick of the band containing `p`. If this lands above that band's upper bound, use the lower bound of the next band instead. The final band's upper bound is also the maximum tradable price; queries never use that maximum price. Input Format The first line contains `n`. Each of the next `n` lines contains `L R T`: inclusive lower bound, inclusive upper bound, and tick increment. The next l