Erase function Unordered map

the code is giving segmentation fault in codingblocks ide
but works fine in other ide’s like ideone - https://ideone.com/oPgJSM , codechef

Also , the map size is not decreasing on removing elements can you explain why ??

Because when you erase from the an unordered map, your iterator can be invalid in some cases