Counting the occurrences of bank account numbers for SPOJ challenge
One area of inefficiency is here:

for (i = 0; i &lt; n; ++i) {
  std::getline(std::cin, accounts[i]);
}
std::cout &lt;&lt; "\n";
std::map&lt;std::string, int&gt; count;
for (i = 0; i &lt; accounts.size(); ++i) {
  auto map_it(count.find(accounts[i]));
  if (map_it != count.end()) {
    map_it-&gt;second++;
  } else {
    count[accounts[i]] = 1;
  }
}


You're reading each account number, storing them then going back through the data to get the counts.  The map class allows for a key that doesn't exist to create an entry on the fly.  Using this will eliminate the second loop:

std::string temp = "";
std::map&lt;std::string, int&gt; count;
for (i = 0; i &lt; n; ++i) {
  std::getline(std::cin, temp);
  count[temp]++; 
}
std::cout &lt;&lt; "\n";