#include <iostream>
#include <vector>
#include <list>
int main()
{
int nums[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
std::vector<int> u(std::begin(nums), std::end(nums));
std::list<int> v(std::begin(nums), std::end(nums));
for (auto it = u.begin(); it != u.end(); )
{
if (*it % 2 == 0)
it = u.erase(it);
else
++it;
}
for (auto it = v.begin(); it != v.end(); )
{
if (*it % 2)
it = v.erase(it);
else
++it;
}
for (auto &i : u)
std::cout << i << " ";
std::cout << std::endl;
for (auto &i : v)
std::cout << i << " ";
std::cout << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8bGlzdD4KCgppbnQgbWFpbigpCnsKCWludCBudW1zW10gPSB7IDEsIDIsIDMsIDQsIDUsIDYsIDcsIDgsIDksIDEwIH07CglzdGQ6OnZlY3RvcjxpbnQ+IHUoc3RkOjpiZWdpbihudW1zKSwgc3RkOjplbmQobnVtcykpOwoJc3RkOjpsaXN0PGludD4gICB2KHN0ZDo6YmVnaW4obnVtcyksIHN0ZDo6ZW5kKG51bXMpKTsKCglmb3IgKGF1dG8gaXQgPSB1LmJlZ2luKCk7IGl0ICE9IHUuZW5kKCk7ICkKCXsKCQlpZiAoKml0ICUgMiA9PSAwKQoJCQlpdCA9IHUuZXJhc2UoaXQpOwoJCWVsc2UKCQkJKytpdDsKCX0KCglmb3IgKGF1dG8gaXQgPSB2LmJlZ2luKCk7IGl0ICE9IHYuZW5kKCk7ICkKCXsKCQlpZiAoKml0ICUgMikgCgkJCWl0ID0gdi5lcmFzZShpdCk7CgkJZWxzZQoJCQkrK2l0OwoJfQoKCWZvciAoYXV0byAmaSA6IHUpCgkJc3RkOjpjb3V0IDw8IGkgPDwgIiAiOwoJc3RkOjpjb3V0IDw8IHN0ZDo6ZW5kbDsKCWZvciAoYXV0byAmaSA6IHYpCgkJc3RkOjpjb3V0IDw8IGkgPDwgIiAiOwoJc3RkOjpjb3V0IDw8IHN0ZDo6ZW5kbDsKCglyZXR1cm4gMDsKfQo=