#include <vector>
#include <algorithm>
#include <cstdlib>
#include <iostream>
template<class bidiiter>
bidiiter random_unique(bidiiter begin, bidiiter end, size_t num_random) {
size_t left = std::distance(begin, end);
while (num_random--) {
bidiiter r = begin;
std::advance(r, rand()%left);
std::swap(*begin, *r);
++begin;
--left;
}
return begin;
}
int main() {
std::vector<int> a(10000);
for(int i=0; i<10000; ++i)
a[i] = i;
random_unique(a.begin(), a.end(), 13);
for(int i=0; i<13; ++i) {
std::cout << a[i] << '\n';
}
return 0;
}
I2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGNzdGRsaWI+CiNpbmNsdWRlIDxpb3N0cmVhbT4KCnRlbXBsYXRlPGNsYXNzIGJpZGlpdGVyPgpiaWRpaXRlciByYW5kb21fdW5pcXVlKGJpZGlpdGVyIGJlZ2luLCBiaWRpaXRlciBlbmQsIHNpemVfdCBudW1fcmFuZG9tKSB7CiAgICBzaXplX3QgbGVmdCA9IHN0ZDo6ZGlzdGFuY2UoYmVnaW4sIGVuZCk7CiAgICB3aGlsZSAobnVtX3JhbmRvbS0tKSB7CiAgICAgICAgYmlkaWl0ZXIgciA9IGJlZ2luOwogICAgICAgIHN0ZDo6YWR2YW5jZShyLCByYW5kKCklbGVmdCk7CiAgICAgICAgc3RkOjpzd2FwKCpiZWdpbiwgKnIpOwogICAgICAgICsrYmVnaW47CiAgICAgICAgLS1sZWZ0OwogICAgfQogICAgcmV0dXJuIGJlZ2luOwp9CgppbnQgbWFpbigpIHsKICAgIHN0ZDo6dmVjdG9yPGludD4gYSgxMDAwMCk7CiAgICBmb3IoaW50IGk9MDsgaTwxMDAwMDsgKytpKQogICAgICAgIGFbaV0gPSBpOwogICAgcmFuZG9tX3VuaXF1ZShhLmJlZ2luKCksIGEuZW5kKCksIDEzKTsKICAgIGZvcihpbnQgaT0wOyBpPDEzOyArK2kpIHsKICAgICAgICBzdGQ6OmNvdXQgPDwgYVtpXSA8PCAnXG4nOwogICAgfQogICAgcmV0dXJuIDA7Cn0=