Account
Draft saved on this device
▤ DescriptionOriginal CppValley problem
HFT SystemsEasy

Calculate Round Trip Timestamp Latency

Each request records a send timestamp and a completion timestamp in nanoseconds.

Each request records a send timestamp and a completion timestamp in nanoseconds. Every completion timestamp is at least its send timestamp. Print the maximum observed round-trip latency.

Input format

First line N; next N lines sendNs completionNs.

Output format

Print one integer, the maximum difference.

Examples

Example 1
Input
3
100 110
150 180
200 201
Expected output
30

Constraints

  • 1 ≤ N ≤ 100000
  • 0 ≤ sendNs ≤ completionNs ≤ 10^15

Related concepts

Latency

This early-access exercise uses standard input/output. More advanced concurrency challenges will use specialized class interfaces, instrumentation, and stress tests once the judging infrastructure is ready.

⌘ CodeC++17
GNU C++17 · main.cpp

Loading Monaco C++ editor…

Checking judge...

Checking whether the external C++ judge is available.

⌁ Test cases & resultsPublic samples: 1
Input
3
100 110
150 180
200 201
Expected output
30
Execution requires a secure external judge.