Find the request where a shadow budget runs out
Your task
Your new agent version runs in shadow mode. A copy of some live requests goes to it, and its replies are compared with the current version's. Users never see them. Several samplers pick which requests to copy. Each one takes every p-th request. You have paid for k shadow runs, and you want to know when they run out.
Write budget_end(samplers, k) that returns the number of the request that uses the last paid run.
Input and output:
samplers: 1 to 12 different whole numbers from 2 to 1,000. A sampler with valueppicks requestsp,2p,3pand so on.k: a whole number from 1 to 100,000,000,000.- Return a whole number: the number of the
k-th request that at least one sampler picks.
Rules:
- Requests are numbered 1, 2, 3 and so on, with no gaps and no end.
- A request picked by several samplers is copied once and uses one run.
Examples
budget_end(samplers: list[int], k: int) -> intExample 1
Input
budget_end([3, 5], 6)Output
12Example 2
Input
budget_end([4, 6, 10], 5)Output
12Example 3
Input
budget_end([7], 100)Output
700