#K42292. Maximum Street Condition

    ID: 27055 Type: Default 1000ms 256MiB

Maximum Street Condition

Maximum Street Condition

You are given n streets numbered from 1 to n. Initially, each street has a condition value of 0. You are also given m operations, where each operation is represented by three integers p, q, and v. For each operation, you need to add v to each street in the range [p, q]. After performing all operations, your task is to find the maximum condition value among all streets.

The update operation can be mathematically represented as:

$$ A[p\dots q] += v $$

where A denotes the array representing street conditions. Use an efficient algorithm to handle large inputs.

inputFormat

The first line contains two space-separated integers n and m, where n is the number of streets and m is the number of operations.

Each of the following m lines contains three space-separated integers p, q, and v, representing an operation.

outputFormat

Output a single integer which is the maximum condition value of the streets after all operations have been performed.

## sample
5 3
1 3 10
2 4 5
3 5 2
17

</p>