C++ solution as per given hints
This solution is no longer accepted. \n\n/*\nsort the rooms according to increasing order of size \nFor each query, find the first room with size atleast query[
**This solution is no longer accepted**. \n```\n/*\nsort the rooms according to increasing order of size \nFor each query, find the first room with size atleast query[1] --- index variable here\nNow for all the rooms from index till the end of rooms, take the room with minimum difference between  query[0] and room_id.\n*/\nclass Solution {\npublic:\n    static bool cmp(const vector<int>&a , const vector<int>&b) {\n        return a[1]<b[1];\n    }\n    \n    int search(vector<vector<int>>& rooms, int min_size) {\n        int low = 0;\n        int high = rooms.size()-1;\n        int ans=-1;\n        while(low<=high) {\n            int mid = low+(high-low)/2;            \n            if(rooms[mid][1]<min_size) {\n                low = mid+1;\n            }\n            else {\n                ans = mid; //finds the first index with size atleast min_size\n                high = mid-1;\n            }\n        }\n        return ans;\n    }\n    \n    int find(vector<vector<int>>& rooms, int index , int pref_id) {\n        int ans = index; \n        int min_diff = abs(rooms[index][0]-pref_id);\n        for(int i=index+1;i<rooms.size();i++) {\n            int diff = abs(rooms[i][0]-pref_id);\n            if(diff<min_diff) {\n                min_diff = diff;\n                ans = i;\n            }\n            else if(diff == min_diff) {\n               if(rooms[i][0] < rooms[ans][0]) \n                   ans = i;\n            }\n        }\n        return ans;\n    }\n    \n    vector<int> closestRoom(vector<vector<int>>& rooms, vector<vector<int>>& queries) {\n        sort(rooms.begin(),rooms.end(),cmp);\n        vector<int> result(queries.size(),-1);\n        \n        for(int i=0;i<queries.size();i++)  {\n            int min_size = queries[i][1];\n            int id_pref = queries[i][0];\n            \n            int index = search(rooms,min_size);\n            if(index == -1)\n            {\n                result[i] = -1;\n                continue;\n            }\n            \n            int room_no_index = find(rooms,index,id_pref);\n            result[i] = rooms[room_no_index][0];\n        }\n        return result;\n    }\n};\n```
['C', 'Sorting', 'C++']