Company: Atlassian
Difficulty: medium
Maximum throughput after scaling There are N servers connected in series. Server i starts with throughput throughput[i] . One upgrade increases that server's throughput by 1 and costs cost[i] from the budget. Because the servers are in series, the system's overall throughput is the minimum throughput among all servers. Given a total budget B , determine the maximum overall throughput that can be achieved without exceeding the budget. Input Format The first line contains an integer N , the number of servers. The second line contains N space-separated integers throughput[1], throughput[2], ..., throughput[N] . The third line contains N space-separated integers cost[1], cost[2], ..., cost[N] . The fourth line contains an integer B , the total available budget. Output Format Print one integer: the maximum achievable overall throughput. Constraints 1 ≤ N ≤ 2 × 10^5 1 ≤ throughput[i] ≤ 10^9 1 ≤ cost[i] ≤ 10^9 0 ≤ B ≤ 10^18 The answer fits in a signed 64-bit integer. Examples Exampl