criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
using namespace std;
vector<int>a ;
int n,k ;
bool ok(int c){
  int ans =0 ;
  for(int &x:a)
    ans+=(x-1)/c ;
  return ans<=k ;
}
int main() {
  cin >> n >> k ;
  a=vector<int>a(n);
  for(int &x:a)
    cin >> x ;
  int lb=1,rb=1e9 ;
  while(lb<rb){
    int mb=(lb+rb)/2 ;
    if(ok(mb))
      lb=mb+1 ;
    else
      rb=mb ;
  }
  cout << lb << "\n";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:16: error: expected primary-expression before 'a'
   13 |   a=vector<int>a(n);
      |                ^
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define int long long
#define MOD 1000000007
#define mod 998244353
#define ff first
#define ss second
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
#define vii vector<pii>
#define vvi vector<vi>
#define endl "\n"
using namespace std;
void solve1();
void solve()
{
    int T;cin>>T;
    for(int z=1;z<=T;z++)
    {
        solve1();
    }
}
signed main()
{
    std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    solve1();
    return 0;
}
void solve1()
{
    int n,k;cin>>n>>k;
    int arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    sort(arr,arr+n);
    int lo=1,hi=arr[n-1];
    int ans=hi;
    int c=((lo + hi)/2);
    while(lo!=hi)
    {
        c=((lo + hi)/2);
        int f=0;
        for(int i=0;i<n;i++)
        {
            if(arr[i]>c)
            {
                f+=((arr[i]-1)/c);
            }
        }
        if(f>k)
        {
            lo = c;
        }
        else
        {
            hi =c;
            ans=min(ans,c);
        }
        if(lo==hi-1)
        {
            break;
        }

    }
    if(k==0)
    {
        cout<<arr[n-1]<<endl;
    }
    else
    {
        c=ans-1;
        for(int i=0;i<n;i++)
        {
            if(arr[i]>c)
            {
                f+=((arr[i]-1)/c);
            }
        }
        if(f>k)
        {
            lo = c;
        }
        else
        {
            hi =c;
            ans=min(ans,c);
        }
        cout<<ans<<endl;
    }
}


Compiler output:
a.cc: In function 'void solve1()':
a.cc:80:17: error: 'f' was not declared in this scope
   80 |                 f+=((arr[i]-1)/c);
      |                 ^
a.cc:83:12: error: 'f' was not declared in this scope
   83 |         if(f>k)
      |            ^
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define int long long
#define MOD 1000000007
#define mod 998244353
#define ff first
#define ss second
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
#define vii vector<pii>
#define vvi vector<vi>
#define endl "\n"
using namespace std;
void solve1();
void solve()
{
    int T;cin>>T;
    for(int z=1;z<=T;z++)
    {
        solve1();
    }
}
signed main()
{
    std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    solve1();
    return 0;
}
void solve1()
{
    int n,k;cin>>n>>k;
    int arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    sort(arr,arr+n);
    int lo=1,hi=arr[n-1];
    int c=((lo + hi)/2);
    while(lo!=hi)
    {
        c=((lo + hi)/2);
        int f=0;
        for(int i=0;i<n;i++)
        {
            if(arr[i]>c)
            {
                f+=((arr[i]-1)/c);
            }
        }
        if(f>k)
        {
            lo = c;
        }
        else
        {
            hi =c;
            ans=min(ans,c);
        }
        if(lo==hi-1)
        {
            break;
        }

    }
    if(k==0)
    {
        cout<<arr[n-1]<<endl;
    }
    else
    {
        cout<<ans<<endl;
    }
}


Compiler output:
a.cc: In function 'void solve1()':
a.cc:60:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   60 |             ans=min(ans,c);
      |             ^~~
      |             abs
a.cc:74:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   74 |         cout<<ans<<endl;
      |               ^~~
      |               abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define lint long long
#define inf 100000000000000000
#define mod 1000000007
#define MAX 200005
#define pb push_back
#define vit vector<int>::iterator

int A[MAX],n,k;
int possible(int mid){
    int sum=0;
    for(int i=0;i<n;i++){
        if(!(A[i]%mid))
            sum+=A[i]/mid+1;
        else
            sum+=A[i]/mid;
    }
    if(sum<=k)
        return 1;
    return 0;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int mx=0,hi,lo,mid;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>A[i];
        mx=max(mx,A[i]);
    }
    lo=0;
    hi=mx;
    while(hi>lo){
        mid=(hi+lo)/2;
        if(possible(mid)) hi=mid;
        else lo=mid+1;
    }
    cout<<lo;
    return 0;
}
/*
7 996517963
272503281 385111446 560895033 742625617 115928149 113486455 918393042
*/
/*
77858080 110031841 160255723 212178747 33122328 32424701 262398012
*/
/*
#include<bits/stdc++.h>
using namespace std;
#define lint long long
#define inf 100000000000000000
#define mod 1000000007
#define MAX 200005
#define pb push_back
#define vit vector<int>::iterator

int A[MAX],n,k;
int possible(int mid){
    int sum=0;
    for(int i=0;i<n;i++){
        if(!(A[i]%mid))
            sum+=A[i]/mid+1;
        else
            sum+=A[i]/mid;
    }
    if(sum<=k)
        return 1;
    return 0;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int mx=0,hi,lo,mid;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>A[i];
        mx=max(mx,A[i]);
    }
    lo=0;
    hi=mx;
    while(hi>lo){
        mid=(hi+lo)/2;
        if(possible(mid)) hi=mid;
        else lo=mid+1;
    }
    cout<<lo;
    return 0;
}



Compiler output:
a.cc:50:1: error: unterminated comment
   50 | /*
      | ^
Language: C++

//
#include <vector>
#include <set>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>

//
#include <intrin.h>

//
using ll = long long;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
#define BIGP   1000000007
#define INF_I  std::numeric_limits<ll>::max()
#define INF_F  std::numeric_limits<float>::infinity()
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    //
    ll L = 0;
    ll R = 1e9;
    while(R-L>1)
    {
        ll x = (L + R) / 2;
        bool okay = [&]
        {
            ll total = 0;
            rep(i, A.size()) total += (A[i] - 1) / x;
            return total <= K;
        }();
        //
        okay ? R = x : L = x;
    }
    cout << R;
    //
    return 0;
}

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

#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define res(i,n) for(int i=n;;i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l) 
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
long double PI = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998626034825342117;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(long long x, long long y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(long long x, long long y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
int main() {
    long long N, K; cin >> N >> K;
    vector<pair<long double, int>>P(N);
    rep(i, N) {
        cin >> P[i].first;
        P[i].second = 1;
    }
    rep(i, K) {
        sort(P.begin(), P.end());
        P[N - 1].first = P[N - 1].first * P[N - 1].second / (P[N - 1].second + 1);
        P[N - 1].second++;
    }
    sort(P.begin(), P.end());
    cout << long long(P[N - 1].first+0.9999) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:83:13: error: expected primary-expression before 'long'
   83 |     cout << long long(P[N - 1].first+0.9999) << endl;
      |             ^~~~
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define ld long double
int main()
{
    ll n;
    ll k;
    ll total = 0;
    ll ans;
    ll zero_max = 0;
    std::vector<ll> A;
    std::cin >> n >> k;
    for (ll i = 0; i < n; ++i) {
        ll temp;
        std::cin >> temp;
        A.push_back(temp);
        total += temp;
        zero_max = std::max(temp, zero_max);
    }
    if (k == 0) {
        std::cout << zero_max << std::endl;
        return 0;
    }
    ll mid;
    ll left = 0;
    ll right = zero_max;
    while ((right - left) > 1) {
        mid = (left + right) / 2;

        ll temp_count = 0;
        for (ll j = 0; j < n; ++j) {
            temp_count += ((a[j] + mid - 1) / mid - 1);
        }
        //std::cout << mid << " " << temp_count << std::endl;

        if (temp_count <= k) {
            right = mid;
        } else {
            left = mid;
        }
    }
    std::cout << right << std::endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:29: error: 'a' was not declared in this scope
   32 |             temp_count += ((a[j] + mid - 1) / mid - 1);
      |                             ^
Language: C++

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;

#define rep(i, n) \
for(int i = 0; i <n; i++)
#define REP(i, a, b) \
for(int i = int(a); i <= int(b); i++)
#define TRvi(c, it) \
for(vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for(vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for(msi::iterator it = (c).begin(); it != (c).end(); it++)

#define INF 2000000000

#define MEMSET_INF 127
#define MEMSET_HALF_INF 63
bool check(ll x, vector<ll> logs, ll k){
    ll summ = 0;
    if(x!=0){
        rep(i,logs.size()){
            if(logs[i]%x==0){summ+=(logs[i]/x-1);}
            else{summ+=logs[i]/x;}
        }
//    }else{
//        rep(i,logs.size()){
//            summ+=logs[i];
//        }
//    }
    return summ<=k;
}
void solve(){
    ll n,k;
    cin>>n>>k;
    vector<ll> logs(n);
    ll maxx = 0;
    rep(i,n) {cin>>logs[i]; if(logs[i]>maxx){maxx=logs[i];}}
    ll low = 1;
    ll high = maxx;
    while (low<high) {
        ll mid = (low+high)/2;
        if(check(mid, logs, k)){
            high=mid-1;
        }else{
            low=mid+1;
        }
    }
    cout<<low<<endl;
}

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


Compiler output:
a.cc: In function 'bool check(ll, std::vector<long long int>, ll)':
a.cc:40:13: error: a function-definition is not allowed here before '{' token
   40 | void solve(){
      |             ^
a.cc:59:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   59 | int main()
      |         ^~
a.cc:59:9: note: remove parentheses to default-initialize a variable
   59 | int main()
      |         ^~
      |         --
a.cc:59:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:60:1: error: a function-definition is not allowed here before '{' token
   60 | {
      | ^
a.cc:65:2: error: expected '}' at end of input
   65 | }
      |  ^
a.cc:26:40: note: to match this '{'
   26 | bool check(ll x, vector<ll> logs, ll k){
      |                                        ^
a.cc:65:2: warning: control reaches end of non-void function [-Wreturn-type]
   65 | }
      |  ^
Language: C++

#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

int main() {
    int n, k, a;
    scanf("%d", &n);
    scanf("%d", &k);
    vector<int> vec(n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a);
        vec.at(i) = a;
    }
    sort(vec.begin(), vec.end());
    bool success = true;
    int min = 0;
    int max = vec[r];

    while(min != max && max - min != 1) {
        int k_sum = 0;
        success = true;
        int target = (min+max)/2;
        for(int i=0; i<n; i++) {
            k_sum += (vec[i] / target);
            if(k_sum > k) {
                success = false;
                break;
            }
        }
        if(success) { max = target; } else { min = target; }
    }
    cout << max << '\n';
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   16 |     sort(vec.begin(), vec.end());
      |     ^~~~
      |     sqrt
a.cc:19:19: error: 'r' was not declared in this scope
   19 |     int max = vec[r];
      |                   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
//#pragma comment(linker, "/STACK:102400000,102400000")
typedef long long ll;
typedef pair<int,int> P;
#define ls(x) (x<<1)
#define rs(x) (x<<1|1)
#define lowbit(x) (x&-x)
const ll INF=0x3f3f3f3f;
const double EPS=1e-7;
const int N=2e5+10;
const ll mod=1e9+7;
inline ll read()
{  ll f=1,x=0;char ch=getchar();
   for(;ch>'9'||ch<'0';ch=getchar())if(ch=='-') f=-1;
   for(;ch<='9'&&ch>='0';ch=getchar()) x=x*10+ch-'0';
   return x*f;
}
ll n,k;
long double a[N];
bool check(long double mid)
{  ll cnt=0;
   for(ll i=1;i<=n;i++)
   {  if(a[i]<=mid)continue;
      ll q=ceil((a[i]-mid)/mid);
      //printf("q=%d\n",q);
      if(q)cnt=cnt+q;
      if(cnt>1000000000)return 0;
   }
   if(cnt>k)return 0;
   else return 1;
}
int main()
{  //printf("%lf",ceil(0.5/0.2-1.0));
   cin>>n>>k;
   for(int i=1;i<=n;i++)cin>>a[i];
   double l=0.000001,r=1e9+5,ans;
   while(r-l>=EPS)
   {  long double mid=(l+r)/2;
      if(check(mid))
      {  ans=mid;
         r=mid-0.000001;
      }
      else
      {  l=mid+0.000001;
      }
   }
   printf("%.0lf\n",max(1.0,ceil(ans-0.0001));
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:46: error: expected ')' before ';' token
   48 |    printf("%.0lf\n",max(1.0,ceil(ans-0.0001));
      |          ~                                   ^
      |                                              )
Language: C++

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

int main(){
  ll N,K;
  cin>>N>>K;
  vector<ll> A(N);
  for(ll i=0;i<N;i++;)cin>>A.at(i);
  ll left=0;
  ll right=1000000001;
  while(right-left>1){
    ll mid=(right+left)/2;
    ll time=0;
    for(ll i=0;i<N;i++)time+=(A.at(i)-1)/mid;
    if(time>K)left=mid;
    else right=mid;
  }
  cout<<right<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: expected ')' before ';' token
    9 |   for(ll i=0;i<N;i++;)cin>>A.at(i);
      |      ~              ^
      |                     )
a.cc:9:22: error: expected primary-expression before ')' token
    9 |   for(ll i=0;i<N;i++;)cin>>A.at(i);
      |                      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll copy(ll x){return x;}
int main(){
	ll n,k;cin>>n>>k;
	vector<double> a(n);
	for(int i = 0; i < n; i++) {
		cin>>a[i];
	}
	ll r = LINF;
	ll l = -1LL;
	ll out = LINF;
	while(r - l > 1){
		ll m = (r + l)/2;
		ll ans = 0;
		ll res = 0;
		for(int i = 0; i < n; i++) {
			double x = copy(a[i]);
			// cout << x << endl;
			ll cnt = ;
			ll tmp = 0;
			while(ceil(x/cnt) > m){
				cnt++;
			}
			// cout << x << endl;
			// res = max(res,x);
			ans += cnt - 1;
		}
		if(ans <= k){
			// out = min(out,res);
			r = m;
		}
		else{
			l = m;
		}
	}
	cout << r<< endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:34: error: expected primary-expression before ';' token
   34 |                         ll cnt = ;
      |                                  ^
Language: C++

#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 62;
const int INF = 1e9 + 7;

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

    vector<ll> a(n);
    rep(i, n){
        cin >> a[i];
    }
    sort(ALL(a));



    ll l = 0, r = a[n-1];

    while (r >= l) {
        ll mid = l + (r - l) / 2;

        mid = max(1, mid);

        ll cnt = 0;
        rep(i, n)if(a[i] > mid){
            cnt += a[i] / mid;
        }

        if(cnt <= k)r = mid-1;
        else l = mid + 1;
    }
 
    cout << r+1 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:18: error: no matching function for call to 'max(int, ll&)'
   32 |         mid = max(1, mid);
      |               ~~~^~~~~~~~
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:32:18: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   32 |         mid = max(1, mid);
      |               ~~~^~~~~~~~
/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:32:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   32 |         mid = max(1, mid);
      |               ~~~^~~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }
template<class T> bool isIn(T a,vector<T> v){ for(T x:v){ if(a==x){return true;}} return false;}
string strReplace(string s,string target, string replacement){
    if (!target.empty()) {
      std::string::size_type pos = 0;
      while ((pos = s.find(target, pos)) != std::string::npos) {
        s.replace(pos, target.length(), replacement);
        pos += replacement.length();
      }
    }
    return s;
}
const ll MOD = 1e9+7;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MP make_pair
#define pdi pair<ld,int>

bool DEBUG = 0;
template<class T> void dprint(T s){
  if(DEBUG){ cout << s << "\n"; }
}

// 2分探索
// 最大サイズmidを達成できるかどうか

int main(int argc, char *argv[]){
  if(argc>1 && argv[1][0]=='D'){ DEBUG = 1;}
  
  int N,K; cin>>N>>K;
  ld a[N]; CINA(a,N);
  ll ok = 1e18+1;
  ll ng = 0;
  while(abs(ok-ng)>1){
    ll count = 0;
    REP(i,N){
      count += ceil(a[i]/mid)-1;
    }
    if(count<=K){
      ok = mid;
    }else{
      ng = mid;
    }
  }
  cout << ok << "\n";
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:63:26: error: 'mid' was not declared in this scope
   63 |       count += ceil(a[i]/mid)-1;
      |                          ^~~
a.cc:66:12: error: 'mid' was not declared in this scope
   66 |       ok = mid;
      |            ^~~
a.cc:68:12: error: 'mid' was not declared in this scope
   68 |       ng = mid;
      |            ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
typedef long double ld;
const char sp = ' ';

using namespace boost::multiprecision;
using namespace std;

ll A[300000];

ll N, K;

bool can_clear(ll index){
    ll sum=0;
    rep(i, N){
        sum+=max((A[i]-1)/index-1, 0);
        //cout<<A[i]<<sp<<count<<endl;
    }
    return (sum<=K);
}
//条件に合致する最小indexを二分探索 O(logN)
//-2...全indexがみたす -1...条件に合致するものがない
ll nibutan_min(ll min, ll max){
  //評価関数can_clear(ll　value) を指定すること
  ll left=min, right=max;
  ll ans;
  while(true){
      //cout<<left<<" " <<right<<endl; //debug用
      if(left+1==right){
        if(can_clear(left)){
          if(left==min) return -2;
          else return left;
        }
        else{
          if(can_clear(right)) return right;
          else return -1;
        }
        break;
      }
      ll nibutan=(left+right)/2;
      bool can_do_it=can_clear(nibutan);
      if(can_do_it) right = nibutan;
      else left = nibutan;
  }
}


int main(void){
    cin>>N>>K;
    rep(i, N) cin>>A[i];
    cout<<nibutan_min(1, 1000000000)<<endl;
    return 0;
}


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

#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 62;
const int INF = 1e9 + 7;

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

    vector<ll> a(n);
    rep(i, n){
        cin >> a[i];
    }
    sort(ALL(a));

    if(n == 1){
        cout << a[i] / cnt + 1;
        return 0;
    }

    ll l = 0, r = a[n-1];

    while (r >= l) {
        ll mid = l + (r - l) / 2;

        ll cnt = 0;
        rep(i, n)if(a[i] > mid){
            cnt += a[i] / mid;
        }

        if(cnt <= k)r = mid-1;
        else l = mid + 1;

    }
 
    cout << r+1 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:19: error: 'i' was not declared in this scope
   26 |         cout << a[i] / cnt + 1;
      |                   ^
a.cc:26:24: error: 'cnt' was not declared in this scope; did you mean 'int'?
   26 |         cout << a[i] / cnt + 1;
      |                        ^~~
      |                        int
Language: C++

#include<bits/stdc++.h>
#define int long long
#define L 999999
using namespace std;
int n,k,a[L];
bool f(int x) {
	int ret=0;
	for(int i=1; i<=n; i++) {
		ret+=((a[i]/x)-1+(a[i]%x>0));
	}
	return ret<=k;
}
signed main() {
	cin>>n>>k;
	int l=1,r=0;
	for(int i=1; i<=n; i++){
		cin>>a[i];
		r=max(r,a[i]);
	}
	r++;
	int mid;
	while(l+1<r) {
		mid=(l+r)/2;
		if(f(mid))r=mid;
		else l=mid;
	}
	if(check(l))cout<<l<<endl;else cout<<r<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:12: error: 'check' was not declared in this scope
   27 |         if(check(l))cout<<l<<endl;else cout<<r<<endl;
      |            ^~~~~
Language: C++

#include<bits/stdc++.h>
#include<queue>
using namespace std;
 
#define what_is(x) cerr << #x << " is " << x << endl; 
#define PI acos(-1)
#define hell 1000000007
#define HELL 998244353
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fix(n) cout << fixed << setprecision(n)
#define mset(a,n) memset(a,n,sizeof a)
#define rep(i,a,b) for (__typeof((b)) i=(a);i<(b);i++)
#define repp(i,a,b,p) for(__typeof((b)) i=(a);i<(b);i+=p)
#define ren(i,a,b) for(__typeof((a)) i=(a);i>=(b);i--)
#define renn(i,a,b,p) for(__typeof((a) i=(a);i>=(b);i-=p)
#define ADD(a,b,c) ((a)%c+(b)%c)%c
#define SUB(a,b,c) ((a)%c-(b)%c+c)%c
#define MUL(a,b,c) (((a)%c)*((b)%c))%c
#define lbd lower_bound
#define ubd upper_bound
#define ll long long
#define ld long double
#define pb push_back
#define fi first
#define se second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define all(v) (v).begin(), (v).end()
#define sz(x) (ll)x.size()
// #define out(n) cout<<n<<" "
#define outl(n) cout<<n<<endl
#define bug(n) {outl(n);return;}
#define pii pair<int,int>
#define lim 9223372036854775805
#define ninf -9223372036854775802
#define M 10000000009
#define eps 1e-9
#define MAX 10
//#define N 100001
#define db(a) for(auto it:a) {cout<<it<<" ";}cout<<endl;
ll prime[MAX]; 
ll fact[MAX];

const long long INF64 = 1e18;



ll find(vll &a,ll mx){
    ll ans=0;
    rep(i,0,sz(a)){
        ans+=((ll)ceil((1.0*a[i])/(1.0*mx));)
        ans--;
    }
    return ans;
}
void solve(ll ttt){
  ll n,k;
  cin>>n>>k;
  vll a(n);
  rep(i,0,n)
    cin>>a[i];
  ll low=1,high=10000000000;
  if(k==0){
    ll mx=INT_MIN;
    rep(i,0,n){
        mx=max(mx,a[i]);
    }
    cout<<mx<<endl;
    return ;
  }
  while(low<high){
    ll mid=low+(high-low)/2;
    
    ll req_cut=find(a,mid);
    //cout<<"For mid = "<<mid<<" cuts req = "<<req_cut<<endl;
    if(req_cut>k){
        low=mid+1;
    }
    else
        high=mid;
  }
  cout<<(ll)low<<endl;

}
int main(){
    io;
    // sieve();
    // factorial();
#ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
     // freopen("output1.txt","w",stdout);
#endif
    ll t=1;
     //cin>>t;
    fix(12);
    rep(q,1,t+1){
        // cout<<"Case #"<<q<<": ";
         solve(q);
        //solve2();
    }
    return 0;
    
}        




Compiler output:
a.cc: In function 'long long int find(std::vector<long long int>&, long long int)':
a.cc:52:44: error: expected ')' before ';' token
   52 |         ans+=((ll)ceil((1.0*a[i])/(1.0*mx));)
      |              ~                             ^
      |                                            )
a.cc:52:45: error: expected primary-expression before ')' token
   52 |         ans+=((ll)ceil((1.0*a[i])/(1.0*mx));)
      |                                             ^
Language: C++

//header{{{
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/math/common_factor_rt.hpp>
  
using namespace std;
//using namespace boost::multiprecision;  
//using namespace boost::math;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
constexpr int dy[] = {0,-1,0,1,1,-1,-1,1};
//}}}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;

    vector<int> a(n);

    rep(i,n){
        cin >> a[i];
    }

    auto f = [&](auto key){
        int cnt = 0;
        rep(i,n){
            cnt += updiv(a[i] / key) - 1;
        }
        return (cnt);
    };

    int ok = 1e9 + 1, ng = 0;
    
    while(ok - ng > 1){
        auto mid = (ok + ng) / 2;
        if(f(mid) <= k){
            ok = mid;
        }else{
            ng = mid;
        }
    }

    cout << ok << '\n';

    return 0;
}



Compiler output:
a.cc: In instantiation of 'main()::<lambda(auto:28)> [with auto:28 = long int]':
a.cc:62:13:   required from here
   62 |         if(f(mid) <= k){
      |            ~^~~~~
a.cc:53:25: error: too few arguments to function 'int64_t updiv(int64_t, int64_t)'
   53 |             cnt += updiv(a[i] / key) - 1;
      |                    ~~~~~^~~~~~~~~~~~
a.cc:30:12: note: declared here
   30 | inline int updiv(int a,int b){ return (a + b - 1) / b; }
      |            ^~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
typedef long double ld;
const char sp = ' ';

using namespace boost::multiprecision;
using namespace std;

ll A[300000];

ll N, K;

bool can_clear(ll index){
    ll sum=0;
    rep(i, N){
        sum+=max(A[i]-1, 0)/index+1;
        //cout<<A[i]<<sp<<count<<endl;
    }
    return (sum<=K);
}
//条件に合致する最小indexを二分探索 O(logN)
//-2...全indexがみたす -1...条件に合致するものがない
ll nibutan_min(ll min, ll max){
  //評価関数can_clear(ll　value) を指定すること
  ll left=min, right=max;
  ll ans;
  while(true){
      //cout<<left<<" " <<right<<endl; //debug用
      if(left+1==right){
        if(can_clear(left)){
          if(left==min) return -2;
          else return left;
        }
        else{
          if(can_clear(right)) return right;
          else return -1;
        }
        break;
      }
      ll nibutan=(left+right)/2;
      bool can_do_it=can_clear(nibutan);
      if(can_do_it) right = nibutan;
      else left = nibutan;
  }
}


int main(void){
    cin>>N>>K;
    rep(i, N) cin>>A[i];
    cout<<nibutan_min(1, 1000000000)<<endl;
    return 0;
}


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

#include<stdio.h>
#define MAXN 220000
int a[MAXN],n,k;

int read()
{
	int ans=0,p=1;
	char c = getchar();
	while (c<'0'||c>'9')
	{
		if(c=='-')
			p=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		ans = ans*10+c-'0';
		c=getchar();
	}
	return ans*p;
//	int a;
//	scanf("%d",&a);
//	return a;
}

int solve(int m)
{
	int ans=0;
	for(int i = 1; i <= n; i++)
	{
		ans += a[i]/m;
		if(a[i]%m==0)
			ans--;
		if(ans>k)
			return 0;
	}
	return 1;
}

int main()
{
	n=read(),k=read();
	for(int i=1;i<=n;i++)
	{
		a[i]=read();
	}
	if(k==0)
	
	
	int A = 1, B = 2e9;
	while(A < B)
	{
		int mid = (A+B)>>1;
		if(solve(mid) != 1)
		{
			A = mid+1;
		}
		else 
		{
			B = mid;
		}
	}
	printf("%d",B);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:50:9: error: expected expression before 'int'
   50 |         int A = 1, B = 2e9;
      |         ^~~
main.c:51:15: error: 'A' undeclared (first use in this function)
   51 |         while(A < B)
      |               ^
main.c:51:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:51:19: error: 'B' undeclared (first use in this function)
   51 |         while(A < B)
      |                   ^
Language: C++

#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)

// 全てを c 以下にするのに必要な回数
bool is_larger(long long c, long long K, vector<long long>& A)
{
    int N = A.size();
    long long cnt = 0;
    REP(i, N){
        cnt += (A[i]-1)/c;
        if(cnt > K) return true;
    }
    return false;
}

int main()
{
    long long N, K;
    cin >> N >> K;
    vector<long long> A(N);
    REP(i, N) cin >> A[i];

    long long l = 1, r = 1e+9;
    while(l+1 < r){
        long long c = (l+r)/2;
        if(is_larger(c, K, A)) l = c;
        else r = c;
    }
    if(is_larger(l, K, A)) cout << r << endl;
    else cout << l << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: 'cin' was not declared in this scope
   24 |     cin >> N >> K;
      |     ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <cmath>
  +++ |+#include <iostream>
    4 | using namespace std;
a.cc:34:28: error: 'cout' was not declared in this scope
   34 |     if(is_larger(l, K, A)) cout << r << endl;
      |                            ^~~~
a.cc:34:28: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:34:41: error: 'endl' was not declared in this scope
   34 |     if(is_larger(l, K, A)) cout << r << endl;
      |                                         ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include <cmath>
  +++ |+#include <ostream>
    4 | using namespace std;
a.cc:35:10: error: 'cout' was not declared in this scope
   35 |     else cout << l << endl;
      |          ^~~~
a.cc:35:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:35:23: error: 'endl' was not declared in this scope
   35 |     else cout << l << endl;
      |                       ^~~~
a.cc:35:23: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

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



int n, k;
vector<double> a;

bool c(double m){
  int cnt = 0;
  for(int i=0; i<n; i++){
    cnt = cnt + (int)(a[i]/m);
    if(m*(int)(a[i]/m) == a[i]){
      cnt--;
    }
  }
  return cnt > k;
}

int main(){
  cin >> n >> k;
  a.resize(n, 0);
  for(int i=0; i<n; i++)
    cin >> a[i];
  if(k == 0){
    int ans = 0;
    for(int i=0; i<n; i++)
      ans = max(ans, a[i]);
    cout << ans << endl;
    return 0;
  }

  double s = 0, t = 1000000002;
  for(int i=0; i<1000; i++){
    double mid = (s + t) / 2.0;

    if(c(mid))  s = mid;
    else  t = mid;
  }

  int ans = (int)(s + 0.9);

  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:16: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type&)'
   28 |       ans = max(ans, a[i]);
      |             ~~~^~~~~~~~~~~
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:28:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type' {aka 'double'})
   28 |       ans = max(ans, 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:
/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:28:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   28 |       ans = max(ans, a[i]);
      |             ~~~^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define ppb pop_back()
#define fi first
#define se second
#define pi pair<int, int>
#define rep(i, a, n) for(int i = a; i <= n; i++)
#define REP(i, a, n) for(int i = a; i < n; i++)
#define Y "Yes"
#define N "No"
using namespace std;

ll n, k, sum, x[200001], mi, ma;

bool p(ll a) {
	ll cnt = 0;
	REP(i, 0, n) {
		if (x[i] > a) {
			ll y = x[i] - a;
			cnt += __max((y - 1) / a, 0) + 1;
		}
	}
	return cnt <= k;
}

ll search(ll a, ll b) {
	if (b - a <= 1) {
		if (p(a)) return a;
		return b;
	}
	ll m = (a + b) / 2;
	if (p(m)) return search(a, m);
	return search(m, b);
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	//freopen("in.txt", "r", stdin);

	cin >> n >> k >> x[0];
	mi = x[0];
	ma = x[0];
	REP(i, 1, n) {
		cin >> x[i];
		mi = min(mi, x[i]);
		ma = max(ma, x[i]);
	}
	if (k == 0) cout << ma;
	else cout << search(mi / k, ma);
}

Compiler output:
a.cc: In function 'bool p(long long int)':
a.cc:23:32: error: '__max' was not declared in this scope
   23 |                         cnt += __max((y - 1) / a, 0) + 1;
      |                                ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(v)  (v).begin() (v).end()
ll n, k;
bool check(ll x, std::vector<ll> &v)
{
    ll  moves = 0;
    for(auto i : v)
    {
        moves += i / x - (i % x == 0);
    }

    return moves <= k;

}
void solve()
{
    cin >> n >> k;
    std::vector<ll> v(n);
    ll ans = 0, mid, l = 1e9, r = 1e9;

    for(auto &i : v) cin >> i, ans = max(ans, i),l=min(i);
    r = ans + 1;
    while(l <= r)
    {
        mid = l + r >> 1;
        if(check(mid, v))
            ans = mid, r = mid - 1;
        else
            l = mid + 1;

    }
    cout << ans;

}



int main()
{
 

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    // cin >> t;
    for(int i = 0; i < t; i++)
    {
        solve();
    }

}

Compiler output:
a.cc: In function 'void solve()':
a.cc:24:55: error: no matching function for call to 'min(long long int&)'
   24 |     for(auto &i : v) cin >> i, ans = max(ans, i),l=min(i);
      |                                                    ~~~^~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   template argument deduction/substitution failed:
a.cc:24:55: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   24 |     for(auto &i : v) cin >> i, ans = max(ans, i),l=min(i);
      |                                                    ~~~^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const long long INF = 1001001001;
const long long MOD = 1000000007;
const double EPS = 1e-10;

using DI=tuple<double,double,int>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,k;
    cin>>n>>k;
    double a[n];
    priority_queue<DI> pq;
    for(int i=0;i<n;i++){
        cin>>a[i];
        pq.push({a[i],a[i],0});
    }
    while(k--){
        auto t=pq.top(); pq.pop();
        double e=get<0>(t);
        double d=get<1>(t);
        int cnt=get<2>(t);
        double v=d/(double)(cnt+1);
        pq.push({v,d,cnt+1});
    }
    cout<<ceil(pq.top().first)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:25: error: 'const __gnu_cxx::__alloc_traits<std::allocator<std::tuple<double, double, int> >, std::tuple<double, double, int> >::value_type' {aka 'const class std::tuple<double, double, int>'} has no member named 'first'
   31 |     cout<<ceil(pq.top().first)<<endl;
      |                         ^~~~~
Language: C++

#include <bits/stdc++.h>

#define gc( ) std::getchar( )
#define pc( i ) std::putchar( i )
#define RE cout << "Passing [" << __FUNCTION__ << "] on " << __LINE__ << '\n'
#define DEBUG(...) for( auto &i: __VA_ARGS__ ) cout << i << " "; cout << '\n'
#define space ' '
#define enter '\n'
using std::make_pair;

template < typename T >
inline T read( )
{
 T x = 0;
 char ch = gc( );
 bool f = 0;
 while( !std::isdigit( ch ) )
 {
  f = ( ch == '-' );
  ch = gc( );
 }
 while( std::isdigit( ch ) )
 {
  x = x * 10 + ( ch - '0' );
  ch = gc( );
 }
 return f ? -x : x;
}

template < typename T >
void print( T x )
{
 if( x < 0 )
 {
  x = -x;
  pc( '-' );
 }
 if( x < 10 )
 {
  pc( x + 48 );
  return;
 }
 print < T > ( x / 10 );
 pc( x % 10 + 48 );
 return ;
}

namespace Solution
{
#define IOS std::ios::sync_with_stdio( false ), std::cin.tie( 0 ), std::cout.tie( 0 )
#define Rep( i, j, k ) for( int i = j; i >= k; --i )
#define rdi( ) read < int > ( )
#define rdl( ) read < long long > ( )
#define pti( i ) print < int > ( i ), putchar( space )
#define ptl( i ) print < long long > ( i ), putchar( space )
#define For( i, j, k ) for( int i = j; i <= k; ++i )
 using std::cin;
 using std::cout;
 using std::endl;
 using std::vector;
 using std::map;
 using std::queue;
 using std::deque;
 using std::set;
 using std::pair;
 const int N = 204001, mod = 1e9 + 7;
 long long n, k, a[ N ];
 long long check( double v )
 {
  long long P = 0;
  if( v == 0 )
  {
   For( i, 1, n )
    P += a[ i ] * 2;
   return P;
  }
  For( i, 1, n )
  {
   // a[ i ] / v
   P += std::max( ( int ) std::ceil( ( double ) a[ i ] / v ) - 1, 0 )
  }
  return P;
 }
 void Fakemain( )
 {
  IOS;
  cin >> n >> k;
  For( i, 1, n )
   cin >> a[ i ];
  long long L = 0, R = 1e9, ans = -1;
  while( L <= R )
  {
   int mid = L + R >> 1;
   if( check( mid ) <= k )
    ans = mid, R = mid - 1;
   else
    L = mid + 1; 
  }
  cout << ans;
  return;
 }

} // namespace Solution

int main( int argc, char* argv[] )
{
 Solution::Fakemain( );
 return 0;
}

Compiler output:
a.cc: In function 'long long int Solution::check(double)':
a.cc:80:70: error: expected ';' before '}' token
   80 |    P += std::max( ( int ) std::ceil( ( double ) a[ i ] / v ) - 1, 0 )
      |                                                                      ^
      |                                                                      ;
   81 |   }
      |   ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const long long INF = 1001001001;
const long long MOD = 1000000007;
const double EPS = 1e-10;

using DI=tuple<double,double,int>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,k;
    cin>>n>>k;
    double a[n];
    priority_queue<DI> pq;
    for(int i=0;i<n;i++){
        cin>>a[i];
        pq.push({a[i],a[i],0});
    }
    while(k--){
        auto t=pq.top(); pq.pop();
        double e=get<0>(t);
        double d=get<1>(t);
        int cnt=get<2>(t);
        double v=d/(double)(cnt+1);
        pq.push(DI(v,d,cnt+1));
    }
    cout<<ceil(pq.top().first)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:25: error: 'const __gnu_cxx::__alloc_traits<std::allocator<std::tuple<double, double, int> >, std::tuple<double, double, int> >::value_type' {aka 'const class std::tuple<double, double, int>'} has no member named 'first'
   31 |     cout<<ceil(pq.top().first)<<endl;
      |                         ^~~~~