#C7944. Shortest Processing Time

    ID: 51871 Type: Default 1000ms 256MiB

Shortest Processing Time

Shortest Processing Time

You are given a list of logs. Each log represents a task with two integers: the arrival time and the completion time. The processing time for a task is calculated as \(T_{completion} - T_{arrival}\). Your goal is to determine the shortest processing time among all the tasks. In the case of multiple logs having the same processing duration, the one with the earliest arrival time is considered, but you only need to output the processing duration.

inputFormat

The input is read from standard input (stdin) and is formatted as follows:

The first line contains a single integer (n) representing the number of logs.

Each of the next (n) lines contains two space-separated integers (T_{arrival}) and (T_{completion}).

outputFormat

Output a single integer to standard output (stdout) representing the shortest processing time among the logs.## sample

5
1 3
2 5
3 6
4 6
5 8
2