Language: C++

/*ABC174-E*/
#include<stdio.h>
#include<math.h>
#define reg register
#define ri reg int
#define rep(i, x, y) for(ri i = x; i <= y; ++i)
#define nrep(i, x, y) for(ri i = x; i >= y; --i)
#define DEBUG 1
#define ll long long
#define max(i, j) (i) > (j) ? (i) : (j)
#define min(i, j) (i) < (j) ? (i) : (j)
struct IO {
	#define MAXSIZE (1 << 20)
	#define isdigit(x) (x >= '0' && x <= '9')
	char buf[MAXSIZE], *p1, *p2;
	char pbuf[MAXSIZE], *pp;
	#if DEBUG
	#else
		IO() : p1(buf), p2(buf), pp(pbuf) {}
		~IO() {
			fwrite(pbuf, 1, pp - pbuf, stdout);
		}
	#endif
	inline char gc() {
		#if DEBUG
    		return getchar();
		#endif
    	if(p1 == p2)
			p2 = (p1 = buf) + fread(buf, 1, MAXSIZE, stdin);
    	return p1 == p2 ? ' ' : *p1++;
	}
	inline bool blank(char ch) {
    	return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
	}
	template <class T>
	inline void read(T &x) {
    	register double tmp = 1;
    	register bool sign = 0;
    	x = 0;
    	register char ch = gc();
    	for(; !isdigit(ch); ch = gc())
    		if(ch == '-') sign = 1;
    	for(; isdigit(ch); ch = gc())
			x = x * 10 + (ch - '0');
    	if(ch == '.')
			for(ch = gc(); isdigit(ch); ch = gc())
        		tmp /= 10.0, x += tmp * (ch - '0');
    	if(sign) x = -x;
	}
	inline void read(char *s) {
		register char ch = gc();
		for(; blank(ch); ch = gc());
		for(; !blank(ch); ch = gc())
			*s++ = ch;
    	*s = 0;
	}
	inline void read(char &c) {
    	for(c = gc(); blank(c); c = gc());
	}
	inline void push(const char &c) {
		#if DEBUG
    		putchar(c);
		#else
    		if(pp - pbuf == MAXSIZE) {
				fwrite(pbuf, 1, MAXSIZE, stdout);
				pp = pbuf;
			}
    		*pp++ = c;
		#endif
	}
	template <class T>
	inline void write(T x) {
    	if(x < 0) {
			x = -x;
			push('-');
		}
    	static T sta[35];
    	T top = 0;
    	do{
			sta[top++] = x % 10;
			x /= 10;
    	}while(x);
    	while(top)
			push(sta[--top] + '0');
	}
	template <class T>
	inline void write(T x, char lastChar) {
    	write(x);
		push(lastChar);
	}
} io;
int n, k, a[100010];
int check(int l) {
	ri ans = 0;
	rep(i, 1, n) ans += (a[i] - 1) / l);
	return ans <= k;
}
int solve() {
	ri l = 0, r = 1000000000, mid;
	while(l <= r) {
		mid = l + r >> 1;
		if(check(mid)) r = mid;
		else l = mid;
	}
	return mid;
}
int main() {
	io.read(n), io.read(k);
	rep(i, 1, n) io.read(a[i]);
	io.write(solve());
}

Compiler output:
a.cc: In member function 'void IO::read(T&)':
a.cc:37:25: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   37 |         register double tmp = 1;
      |                         ^~~
a.cc:38:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   38 |         register bool sign = 0;
      |                       ^~~~
a.cc:40:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   40 |         register char ch = gc();
      |                       ^~
a.cc: In member function 'void IO::read(char*)':
a.cc:51:31: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   51 |                 register char ch = gc();
      |                               ^~
a.cc: In function 'int check(int)':
a.cc:94:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   94 |         ri ans = 0;
      |            ^~~
a.cc:95:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   95 |         rep(i, 1, n) ans += (a[i] - 1) / l);
      |             ^
a.cc:6:29: note: in definition of macro 'rep'
    6 | #define rep(i, x, y) for(ri i = x; i <= y; ++i)
      |                             ^
a.cc:95:43: error: expected ';' before ')' token
   95 |         rep(i, 1, n) ans += (a[i] - 1) / l);
      |                                           ^
      |                                           ;
a.cc: In function 'int solve()':
a.cc:99:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   99 |         ri l = 0, r = 1000000000, mid;
      |            ^
a.cc:99:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   99 |         ri l = 0, r = 1000000000, mid;
      |                   ^
a.cc:99:35: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   99 |         ri l = 0, r = 1000000000, mid;
      |                                   ^~~
a.cc: In function 'int main()':
a.cc:109:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  109 |         rep(i, 1, n) io.read(a[i]);
      |             ^
a.cc:6:29: note: in definition of macro 'rep'
    6 | #define rep(i, x, y) for(ri i = x; i <= y; ++i)
      |                             ^
a.cc: In instantiation of 'void IO::read(T&) [with T = int]':
a.cc:108:9:   required from here
  108 |         io.read(n), io.read(k);
      |         ~~~~~~~^~~
a.cc:37:25: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   37 |         register double tmp = 1;
      |                         ^~~
a.cc:38:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   38 |         register bool sign = 0;
      |                       ^~~~
a.cc:40:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   40 |         register char ch = gc();
      |                       ^~