class Solution{//875 O(Nlogm) O(1)
public:
int minEatingSpeed(vector<int>& a, int h){
long long L=1, R=*max_element(a.begin(),a.end()); // bounds
while(L<R){
long long k=(L+R)>>1, hours=0;// candidate speed
for(int x:a){ hours+=(x+k-1)/k; if(hours>h) break; } // ceil
if(hours<=h) R=k; else L=k+1;// shrink
}
return (int)L;// minimal k
}
};