fork download
  1. #include <iostream>
  2. #include <unordered_map>
  3. using namespace std;
  4.  
  5. int main() {
  6. unordered_map<int, int> mp;
  7. mp[1]++;
  8. cout << mp.size() << endl;
  9. mp[1]--;
  10. if (mp[1] == 0) {
  11. mp.erase(1);
  12. }
  13. cout << mp.size() << endl;
  14. // your code goes here
  15. return 0;
  16. }
Success #stdin #stdout 0s 4336KB
stdin
Standard input is empty
stdout
1
0