Company: Adobe_12july
Difficulty: medium
Space Mission Research Parts Problem Description Captain Ava is leading a space mission divided into N parts for scientific research. The Space Exploration Council (SEC) gives instructions that change these parts' status. Each instruction has three parts: L, R, and P. If P is 1, parts from L to R become rest parts. If P is 2, parts from L to R become research parts. Each new instruction replaces the previous ones. Ava needs to keep track of how many research parts are left after each instruction to ensure the mission goes well and the crew stays healthy. Input Format The first line consists of two integers N and D — the number of phases and the number of directives. The next D lines consist of 3 integers L[i], R[i] and P[i] — where L[i] and R[i] are the boundaries and P[i] is the directive type of the i-th directive. Output Format For each test case, print D space separated integers where i-th integer is the answer after the i-th directive. Constraints 1 <= N <= 10^8 1 <= D &l