criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;

public class A {
	
	private static boolean check(long[] a, double val, double k) {
		for (int i = 0; i < a.length; i++) {
			k -= Math.ceil(a[i] / val) - 1;
		}
		return k >= 0;
	}
	
    public static void main(String[] args) throws IOException {
    	Scanner s = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String[] input;
		input = reader.readLine().split(" ");
		int n = Integer.parseInt(input[0]), k = Integer.parseInt(input[1]);
		input = reader.readLine().split(" ");
		long[] a = new long[n];
		double start = 0.00000000001, end = 0;
		for (int i = 0; i < n; i++) {
			a[i] = Long.parseLong(input[i]);
			end = Math.max(end, a[i]);
		}
		double ans = end;
		while (Math.ceil(start) != Math.ceil(end) && start <= end) {
			double mid = (start + end) / 2;
			if (check(a, mid, k)) {
				ans = mid;
				end = mid - 0.00000001;
			} else {
				start = mid + 0.00000001;
			}
		}
		out.print((long)Math.ceil(ans));
		out.flush();
		out.close();
    }

}


Compiler output:
Main.java:17: error: class A is public, should be declared in a file named A.java
public class A {
       ^
1 error
Language: Java

import java.util.Scanner;

public class Main {

    static int N;
    static long K;
    static long[] A;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        K = sc.nextLong();
        A = new long[N + 1];
      long max2 = 0;

        for(int i = 0 ; i < N ; i++) {
        	A[i] = sc.nextLong();
        	max2 = Math.max(A[i],max2);
        }

        long max = max2;
        long min = 1l;
        if(K == 0) {
        	System.out.println(max);
        	return;
        }

        // 二分探索
        for (;;) {
            // mid
            long mid = (max + min) / 2;
            if (canSolve(mid)) {
                min = mid;
            } else {
                max = mid;
            }

            if (max - min <= 1) {
                // 終わり
                break;
            }
        }
        for(int i = (int) (min - 100) ; i < min + 100 ; i++) {
          if(i <= 0)
            continue;
        if(canSolve2(i)) {
        	System.out.println(i);
        	break;
        }

    }

