#include <iostream>
#include <map>
#include <time.h>
int main ()
{
std::map<int, int> foo;
int i;
for (i = 0; i < 1000000; ++i) {
foo[i] = i;
}
clock_t start = clock();
for (i = 0; i < 1000000; ++i) {
std::map<int, int>::iterator j = foo.find(-1);
}
clock_t finish = clock();
double secs = (finish - start)/(double)CLOCKS_PER_SEC;
std::cout << " total: " << secs << std::endl;
std::cout << "per call: " << secs/1000000 << std::endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWFwPgoKI2luY2x1ZGUgPHRpbWUuaD4KCmludCBtYWluICgpCnsKICAgIHN0ZDo6bWFwPGludCwgaW50PiBmb287CiAgICBpbnQgaTsKICAgIAogICAgZm9yIChpID0gMDsgaSA8IDEwMDAwMDA7ICsraSkgewogICAgICAgIGZvb1tpXSA9IGk7CiAgICB9CiAgICAKICAgIGNsb2NrX3Qgc3RhcnQgPSBjbG9jaygpOwogICAgZm9yIChpID0gMDsgaSA8IDEwMDAwMDA7ICsraSkgewogICAgICAgIHN0ZDo6bWFwPGludCwgaW50Pjo6aXRlcmF0b3IgaiA9IGZvby5maW5kKC0xKTsKICAgIH0KICAgIGNsb2NrX3QgZmluaXNoID0gY2xvY2soKTsKICAgIGRvdWJsZSBzZWNzID0gKGZpbmlzaCAtIHN0YXJ0KS8oZG91YmxlKUNMT0NLU19QRVJfU0VDOwogICAgc3RkOjpjb3V0IDw8ICIgICB0b3RhbDogIiA8PCBzZWNzIDw8IHN0ZDo6ZW5kbDsKICAgIHN0ZDo6Y291dCA8PCAicGVyIGNhbGw6ICIgPDwgc2Vjcy8xMDAwMDAwIDw8IHN0ZDo6ZW5kbDsKfQ==