#include <iostream>
#include <set>
using namespace std;
int main() {
int n = 100;
set<int> a;
set<int>::iterator pos = a.begin();
//generate set of values 1-10
for (int i = 2; i <= n; i++) {
a.insert(i);
if(pos != a.end())
pos++;
}
pos = a.begin();
while (pos != a.end()) {
int current = *pos++;
int remove = current + current;
while (remove <= n) {
a.erase(remove);
remove += current;
}
}
pos = a.begin();
while (pos != a.end()) {
cout << *pos << " ";
pos++;
}
cout << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c2V0Pgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgbiA9IDEwMDsKICAgc2V0PGludD4gYTsKICAgIHNldDxpbnQ+OjppdGVyYXRvciBwb3MgPSBhLmJlZ2luKCk7CgovL2dlbmVyYXRlIHNldCBvZiB2YWx1ZXMgMS0xMAogICAgZm9yIChpbnQgaSA9IDI7IGkgPD0gbjsgaSsrKSB7CiAgICAgICAgYS5pbnNlcnQoaSk7CiAgICAgICAgaWYocG9zICE9IGEuZW5kKCkpCiAgICAgICAgICAgIHBvcysrOwogICAgfQogICAgcG9zID0gYS5iZWdpbigpOwogICAgd2hpbGUgKHBvcyAhPSBhLmVuZCgpKSB7CiAgICAJaW50IGN1cnJlbnQgPSAqcG9zKys7CiAgICAJaW50IHJlbW92ZSA9IGN1cnJlbnQgKyBjdXJyZW50OwogICAgCXdoaWxlIChyZW1vdmUgPD0gbikgewogICAgCQlhLmVyYXNlKHJlbW92ZSk7CiAgICAJCXJlbW92ZSArPSBjdXJyZW50OwogICAgCX0KICAgIH0KICAgIHBvcyA9IGEuYmVnaW4oKTsKICAgIHdoaWxlIChwb3MgIT0gYS5lbmQoKSkgewogICAgCWNvdXQgPDwgKnBvcyA8PCAiICI7CiAgICAJcG9zKys7CiAgICB9CiAgICBjb3V0IDw8IGVuZGw7CglyZXR1cm4gMDsKfQ==