    // 解けるかどうか
    static boolean canSolve(long num) {
    	int sum = 0;
    	for(int i = 0 ; i < N ; i++) {
    		sum += A[i] / num;
    	}
    	return sum > K ? true : false;

    }
    static boolean canSolve2(long num) {
    	int sum = 0;
    	for(int i = 0 ; i < N ; i++) {
    		sum += A[i] / num;
    	}
    	return sum == K ? true : false;

    }
}


  

Compiler output:
Main.java:55: error: illegal start of expression
    static boolean canSolve(long num) {
    ^
1 error
Language: C++

#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (ll i = 0; i < n; i++)
#define IREP(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i < b + 1; i++)
#define all(v) v.begin(), v.end()
#define SENTINEL 2000000000
#define NIL -1
using namespace std;
typedef long long ll;

const ll MAX = 510000;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template <class T>inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}


int main()
{
    int n;double k;
    cin >> n >> k;
    double num;
    vector<double> a(n);
    REP(i,n){
        cin >> a[i];
        sum+=a[i];
        num+=a[i];
    }
    num=num/(k+1);
    ll max=0;
    REP(i,n){
        ll a_=a[i];
        double tmp=a[i]/num;
        ll tmp2=round(tmp);
        if(a_%tmp2==0){
            tmp2=a_/tmp2;
        }
        else{
            tmp2=a_/tmp2;
            tmp2++;
        }
        if(max<tmp2){
            max=tmp2;
        }
    }
    cout << max << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: error: 'sum' was not declared in this scope; did you mean 'num'?
   27 |         sum+=a[i];
      |         ^~~
      |         num
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int MOD = 1000000007;
const int MAX32 = 2147483647;
const double PI = 3.14159265358979323846;

int main() {
  long long n, k, tmp_cnt i = 0;
  double tmp_l;
  cin >> n >> k;
  vector<double> l(n);
  vector<int> cnt(n, 0);
  for (i = 0; i < n; i++) {
    cin >> l[i];
  }
  sort(l.begin(), l.end());
  while (k) {
    k--;
    tmp_cnt = ++cnt[n - 1];
    tmp_l = l[n - 1] * tmp_cnt / (tmp_cnt + 1);
    for (i = 1; i < n; i++) {
      if (l[n - i - 1] > tmp_l) {
        l[n - i] = l[n - i - 1];
        cnt[n - i] = cnt[n - i - 1];
      } else {
        break;
      }
    }
    l[n - i] = tmp_l;
    cnt[n - i] = tmp_cnt;
  }
  k = l[n - 1];
  k += (l[n - 1] - k > 0);
  cout << k << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:27: error: expected initializer before 'i'
   10 |   long long n, k, tmp_cnt i = 0;
      |                           ^
a.cc:15:8: error: 'i' was not declared in this scope
   15 |   for (i = 0; i < n; i++) {
      |        ^
a.cc:21:5: error: 'tmp_cnt' was not declared in this scope; did you mean 'tmp_l'?
   21 |     tmp_cnt = ++cnt[n - 1];
      |     ^~~~~~~
      |     tmp_l
a.cc:23:10: error: 'i' was not declared in this scope
   23 |     for (i = 1; i < n; i++) {
      |          ^
a.cc:31:11: error: 'i' was not declared in this scope
   31 |     l[n - i] = tmp_l;
      |           ^
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;

public class A {
	
	private static boolean check(long[] a, double val, double k) {
		for (int i = 0; i < a.length; i++) {
			k -= Math.ceil(a[i] / val) - 1;
		}
		return k >= 0;
	}
	
    public static void main(String[] args) throws IOException {
    	Scanner s = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String[] input;
		input = reader.readLine().split(" ");
		int n = Integer.parseInt(input[0]), k = Integer.parseInt(input[1]);
		input = reader.readLine().split(" ");
		long[] a = new long[n];
		double start = 0.00000000001, end = 0;
		for (int i = 0; i < n; i++) {
			a[i] = Long.parseLong(input[i]);
			end = Math.max(end, a[i]);
		}
		double ans = end;
		while (Math.ceil(start) != Math.ceil(end) && start <= end) {
			double mid = (start + end) / 2;
			if (check(a, mid, k)) {
				ans = mid;
				end = mid - 0.0000001;
			} else {
				start = mid + 0.0000001;
			}
		}
		out.print((long)Math.ceil(ans));
		out.flush();
		out.close();
    }

}


Compiler output:
Main.java:17: error: class A is public, should be declared in a file named A.java
public class A {
       ^
1 error
Language: C

#include <stdio.h>
int main(){
    int a,b,c[2000000],ans;
  for(int i=0;i<a;i++){
    scanf("%d",&c[i]);
    ans+=c[i]
  }
  printf("%d",ans/b)
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:6:14: error: expected ';' before '}' token
    6 |     ans+=c[i]
      |              ^
      |              ;
    7 |   }
      |   ~           
main.c:8:21: error: expected ';' before 'return'
    8 |   printf("%d",ans/b)
      |                     ^
      |                     ;
    9 |   return 0;
      |   ~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using ll = long long;
const int INF = 2147483647;
const ll MOD = 998244353;
// const ll INF = 1000000000000000000LL;

int main(){
 int n,k;
 cin >> n >> k;
 vector<double> a(n);
 rep(i,n) cin >> a[i];
 vector<double> cnt(n);
 for(int i=0;i<n;i++){
    cnt[i]=1;
 }
 priority_queue<pair<double,int>> x;

 for(int i=0;i<n;i++){
    double in = a[i];
    x.push(make_pair(in,i));
 }
 for(int i=0;i<k;i++){
    auto now = x.top();
    x.pop();
    cnt[now.second]++;
    auto nw = make_pair(a[now.second]/cnt[now.second],now.second);
    x.push(nw);
 }
//  rep(i,n){
   //  cout << cnt[i] << endl;
//  }
auto now = x.top();
double ans = a[now.second]/cnt[now.second];
// cout << ceil(ans) << endl;
int ans = ceil(ans);
printf("%d",ans);
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:5: error: conflicting declaration 'int ans'
   37 | int ans = ceil(ans);
      |     ^~~
a.cc:35:8: note: previous declaration as 'double ans'
   35 | double ans = a[now.second]/cnt[now.second];
      |        ^~~
Language: Java

import java.util.Scanner;

public class Main {

    static int N;
    static long K;
    static long[] A;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        K = sc.nextLong();
        A = new long[N + 1];
      long max2 = 0;

        for(int i = 0 ; i < N ; i++) {
        	A[i] = sc.nextLong();
        	max2 = Math.max(A[i],max2);
        }

        long max = max2;
        long min = 1l;
        if(K == 0) {
        	System.out.println(max);
        	return;
        }

        // 二分探索
        for (;;) {
            // mid
            long mid = (max + min) / 2;
            if (canSolve(mid)) {
                min = mid;
            } else {
                max = mid;
            }

            if (max - min <= 1) {
                // 終わり
                break;
            }
        }
        for(int i = (int) (min - 100) ; i < min + 100 ; i++)
          if(i <= 0)
            continue;
        if(canSolve2(i)) {
        	System.out.println(i);
        	break;
        }

    }

    // 解けるかどうか
    static boolean canSolve(long num) {
    	int sum = 0;
    	for(int i = 0 ; i < N ; i++) {
    		sum += A[i] / num;
    	}
    	return sum > K ? true : false;

    }
    static boolean canSolve2(long num) {
    	int sum = 0;
    	for(int i = 0 ; i < N ; i++) {
    		sum += A[i] / num;
    	}
    	return sum == K ? true : false;

    }
}



Compiler output:
Main.java:47: error: cannot find symbol
        if(canSolve2(i)) {
                     ^
  symbol:   variable i
  location: class Main
Main.java:48: error: cannot find symbol
        	System.out.println(i);
        	                   ^
  symbol:   variable i
  location: class Main
Main.java:49: error: break outside switch or loop
        	break;
        	^
3 errors
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;

#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <climits>
using Graph = vector<vector<int>>;
const double PI = 3.14159265358979323846;


int main() {


	long long N,K,A[200100],ans,mem[200100];
	priority_queue<pair<long long, long long>> queue;

	long long max = 0;

	cin >> N >> K;
	for (long long i = 0; i < N; i++) {
		cin >> A[i];
		if (max < A[i]) {
			max = A[i];
		}
	}

	long long lb = 0;
	long long ub = max;

	while (1) {
		long long tmp = (lb + ub) / 2;
		if (needed_kaisu(tmp, N, A) <= K) {
			ub = tmp;
		}
		else {
			lb = tmp;
		}
		if (ub == lb) {
			break;
		}
	}

	cout << ub <<endl;

	cin >> N;

	return 0;


}

int needed_kaisu(long long a, long long N, long long *A) {
	int count = 0;
	for (long long i = 0; i < N; i++) {
		count += (A[i] + a - 1) / a;
	}
	return count;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:21: error: 'needed_kaisu' was not declared in this scope
   37 |                 if (needed_kaisu(tmp, N, A) <= K) {
      |                     ^~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,m;
    cin>>n>>m;
    long long int a[n+5];
    for(int i=0;i<n;i++)
    cin>>a[i];
    long long int lo=1;
    long long int hi=1000000000;
    long long ans=0;
    while(lo<=hi)
    {
        long long int mid=(lo+hi)/2;
        long long count=0;
        for(int i=0;i<n;i++)
        count+=(a[i]/mid);
        if(count<=m)
        {
            ans=mid;
            hi=mid-1;
        }
        else
        lo=mid+1;
    }
    sort(a,a+n);
    if(m==0)
    cout<<a[n-1];
    else
    cout<<ans
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:14: error: expected ';' before '}' token
   31 |     cout<<ans
      |              ^
      |              ;
   32 | }
      | ~
Language: Java


public class Main {


    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();

        long[] a = new long[n];
        for(int i=0; i<n; i++) {
            a[i] = sc.nextInt();
        }


        long l = 1;
        long r = 1000000000;
        while(r-l>1) {
            long mid = (l+r)/2;
            long num = 0;
            for(int i=0; i<n; i++) {
                long len = mid-1;
                long div = a[i]/len;
                long rem = a[i]%len;
                long add = 0;
                if(rem == 0) {
                    add = Math.max(div-1,0);
                } else {
                    add += Math.max(div, 0);
                }
                num += add;
            }
            if(num > k) {
                l = mid;
            } else {
                r = mid;
            }
        }
        System.out.println(r-1);

    }
}

Compiler output:
Main.java:6: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:6: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define rep(ver,n) rep2(ver,0,n)
#define rep2(ver,m,n) for(int ver=m;ver<(n);ver++)
#define loop while(true)
#define dup(x,y) ((int)(((x)+(y)-1)/(y)))
#define all(v) (v).begin(), (v).end()
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

typedef long long ll;
typedef pair<int, int> P;

int main(){
  int n,k;
  
  cin>>n>>k;
  
  int all=n+k;
  
  int a[300000];
  
  int M=0;
  
  rep(i,n){
    cin>>a[i];
    M=max(a[i],M);
  }
  
  if(k==0){
    cout<<M;
    return 0;
  }
  
  double l=0;
  double r=1000000000;
  
  double now=(l+r)/2;
  
  double littl=0.001;
  
  while(r-l>littl){
    int sum=0;
    rep(i,n){
      sum+=dup(a[i],now);
    }
    
    if(all<sum){
      l=now;
    }
    else{
      r=now;
    }
    
    //debug3(l,now,r);
    
    if(r<2){
      ans=1;
      break;
    }
    
    now=(r+l)/2;
  }
  
  int ans=(int)now;
  int sum=0;
  rep(i,n){
    sum+=dup(a[i],ans);
  }
  int ans1=(int)now+1;
  int sum1=0;
  rep(i,n){
    sum1+=dup(a[i],ans1);
  }
  
  if(sum==all)cout<<ans;
  else if(sum1==all)cout<<ans1;
  else cout<<ans;
  
  //debug2(ans,ans+1);
  //double delta=now-ans;
  //if(delta>=0.5)
  //else cout<<ans;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   60 |       ans=1;
      |       ^~~
      |       abs
Language: C++

#include<cmath>
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.sise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
typedef pair<int, int> P;
int main(){
    int n,k;
    cin >> n>>k;
    double a[n];
    int am=0:
    rep(i,n){
        cin >> a[i];  
        am=max(am,(int)a[i]); 
    }
    if(k==0){
        cout<<am<<endl;
        return 0;
    }
    double l=0,r=1000000001;
    while((int)r!=(int)l){
        int temp=0;
        double p=(r+l)/2;
        rep(i,n){
            if(a[i]/p==(int)a[i]/p){
                temp+=a[i]/p;
            }else{
                temp+=(int)(a[i]/p)+1;
            }
        }
        if(temp>k){
            l=p;
        }else{
            r=p;
        }
    }
    cerr<<r<<' '<<l<<endl;
    int ans=0;
    int temp=0;
    double p=l;
    rep(i,n){
        if(a[i]/p==(int)(a[i]/p)){
            temp+=(a[i]/p);
        }else{
            temp+=(int)(a[i]/p)+1;
        }
    }
    //cerr<<"te"<<temp<<endl;
    if(temp<=k){
        if(l==(int)l){
            ans=l;
        }else{
            ans=(int)l+1;
        }
        cerr<<l<<endl;
    }else{
        if(r==(int)r){
            ans=r;
        }else{
            ans=(int)r+1;
        }
        cerr<<r<<endl;
        cerr<<((int)r)<<endl;
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:13: error: expected ',' or ';' before ':' token
   34 |     int am=0:
      |             ^
a.cc:35:9: error: 'i' was not declared in this scope
   35 |     rep(i,n){
      |         ^
a.cc:9:31: note: in definition of macro 'rep'
    9 | #define rep(i,n) for(int i=0; i<(int)(n); i++)
      |                               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, K;
  cin >> N, K;
  
  N, K = 3, 0, 3, 4, 5;
  cout << N, K << 5 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
    9 |   cout << N, K << 5 << endl;
      |              ~~~~~~~^~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
     
    int main(){
      int N, K, l;
      cin >> N >> K;
      float A[N];
      for (int i=0; i<N; i++){
        cin >> A[i];
      }
      for (int i=0; i<K; i++){
        sort(A, A+N);
        A[N-1] /= 2;
      }
      sort(A, A+N);
      l = ceil(float A[N-1]);
      cout << l << endl;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:16:16: error: expected primary-expression before 'float'
   16 |       l = ceil(float A[N-1]);
      |                ^~~~~
Language: C++

#include <boost/multiprecision/cpp_int.hpp>
#include <iostream>
#include <limits.h>
#include <vector>
#include <algorithm>
#include <queue>

using namespace boost::multiprecision;
using namespace std;

struct t {
    int a;
    int v = 1;
    int getl() const { return (a + v - 1) / v; };
    // bool operator<(const t& a) const {
    //     return getl() < a.getl();
    // }
};

int main()
{
    int n = 2;
    int k = 3;
    cin >> n >> k;

    std::priority_queue<t, vector<t>, [](const t&a, const t&b){
        return a.getl() < b.getl();
    }> a;
    for (int i = 0; i < n; ++i) {
        int ai;
        cin >> ai;
        a.push({ ai, 1 });
    }

    for (int i = 0; i < k; ++i) {
        t x = a.top();
        a.pop();
        ++(x.v);
        a.push(x);
    }

    cout << a.top().getl() << endl;

    return 0;
}



Compiler output:
a.cc:1:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    1 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>

const int MAX_N = 200005;
int N, K;
int logs[MAX_N];
  std::multiset<int> llcp;

bool check(int maxlen) {
  std::multiset<int> ll == llcp;

  for (int i = 0; i < K; ++i) {
    int log = -*ll.begin();
    ll.erase(ll.begin());
    if (log <= maxlen) return true;
    ll.insert(-maxlen);
    ll.insert(-(log - maxlen));
  }
  return -*ll.begin() <= maxlen;
}

int main() {
  scanf("%d %d", &N, &K);
  int mm = 0;
  for (int i = 0; i < N; ++i)
    ll.insert(-logs[i]);
  for (int i = 0; i < N; ++i) {
    scanf("%d", logs + i);
    mm = std::max(mm, logs[i]);
  }
  long long hi = 1ll<<31;
  long long lo = 0;
  while (hi - lo > 1) {
    long long mid = (hi + lo) / 2;
    if (check(mid)) {
      hi = mid;
    } else {
      lo = mid;
    }
  }
  if (check(lo)) printf("%lld\n", lo);
  else printf("%lld\n", hi);
}


Compiler output:
a.cc: In function 'bool check(int)':
a.cc:9:25: error: expected initializer before '==' token
    9 |   std::multiset<int> ll == llcp;
      |                         ^~
a.cc:12:17: error: 'll' was not declared in this scope
   12 |     int log = -*ll.begin();
      |                 ^~
a.cc:18:12: error: 'll' was not declared in this scope
   18 |   return -*ll.begin() <= maxlen;
      |            ^~
a.cc: In function 'int main()':
a.cc:25:5: error: 'll' was not declared in this scope
   25 |     ll.insert(-logs[i]);
      |     ^~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;
template <class T>
bool chmax(T &a, const T &b)
{
	if (a < b)
	{
		a = b;
		return 1;
	}
	return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
	if (a > b)
	{
		a = b;
		return 1;
	}
	return 0;
}

ll M = 1000000007;
using tdii=tuple<double,int,int>;
void solve()
{
	priority_queue<tdii>logs;
	int n,k;
	cin>>n>>k;
	rep(i,n){
		int a;
		cin>>a;
		logs.push(tdii(a,a,1));
	}
	int cnt=0;
	while(cnt!=k){
		auto [now,init,cuts]=logs.top();
		logs.pop();
		auto [nnow,ninit,ncuts]=logs.top();
		int cuts2=init/nnow;
		cnt+=cuts2-cuts;
		if(cnt>k){
			cnts2-=cnt-k;
			cnt=k;
		}
		now=(double)init/cuts2;
		logs.push(tdii(now,init,cuts2));
	}
	auto [now,init,cuts]=logs.top();
	cout<<int(ceil(now))<<endl;
	
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}


Compiler output:
a.cc:19:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
   19 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

/* include c++ libraries */
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <queue>
#include <set>

/* include c-lang libraries */
#include <climits>
#include <cmath>

/* include my libraries */
#include <show_vec.hh>

using namespace std;

#define LINE DEBUG{ printf("LINE : %d\n", __LINE__); }
#define DEBUG if(false)

using ll = long long;
template<class T> using vec = vector<T>;

const int MOD = 1000000007;

int main(){
  int N, K;
  cin >> N >> K;
  vec<int> A(N);
  ll sum = 0;
  for(int i = 0; i < N; i++){
    cin >> A[i];
    sum += A[i];
  }

  double min = (double)sum / (N+K);
  vec<pair<double, int>> B(N);
  int cuts = 0;
  for(int i = 0; i < N; i++){
    int c = A[i] / min - 1;
    cuts += c;
    B[i] = make_pair( (double)A[i] / (c+1), c);
  }
  sort(B.begin(), B.end());
  while(cuts < K){
    auto BB = B[N-1];
    double origin = BB.first * (BB.second+1);
    cuts++;
    B[N-1] = make_pair(origin / (BB.second+2), BB.second+1);
    sort(B.begin(), B.end());
  }


  printf("%d\n", (int)(B[N-1].first+0.9));
  /*
  printf("sum : %lld\n", sum);
  printf("min : %lf\n", min);
  show_vec(A);
  show_vec(B);
  */
  return 0;
}


Compiler output:
a.cc:16:10: fatal error: show_vec.hh: No such file or directory
   16 | #include <show_vec.hh>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std ;
const int MAXN = 2e5 + 10;
int n,k;
int a[MAXN];
inline bool check(int m)
{
    int ans = 0;
    rep(i,1,n) {
        if (a[i] != m) ans += a[i] / m;
        if (ans > k) return 0;
    }
    return ans <= k;
}

int main()
{
    scanf("%d%d",&n,&k);
    int l = 1;
    int r = -1;
    rep(i,1,n) {
        scanf("%d",a + i);
        if (i == 1) {
            r = a[i];
        } else {
            
            r = max(r,a[i]);
        }
    }
    int m;
    int ans = 1;

    while (l < r) {

        m = (l + r) / 2;
        if (check(m)) {
            r = m;
            ans = m;
        } else l = m + 1;
    }
    printf("%d\n",r);
    return 0;
}


Compiler output:
a.cc: In function 'bool check(int)':
a.cc:9:9: error: 'i' was not declared in this scope
    9 |     rep(i,1,n) {
      |         ^
a.cc:9:5: error: 'rep' was not declared in this scope
    9 |     rep(i,1,n) {
      |     ^~~
a.cc: In function 'int main()':
a.cc:21:9: error: 'i' was not declared in this scope
   21 |     rep(i,1,n) {
      |         ^
a.cc:21:5: error: 'rep' was not declared in this scope
   21 |     rep(i,1,n) {
      |     ^~~
Language: C++

#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#include<cmath>
#include<cstdint>
// 多倍長整数型
/* ---------------------- ここから ---------------------- */
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
/* ---------------------- ここまで ---------------------- */
     
#define INF 1e9
#define LINF 1e19
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)
     
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;
     
const ll MOD = 1e9 + 7;

int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n)cin >> a[i];
    ll lb = 0, ub = INF* 10 + 1;
    ll mx = 0;
    if(k == 0){
        rep(i, n)chmax(mx, a[i]);
        cout << mx << endl;
      return 0;
    }

    while(ub - lb > 1){
        ll mid = (ub + lb) / 2;
        ll tmp = 0;
        rep(i, n){
            tmp += (a[i] / mid);
        }
      //cout << mid << " " << tmp << endl;
        if(tmp <= k)ub = mid;
        else lb = mid;
    }
    bool f = true;
    if(lb == 0){
        cout << lb + 1 << endl;
        return 0;
    }
    bool f = true;
    rep(i, n)if(a[i] % lb != 0)f = false;
    cout << (f ? lb : lb + 1) << endl;
}





Compiler output:
a.cc:21:10: fatal error: boost/multiprecision/cpp_dec_float.hpp: No such file or directory
   21 | #include <boost/multiprecision/cpp_dec_float.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h> 
using namespace std;
long long n,m,a[200010];
bool check(long long x){
	if(x==0)return 
	long long s=0;
	for(long long i=1;i<=n;i++)
	s=s+(a[i]-1)/x;
	if(s<=m)return true;
	else return false;
}
int main(){
	scanf("%lld%lld",&n,&m);
	long long ss=0;
	for(long long i=1;i<=n;i++){
		cin>>a[i];
		ss=max(ss,a[i]);
	}
	long long l=0,r=ss,ans=0;
	while(l<=r){
		long long mid=(l+r)>>1;
		if(check(mid)){
			r=mid-1;
			ans=mid;
		}
		else l=mid+1;
	}
	long long s=0;
	for(long long i=1;i<=n;i++)
	s=s+(a[i]*2-1)/(ans*2-1);
	if(s>m)ans--;
	printf("%lld",ans);
	return 0;
}


Compiler output:
a.cc: In function 'bool check(long long int)':
a.cc:6:9: error: expected primary-expression before 'long'
    6 |         long long s=0;
      |         ^~~~
a.cc:5:23: error: expected ';' before 'long'
    5 |         if(x==0)return
      |                       ^
      |                       ;
    6 |         long long s=0;
      |         ~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef vector<int> vec;
//配列の添字ズレに注意
//=に注意
int main(){
  long n,k; long double x,ans;
  cin>>n>>k;
  
  priority_queue<pair<long double,long>> pq;
  
  
  rep(i,n){
    cin>>x;
    pair<long double,long> p(x,-1);
    pq.push(p);
  }
  
  pair<long double,long> now(0,0);
  rep(i,k){
    now=pq.top();
    pq.pop();
    
    now.first=now.first*now.second/(now.second-1);
    if(now.first=<1)break;
    now.second--;
    
    pq.push(now);
    
    
  }
  
  now=pq.top();
  ans=now.first;
  
  cout<<long(ceil(ans))<<endl;
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:18: error: expected primary-expression before '<' token
   26 |     if(now.first=<1)break;
      |                  ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main()
{
    cout << fixed << setprecision(10);
    int n, k;
    cin >> n >> k;

    vector<int> a(n);
    REP(i, n)
    {
        cin>>a[i];
    }
    RSORT(a);

    LLI l = 0, r = 1e9;

    while (l < r)
    {
        LLI m = (l + r) / 2;
        int c = 0;
        REP(i, n)
        {
            c += (a[i] - 1) / m;
        }

        if (c <= k)
        {
            r = m;
        }
        else
        {
            l = m+1;
        }
    }
    cout << l << << endl;



    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:18: error: expected primary-expression before '<<' token
   57 |     cout << l << << endl;
      |                  ^~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	long long nHave, nCuts;
	cin >> nHave >> nCuts;
	vector<long long> a(nHave);
	for (long long i = 0; i < nHave; i++)
		cin >> a[i];
	long double low = 0;
	long double high = 1000.0 * 1000 * 1000 + 1;
	long long cycles = 100;
	for (long long i = 0; i < cycles; i++)
	{
		long double mid = (low + high) / 2;
		//cout << mid << "!\n";
		long long total = 0;
		for (long long j = 0; j < nHave; j++)
		{
			long long cur = ceil(a[j] / mid);
			cur--;
			if (a[j] <= mid) cur = 0;
			total += cur;
			//cout << cur << " ";
		}
		//cout << "\n";
		//cout << total << "?\n";
		if (total <= nCuts)
			high = mid;
		else
			low = mid;
	}
	cout << (long long)(round(high)) << "\n";

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:41: error: 'ceil' was not declared in this scope
   26 |                         long long cur = ceil(a[j] / mid);
      |                                         ^~~~
a.cc:39:29: error: 'round' was not declared in this scope
   39 |         cout << (long long)(round(high)) << "\n";
      |                             ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

struct data {
    double a;
    int orig;
    int d;

    data(int aa, int dd) {
        a = (double)aa / dd;
        orig = aa;
        d = dd;
    }

    bool operator<(const data& other) const {
        return a < other.a;
    }
};

int main(void) {
    priority_queue<data> q;
    int n, k;
    cin >> n >> k;
    vector<int> aa(0, n);
    for(int i = 0; i < n; i++) {
        int a;
        cin >> a;
        q.emplace(a, 1);
    }
    for(int i = 0; i < k; i++) {
        const data &dat = q.top();
        int a = dat.orig;
        int d = dat.d + 1;
        q.pop();
        q.emplace(a, d);
    }

    cout << (long long)ceil(q.top().a) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:24: error: template argument 1 is invalid
   21 |     priority_queue<data> q;
      |                        ^
a.cc:21:24: error: template argument 2 is invalid
a.cc:21:24: error: template argument 3 is invalid
a.cc:28:11: error: request for member 'emplace' in 'q', which is of non-class type 'int'
   28 |         q.emplace(a, 1);
      |           ^~~~~~~
a.cc:31:15: error: reference to 'data' is ambiguous
   31 |         const data &dat = q.top();
      |               ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:4:8: note:                 'struct data'
    4 | struct data {
      |        ^~~~
a.cc:32:17: error: 'dat' was not declared in this scope; did you mean 'data'?
   32 |         int a = dat.orig;
      |                 ^~~
      |                 data
a.cc:34:11: error: request for member 'pop' in 'q', which is of non-class type 'int'
   34 |         q.pop();
      |           ^~~
a.cc:35:11: error: request for member 'emplace' in 'q', which is of non-class type 'int'
   35 |         q.emplace(a, d);
      |           ^~~~~~~
a.cc:38:31: error: request for member 'top' in 'q', which is of non-class type 'int'
   38 |     cout << (long long)ceil(q.top().a) << endl;
      |                               ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;

int main() {
    ll n,k;
    cin >> n >> k;
    vector<ll> vec(n);
    rep(i,n) cin >> vec[i];
    ll ok=10000000000 ng=-1;
    while(ok-ng>1){
        int cnt=0;
        int a=ok-ng;
        rep(i,n){
            int x=vec[i];
            cnt+=log(x)/log(a);
        }
        if(cnt<=k){
            ok=a;
        }
        else ng=a;
    }
    cout << ok << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:23: error: expected ',' or ';' before 'ng'
   11 |     ll ok=10000000000 ng=-1;
      |                       ^~
a.cc:12:14: error: 'ng' was not declared in this scope; did you mean 'n'?
   12 |     while(ok-ng>1){
      |              ^~
      |              n
Language: Java

/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fcking interest
*******************************
I'm standing on top of my Monopoly board
That means I'm on top of my game and it don't stop
til my hip don't hop anymore
https://www.a2oj.com/Ladder16.html
*******************************
300iq as writer = Sad!
*/
import java.util.*;
import java.io.*;
import java.math.*;
import java.lang.Math;

   public class E
   {
      static final double EPS = 0.0000001;
      static final double EPS2 = 0.0000000001;
      public static void main(String hi[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         int K = Integer.parseInt(st.nextToken());
         StringBuilder sb = new StringBuilder();
         int[] arr = new int[N];
         st = new StringTokenizer(infile.readLine());
         for(int i=0; i < N; i++)
            arr[i] = Integer.parseInt(st.nextToken());
         double low = EPS2;
         double high = 1.0*arr[0];
         for(int x: arr)
            high = Math.max(high, 1.0*x);
         while(low+EPS < high)
         {
            double mid = (low+high)/2;
            long moves = 0L;
            for(int x: arr)
            {
               int lol = (int)(x/mid);
               moves += lol;
               if(Math.abs(lol*mid-x) > EPS2)
                  moves++;
            }
            moves -= N;
            if(moves > K)
               low = mid;
            else
               high = mid;
         }
         int res = (int)Math.ceil(low);
         System.out.println(res);
      }
   }

Compiler output:
Main.java:23: error: class E is public, should be declared in a file named E.java
   public class E
          ^
1 error
Language: C

#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int64 n,k;
    cin >> n >> k;
    vector<int64> a(n);
    for (int i=0; i<n; i++) cin >> a[i];


    int64 l = 0;
    int64 r = a[0];
    for (int i=0; i<n; i++) r=max(r,a[i]);

    while(l+1 < r) {
        int64 m = (l+r)/2;
        int64 t = 0;

        for (int i=0; i<n; i++) {
            t += a[i] / m;
            if (t > k) break;
        }

        if (t <= k) r = m;
        else l = m;
    }

    cout << r << endl;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <numeric>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

int main()
{
	int n, k;
	cin >> n >> k;

	priority_queue<double> aq;
	for (int i = 0; i < n; ++i) {
		double a;
		cin >> a;
		aq.push(a);
	}

	int c = 0;
	while (c < k) {
		++c;
		double t = aq.top();
		aq.pop();
		double t2 = aq.top();
		double w = 2.0;
		while (c < k) {
			if (t2 < t / w) {
				w += 1.0;
				++c;
			}
			else {
				break;
			}
		}
		aq.push(t / w);
	}

	cout << long long(aq.top() + 0.9999999) << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:17: error: expected primary-expression before 'long'
   41 |         cout << long long(aq.top() + 0.9999999) << endl;
      |                 ^~~~
Language: C

#include<stdio.h>
int main(){
  int n,k;
  double a[200000];
  double b;
  int c=0;
  scanf("%d",&n);
  scanf("%d",&k);
  for(int i=0;i<n;i++){
    scanf("%f",&a[i]);
  }
  b=a[0];
  for(int i=0;i<k;i++){
    for(int j=1;j<n;j++){
      if(b<a[j]){
        b=a[j];
        c=j;
      }
    }
    a[c]=b/2;
  }
  b=a[0];
  for(int i=1;i<n;i++){
    if(b<a[j]){
      b=a[j];
    }
  }
  printf("%f\n",&b);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:24:12: error: 'j' undeclared (first use in this function)
   24 |     if(b<a[j]){
      |            ^
main.c:24:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int main(){
  int n,k;
  double a[200000];
  double b;
  int c=0;
  scanf("%d",&n);
  scanf("%d",&k);
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  b=a[0];
  for(int i=0;i<k;i++){
    for(int j=1;j<n;j++){
      if(b<a[j]){
        b=a[j];
        c=j;
      }
    }
    a[c]=b/2;
  }
  b=a[0];
  for(int i=1;i<n;i++){
    if(b<a[j]){
      b=a[j];
    }
  }
  printf("%f\n",&b);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:24:12: error: 'j' undeclared (first use in this function)
   24 |     if(b<a[j]){
      |            ^
main.c:24:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;

long long a[200000];

int main()
{
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n; i++) cin >> a[i];
    double h = 0.001, t = 1'000'000'000;
    while (std::abs(h - t) > 1e-6)
    {
        double m = (h + t) / 2;
        long long c = 0;
        for (int i = 0; i < n; i++)
        {
            auto ci = (long long)(a[i] / m);
            if (std::abs(a[i] - ci * m) < 1e-6) ci--;
            c += ci;
        }
        if (c <= k)
            t = m;
        else
            h = m;
    }
    cout << (long long)(std::round(h)) << '\n';
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:30: error: 'round' is not a member of 'std'
   32 |     cout << (long long)(std::round(h)) << '\n';
      |                              ^~~~~
Language: C++

#define DEBUG
#ifdef DEBUG
#include "../../lib/utils.cpp"
#endif
#include <bits/stdc++.h>

using namespace std;
using ll = int64_t;
#define int int64_t
#define INF 10e9

/* ==== declarations ====== */
// functions
void solve();
void getInput();

// global variables
int N, K;
int maxsize = 0;
vector<int> A;

void getInput()
{
    cin >> N >> K;
    for (int i = 0; i < N; ++i)
    {
        int inp;
        cin >> inp;
        A.push_back(inp);
        maxsize = max(maxsize, inp);
    }
}

bool isOK(double u)
{
    int cost = 0;
    for (auto a : A)
    {
        if (a <= u)
        {
            continue;
        }

        double cc = a / u;
        int c = cc;
        // print("a: ", a, "u: ", u);
        // print("cc:", cc, "c:", c);
        cost += c;
        // print(c, cost);
    }
    // print("cut by ", u, ", cost: ", cost);
    return cost <= K;
}

void solve()
{
    // print(A);
    // isOK(3);
    // print(isOK(3));
    // exit(0);

    double left = -1;
    double right = maxsize;
    while (right - left > 0.25)
    {
        // print("===");
        // print(right, left);
        // print("===");
        double mid = left + (right - left) / 2;
        if (isOK(mid))
        {
            right = mid;
        }
        else
        {
            left = mid;
        }
    }
    int ans = right;
    ans++;
    cout << ans << endl;
}

signed main()
{
    getInput();
    solve();

    return 0;
}


Compiler output:
a.cc:3:10: fatal error: ../../lib/utils.cpp: No such file or directory
    3 | #include "../../lib/utils.cpp"
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N = 2010100;
long long  n,k;
long long  S[N];
bool pd(int K)
{
	long long A = 0;
	for(int i = 1;i <= n;i++)
	{
		A += S[i]%K?S[i]/K:S[i]/K-1;
	}
	return A<=k;
}
int main()
{
	int ans = 0;
	scanf("%lld%lld",&n,&k);
	for(int i = 1;i <= n;i++)
	{
		scanf("%lld",&S[i]);
		ans= max(S[i],ans);
	}
	int r = ans,l = 0;
	while(l <= r)
	{
		int mid = l+r>>1;
		if(pd(mid))
		{
			ans = min(ans,mid);
			r = mid-1;
		}
		else l = mid+1;
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:25: error: no matching function for call to 'max(long long int&, int&)'
   22 |                 ans= max(S[i],ans);
      |                      ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 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:22:25: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   22 |                 ans= max(S[i],ans);
      |                      ~~~^~~~~~~~~~
/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:
/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:22:25: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   22 |                 ans= max(S[i],ans);
      |                      ~~~^~~~~~~~~~