#include <stdlib.h>
#include <memory>
#include <iostream>
int main()
{
int* foo = (int*)malloc(sizeof(int) * 10);
for (int i=0; i<10; i++)
foo[i] = i;
for (int i=0; i<10; i++)
std::cout << foo[i];
std::cout << std::endl;
free(foo);
std::unique_ptr<int[], std::default_delete<int[]> > bar(new int[10]);
for (int i=0; i<10; i++)
bar[i] = i;
for (int i=0; i<10; i++)
std::cout << bar[i];
std::cout << std::endl;
}
I2luY2x1ZGUgPHN0ZGxpYi5oPgojaW5jbHVkZSA8bWVtb3J5PgojaW5jbHVkZSA8aW9zdHJlYW0+CgppbnQgbWFpbigpCnsKICBpbnQqIGZvbyA9IChpbnQqKW1hbGxvYyhzaXplb2YoaW50KSAqIDEwKTsKICBmb3IgKGludCBpPTA7IGk8MTA7IGkrKykKICAgIGZvb1tpXSA9IGk7CiAgZm9yIChpbnQgaT0wOyBpPDEwOyBpKyspCiAgICBzdGQ6OmNvdXQgPDwgZm9vW2ldOwogIHN0ZDo6Y291dCA8PCBzdGQ6OmVuZGw7CiAgZnJlZShmb28pOwoKICBzdGQ6OnVuaXF1ZV9wdHI8aW50W10sIHN0ZDo6ZGVmYXVsdF9kZWxldGU8aW50W10+ID4gYmFyKG5ldyBpbnRbMTBdKTsKICBmb3IgKGludCBpPTA7IGk8MTA7IGkrKykKICAgIGJhcltpXSA9IGk7CiAgZm9yIChpbnQgaT0wOyBpPDEwOyBpKyspCiAgICBzdGQ6OmNvdXQgPDwgYmFyW2ldOwogIHN0ZDo6Y291dCA8PCBzdGQ6OmVuZGw7Cn0K