Why is this code passing test case but not submission case?


#1

int q;
cin>>q;
map<int, int> b_mp;
while(q–){
int type;
cin>>type;
if(type == 1){
int x, y;
cin>>x>>y;
b_mp.insert(make_pair(x,y));
}
else if(type == 2){
int x;
cin>>x;
b_mp.erase(x);
}
else{
int x;
cin>>x;
cout<<b_mp[x]<<endl;
}
}

Problem link: https://www.interviewbit.com/problems/maps-cpp/