You have n length array having all elements 0 initially. You have to execute 2-types of m commands.
type 1: l r (l ≤ l ≤ r ≤ n) — Increase all elements of the array by one, whose indices belong to the range [l, r].
type 2: l r (1 ≤ l ≤ r ≤ m) — Execute all the commands whose indices are in the range [l, r]. It's guaranteed that r is strictly less than the
enumeration/number of the current command.
Input:
The first line contains integers n and m. Next m lines contain commands in the format, described in the statement: t, l, r, where t - the number of types (1 or 2).
Output:
print an array a, after executing every command. The numbers have to be separated by spaces. As the numbers can be quite large, print them modulo 109 + 7.
Constraints:
1 ≤ n, m ≤ 105
This is codechef problem,you can see editorial here and here is my source code