```
int findRadius(vector<int>& houses, vector<int>& heaters) {
heaters.push_back(INT_MAX);
heaters.push_back(INT_MIN);
sort(heaters.begin(), heaters.end());
long long res = 0;
for (p : houses){
int p1 = lower_bound(heaters.begin(), heaters.end(), p)-heaters.begin();
int p2 = p1-1;
long long temp = min( ((long long)heaters[p1]-p), ((long long)p-heaters[p2]));
res = max(res, temp);
}
return res;
}
```