Language: C++

#include <map>
#include <queue>
#include <cmath>
#include <ctime>
#include <vector>
#include <cstdio>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <tr1/unordered_map>
#define mo 1000000007
#define num(x) (x>='0' && x<='9')
typedef unsigned long long ull;
typedef long long ll;
using namespace std::tr1;
using namespace std;
int read(){
    int p=0, q=1;
    char ch=getchar();
    while (!num(ch))
        (ch=='-'?q=-1:0),
        ch=getchar();
    while (num(ch)) p=p*10+ch-'0', ch=getchar();
    return p*q;
}
int power(ll a, int b){
	ll c=1;
	while (b){
		if (b&1) c=c*a%mo;
		a=a*a%mo;
		b>>=1;
	}
	return c;
}
#define N 200005
int n, k;
ll a[N];
bool check(long double x){
	ll res=0;
	for (int i=1;i<=n;i++){
		ll y = a[i]/x;
		if (y*x<a[i]) y++;
		res+=y-1;
	}
	return res<=k;
}
int main(){
	n=read(), k=read();
	long double le=0.45, ri=0;
	for (int i=1;i<=n;i++) a[i]=read(), ri=max(ri, 1.0*a[i]);
	while (ri-le>0.00001){
		double mid=(le+ri)/2;
		if (check(mid)) ri=mid;
		else le=mid;
	}
	ll ans=ceil(ri);
	cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:51: error: no matching function for call to 'max(long double&, double)'
   52 |         for (int i=1;i<=n;i++) a[i]=read(), ri=max(ri, 1.0*a[i]);
      |                                                ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_tree.h:63,
                 from /usr/include/c++/14/map:62,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:52:51: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and 'double')
   52 |         for (int i=1;i<=n;i++) a[i]=read(), ri=max(ri, 1.0*a[i]);
      |                                                ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:11:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:52:51: note:   mismatched types 'std::initializer_list<_Tp>' and 'long double'
   52 |         for (int i=1;i<=n;i++) a[i]=read(), ri=max(ri, 1.0*a[i]);
      |                                                ~~~^~~~~~~~~~~~~~