#include <vector>
#include <iostream>
template <typename iter>
void print_sequence(iter beg, iter end)
{
std::cout << "{ ";
while (beg != end)
std::cout << *beg++ << ' ' ;
std::cout << "}\n";
}
int main()
{
std::vector<int> data =
{
0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1,
0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0,
1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0
};
print_sequence(data.begin(), data.end());
data = { 2, 3, -1, 1, 2, 3, -1, 1, 2, 5, -1, 5, -1, 2, 3, 4, -2 };
print_sequence(data.begin(), data.end());
}
I2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGlvc3RyZWFtPgoKdGVtcGxhdGUgPHR5cGVuYW1lIGl0ZXI+CnZvaWQgcHJpbnRfc2VxdWVuY2UoaXRlciBiZWcsIGl0ZXIgZW5kKQp7CiAgICBzdGQ6OmNvdXQgPDwgInsgIjsKCiAgICB3aGlsZSAoYmVnICE9IGVuZCkKICAgICAgICBzdGQ6OmNvdXQgPDwgKmJlZysrIDw8ICcgJyA7CgogICAgc3RkOjpjb3V0IDw8ICJ9XG4iOwp9CgoKaW50IG1haW4oKQp7CiAgICBzdGQ6OnZlY3RvcjxpbnQ+IGRhdGEgPSAKICAgIHsgCiAgICAgICAgMCwgMSwgMSwgMCwgMCwgMCwgMCwgMCwgMCwgMSwgMSwgCiAgICAgICAgMCwgMCwgMSwgMCwgMCwgMSwgMCwgMCwgMCwgMCwgMCwgCiAgICAgICAgMSwgMSwgMCwgMSwgMCwgMCwgMCwgMSwgMCwgMCwgMCwgCiAgICAgICAgMCwgMCwgMCAKICAgIH07CiAgICBwcmludF9zZXF1ZW5jZShkYXRhLmJlZ2luKCksIGRhdGEuZW5kKCkpOwoKICAgIGRhdGEgPSB7IDIsIDMsIC0xLCAxLCAyLCAzLCAtMSwgMSwgMiwgNSwgLTEsIDUsIC0xLCAyLCAzLCA0LCAtMiB9OwogICAgcHJpbnRfc2VxdWVuY2UoZGF0YS5iZWdpbigpLCBkYXRhLmVuZCgpKTsKfQ==