#K83602. Maximum Availability Count
Maximum Availability Count
Maximum Availability Count
You are given T test cases. In each test case, you have N books (numbered from 0 to N-1) and Q operations. Each operation is represented by three integers l, r, and v, which means that you should add the value v (which can be negative or positive) to the availability count of every book in the range from l to r (inclusive).
Your task is to compute the maximum availability count among all books after applying all operations. Since the result can be very large, output the result modulo \(10^9+7\) (i.e., 1000000007). Note that if the maximum availability count is negative, you should still output its value modulo 1000000007.
Note: Books are 0-indexed.
inputFormat
The input is read from standard input and is formatted as follows:
- The first line contains a single integer T, the number of test cases.
- For each test case, the first line contains two space-separated integers N and Q, representing the number of books and the number of operations, respectively.
- This is followed by Q lines, each containing three space-separated integers l, r, and v (0 ≤ l ≤ r < N), representing an operation.
outputFormat
For each test case, output a single line containing one integer: the maximum availability count after applying all operations, taken modulo 1000000007.
## sample1
5 3
0 1 2
2 3 1
1 4 -2
2
</p>