My program is not getting submitted ,but output is correct

include
include
using namespace std;

int main() {
int t,n,x;
cin>>t;
while(t–)
{
int max=0;
cin>>n>>x;

    map <int,int> mpp;
    int a,b;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        mpp.emplace(a,b);
    }
    for(auto it:mpp)
    {
        
        if((it.first)<=x )
        {
            if(it.second>max){
            max=it.second;}
            
        }
        
        
    }
    cout<<max<<endl;
}
return 0;

}
Link for problem CodeChef: Practical coding for everyone

@codestar05
Your code will fail for case like
5 10
1 3
1 5
2 100
2 1000
5 3
your code will give output 100 but its should be 1000

Thank you