#C4111. Maximum Task Delay
Maximum Task Delay
Maximum Task Delay
You are given a list of tasks. Each task is represented by two integers: its duration \(t\) and its due date \(d\). Your job is to compute the maximum delay allowed for each task such that, if started with the delay and then executed continuously for \(t\) days, the task will finish on or before its due date.
For each task, the maximum delay can be formulated as:
\(\text{delay} = \max(0, d - t)\)
If \(d - t\) is negative, it means there is no possible delay and you should output \(0\) for that task.
The tasks are provided as input from standard input (stdin) and the result (a list of maximum delays) must be printed to standard output (stdout) as space-separated integers in a single line.
inputFormat
The first line of input contains a single integer \(n\) representing the number of tasks. Each of the following \(n\) lines contains two integers \(t\) and \(d\) separated by a space, where \(t\) is the duration of the task and \(d\) is the due date.
outputFormat
Output a single line containing \(n\) space-separated integers. Each integer represents the maximum number of days that the corresponding task can be delayed such that it is finished on or before its due date.
## sample3
4 10
5 8
3 5
6 3 2