#include <iostream>
#include <random>
#include <ctime>
#include <algorithm>
#include <cstdint>
#include <vector>
#include <memory>
const int N = 100;
const int NSEEDS = 10;
typedef std::vector<std::unique_ptr<int>> Vui;
int main()
{
std::uint32_t seeds[NSEEDS];
auto t = std::time(nullptr);
for (std::size_t i = 0; i < NSEEDS; i++)
if (seeds[i] == 0)
seeds[i] = t * (i + 3) ;
std::seed_seq seed_seq(seeds, seeds + NSEEDS);
std::mt19937 twister(seed_seq);
std::uniform_int_distribution<int> distribution(0, INT32_MAX);
Vui v;
for (int i = 0; i < N; i++)
v.push_back(std::unique_ptr<int>(new int(distribution(twister))));
for (auto i = 0U; i < v.size(); i++)
std::cout << *v[i].get() << ' ';
std::cout << std::endl;
std::sort(std::begin(v), std::end(v), [](const std::unique_ptr<int>& u, const std::unique_ptr<int>& v) { return *u.get() < *v.get(); });
for (auto i = 0U; i < v.size(); i++)
std::cout << *v[i].get() << ' ';
std::cout << std::endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8cmFuZG9tPgojaW5jbHVkZSA8Y3RpbWU+CiNpbmNsdWRlIDxhbGdvcml0aG0+CiNpbmNsdWRlIDxjc3RkaW50PgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8bWVtb3J5PgoKY29uc3QgaW50IE4gPSAxMDA7CmNvbnN0IGludCBOU0VFRFMgPSAxMDsKCnR5cGVkZWYgc3RkOjp2ZWN0b3I8c3RkOjp1bmlxdWVfcHRyPGludD4+IFZ1aTsKCmludCBtYWluKCkKewogIHN0ZDo6dWludDMyX3Qgc2VlZHNbTlNFRURTXTsKICBhdXRvIHQgPSBzdGQ6OnRpbWUobnVsbHB0cik7CgogIGZvciAoc3RkOjpzaXplX3QgaSA9IDA7IGkgPCBOU0VFRFM7IGkrKykKICAgIGlmIChzZWVkc1tpXSA9PSAwKQogICAgICBzZWVkc1tpXSA9IHQgKiAoaSArIDMpIDsKCiAgc3RkOjpzZWVkX3NlcSBzZWVkX3Nlc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