text: Each successful alloc operation procession should return following number.Unsuccessful alloc operations do not affect numeration.You are to write the implementation of the memory manager.You should output the returned value for each alloc command.You should also output ILLEGAL_ERASE_ARGUMENT for all the failed erase commands.Input The first line of the input data contains two positive integers t and m (1 ≤ t ≤ 100;1 ≤ m ≤ 100), where t — the amount of operations given to the memory manager for processing, and m — the available memory size in bytes.Then there follow t lines where the operations themselves are given.The first operation is alloc n (1 ≤ n ≤ 100), where n is an integer.The second one is erase x, where x is an arbitrary 32-bit integer numerical token.The third operation is defragment.Output Output the sequence of lines.Each line should contain either the result of alloc operation procession , or ILLEGAL_ERASE_ARGUMENT as a result of failed erase operation procession.Output lines should go in the same order in which the operations are processed.Successful procession of alloc operation should return integers, starting with 1, as the identifiers of the allocated blocks.Examples Input 6 10 alloc 5 alloc 3 erase 1 alloc 6 defragment alloc 6 Output 1 2 NULL 3 # Solution #include <bits/stdc++.h> using namespace std; int main() { int t, m, num = 1; string com; int arg; vector<pair<pair<int, int>, int> > d; cin >> t >> m; for (int _n((t)-1), q(0); q <= _n; q++) { sort((d).begin(), (d).end()); cin >> com; if (com == "defragment") { if (d.size() > 0) { d[0].first.second -= d[0].first.first; d[0].first.first = 0; for (int _n((d.size() - 1)), i(1); i <= _n; i++) { int delta = d[i].first.first - d[i - 1].first.second; d[i].first.first -= delta; d[i].first.second -= delta; } } continue; } cin >> arg; if (com == "alloc") { int res = -1; if (d.size() > 0) if (d[0].first.first >= arg) { d.push_back(make_pair(make_pair(0, arg), num++)); res = 1; } if (res == -1) for (int _n((d.