#C3774. Maximum Overlapping Queries

    ID: 47238 Type: Default 1000ms 256MiB

Maximum Overlapping Queries

Maximum Overlapping Queries

You are given a set of queries represented as intervals. Each interval is defined by its start time and end time. The task is to determine the maximum number of queries that overlap at any given moment.

More formally, consider a list of intervals \( [s_i, e_i] \). Two intervals \( [s_i, e_i] \) and \( [s_j, e_j] \) are said to overlap if they have at least one common moment. Your goal is to find the maximum number of intervals that are overlapping at the same time.

Note: If two queries have a boundary in common (i.e., one ends exactly when another starts), they are not considered overlapping at that moment.

inputFormat

The first line contains a single integer \( n \), representing the number of queries.

Each of the next \( n \) lines contains two space-separated integers \( s \) and \( e \), representing the start and end times of a query, respectively.

It is guaranteed that \( s < e \) for each query.

outputFormat

Print a single integer representing the maximum number of overlapping queries at any moment.

## sample
2
1 4
2 6
2