#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
vector<int> data = {5, 16, 4, 7};
vector<int> index(data.size(), 0);
for (int i = 0 ; i != index.size() ; i++) {
index[i] = i;
}
sort(index.begin(), index.end(),
[&](const int& a, const int& b) {
return (data[a] < data[b]);
}
);
for (int i = 0 ; i != index.size() ; i++) {
cout << index[i] << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8dmVjdG9yPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkgewogICAgdmVjdG9yPGludD4gZGF0YSA9IHs1LCAxNiwgNCwgN307CQogICAgdmVjdG9yPGludD4gaW5kZXgoZGF0YS5zaXplKCksIDApOwogICAgZm9yIChpbnQgaSA9IDAgOyBpICE9IGluZGV4LnNpemUoKSA7IGkrKykgewogICAgICAgIGluZGV4W2ldID0gaTsKICAgIH0KICAgIHNvcnQoaW5kZXguYmVnaW4oKSwgaW5kZXguZW5kKCksCiAgICAgICAgWyZdKGNvbnN0IGludCYgYSwgY29uc3QgaW50JiBiKSB7CiAgICAgICAgICAgIHJldHVybiAoZGF0YVthXSA8IGRhdGFbYl0pOwogICAgICAgIH0KICAgICk7CiAgICBmb3IgKGludCBpID0gMCA7IGkgIT0gaW5kZXguc2l6ZSgpIDsgaSsrKSB7CiAgICAgICAgY291dCA8PCBpbmRleFtpXSA8PCBlbmRsOwogICAgfQogICAgcmV0dXJuIDA7Cn0=