#include <iostream>
#include <memory>
typedef std::shared_ptr<int> ptr;
ptr test()
{
return ptr(new int[10] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
}
int main() {
ptr a = test();
for (int i = 0; i < 10; ++i)
std::cout << a.get()[i];
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWVtb3J5PgoKdHlwZWRlZiBzdGQ6OnNoYXJlZF9wdHI8aW50PiBwdHI7CgpwdHIgdGVzdCgpCnsKCXJldHVybiBwdHIobmV3IGludFsxMF0gezAsIDEsIDIsIDMsIDQsIDUsIDYsIDcsIDgsIDl9KTsKfQoKaW50IG1haW4oKSB7CglwdHIgYSA9IHRlc3QoKTsKCWZvciAoaW50IGkgPSAwOyBpIDwgMTA7ICsraSkKCQlzdGQ6OmNvdXQgPDwgYS5nZXQoKVtpXTsKCXJldHVybiAwOwp9