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

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    int N =sc.nextInt();
    long K =sc.nextLong();
    double A[] =new double[N];
    for(int i=0;i<N;i++){
      A[i] =sc.nextDouble();}
    List<Double> B =Arrays.asList(A);
    Collections.sort(B, Collections.reverseOrder());
    for(int i=0;i<K;i++){
      double t = B.get(0);
      t =t/2;
      B.remove(0);
      B.add(t);
      B.add(t);
       Collections.sort(B, Collections.reverseOrder());}
    double m =B.get(0);
    long n =(long)m;
    if(n==m){System.out.println(n);}
    else{System.out.println(n+1);}
  }
}

Compiler output:
Main.java:10: error: incompatible types: inference variable T has incompatible bounds
    List<Double> B =Arrays.asList(A);
                                 ^
    equality constraints: Double
    lower bounds: double[]
  where T is a type-variable:
    T extends Object declared in method <T>asList(T...)
1 error
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    int N =sc.nextInt();
    long K =sc.nextLong();
    double A[] =new double[N];
    for(int i=0;i<N;i++){
      A[i] =sc.nextDouble();}
    List<String> B =Arrays.asList(A);
    Collections.sort(B, Collections.reverseOrder());
    for(int i=0;i<K;i++){
      double t = B.get(0);
      t =t/2;
      B.remove(0);
      B.add(t);
      B.add(t);
       Collections.sort(B, Collections.reverseOrder());}
    double m =B.get(0);
    long n =(long)m;
    if(n==m){System.out.println(n);}
    else{System.out.println(n+1);}
  }
}

Compiler output:
Main.java:10: error: incompatible types: inference variable T has incompatible bounds
    List<String> B =Arrays.asList(A);
                                 ^
    equality constraints: String
    lower bounds: double[]
  where T is a type-variable:
    T extends Object declared in method <T>asList(T...)
Main.java:13: error: incompatible types: String cannot be converted to double
      double t = B.get(0);
                      ^
Main.java:16: error: incompatible types: double cannot be converted to String
      B.add(t);
            ^
Main.java:17: error: incompatible types: double cannot be converted to String
      B.add(t);
            ^
Main.java:19: error: incompatible types: String cannot be converted to double
    double m =B.get(0);
                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
5 errors
Language: C++

#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main(){
  int f = 0, g = 1e9, h = (f+g)/2, n, k; cin >> n >> k;
  v1i v(n); rep(i, n){cin >> v[i]; v[i]--;}
  while(g - f > 0){
    int t = 0;
    rep(i, n) t += v[i] / (h+1);
    if(t <= k){
      d = h+1;
      g = h;
      h = (f+g)/2;
    }
    else{
      f = h+1;
      h = (f+g)/2;
    }
  }
  cout << d << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:7: error: 'd' was not declared in this scope
   37 |       d = h+1;
      |       ^
a.cc:46:11: error: 'd' was not declared in this scope
   46 |   cout << d << endl;
      |           ^
Language: C++

#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main(){
  int n, k; cin >> n >> k;
  priority_queue<int> p;
  rep(i, n){
    int in; cin >> in; p.push(in);
  }
  rep(i, k){
    int tmp = p.pop();
    if(tmp & 1){
      p.push(tmp/2); p.push(tmp/2+1);
    }
    else{
      p.push(tmp/2); p.push(tmp/2);
    }
  }
  cout << p.top() << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:20: error: void value not ignored as it ought to be
   37 |     int tmp = p.pop();
      |               ~~~~~^~
Language: C++

#include <stack>
#include <queue>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <tuple>
#include <cmath>
#include <random>
#include <algorithm>
#include <vector>
#include <iostream>
#include <fstream>
#include <chrono>
#include <numeric>

#define fio ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
#define rng mt19937_64 rnd(chrono::system_clock::now().time_since_epoch().count())

#define ri(...) i64 __VA_ARGS__; rx(__VA_ARGS__)
#define rc(...) char __VA_ARGS__; rx(__VA_ARGS__)
#define rs(...) string __VA_ARGS__; rx(__VA_ARGS__)
#define rvi(x, n) vi x(n); cin >> x
#define rvvi(x, n, m) vvi x(n, vi(m)); cin >> x

#ifndef ONLINE_JUDGE
#define dbg(...) cerr << '[' << #__VA_ARGS__ << "]: "; dbg_log(__VA_ARGS__)
#else
#define dbg(...) ;;
#endif

#define fa(i, v) for (auto &i : v)
#define fi(i, n) for (i32 i = 0; i < n; i++)
#define fp(i, n) for (i32 i = 1; i < n; i++)
#define fr(i, n) for (i32 i = n - 1; i >= 0; i--)
#define fu(i) ri(_i); fi(i, _i)

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

typedef uint32_t u32;
typedef int32_t i32;
typedef uint64_t u64;
typedef int64_t i64;
#ifdef __SIZEOF_INT128__
typedef __uint128_t u128;
typedef __int128_t i128;
#endif
typedef vector<i64> vi;
typedef vector<vi> vvi;

template<typename T>
inline istream &operator>>(istream &in, vector<T> &v) {
    fa(x, v) in >> x;
    return in;
}

template<typename T>
inline ostream &operator<<(ostream &out, const vector<T> &v) {
    fa(x, v) out << x << ' ';
    return out;
}

template<typename T>
inline void rx(T &x) {
    cin >> x;
}

template<typename T, typename... R>
inline void rx(T &x, R &... l) {
    cin >> x;
    rx(l...);
}

template<typename T>
inline void dbg_log(const T &x) {
    cerr << x << '\n';
}

template<typename T, typename... R>
inline void dbg_log(const T &x, const R &... l) {
    cerr << x << ", ";
    dbg_log(l...);
}

template<typename T>
inline void wl(const T &x) {
    cout << x << '\n';
}

template<typename T, typename... R>
inline void wl(const T &x, const R &... l) {
    cout << x << ' ';
    wl<R...>(l...);
}

int main() {
    fio;

    ri(n, k);
    rvi(a, n);
    double i = 0;
    double j = 1e9 + 1;
    fi(t, 100) {
        double m = (i + j) / 2;
        i32 r = 0;
        fa(x, a) {
            r += floor(x / m);
        }
        if (r > k) {
            i = m;
        } else {
            j = m;
        }
    }
    wl((u64) ceil(i - 1e-10));

    return 0;
}
vvvvvvvvvvvvvvvvvvvvvvvv

Compiler output:
a.cc:123:1: error: 'vvvvvvvvvvvvvvvvvvvvvvvv' does not name a type
  123 | vvvvvvvvvvvvvvvvvvvvvvvv
      | ^~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int fun(long long int mid,long long int k,vector<long long int>&arr)
{
    long long int ans=0;
    for( int i=0;i<arr.size();i++)
    {
        ans+=arr[i]/mid;
    }
    if(ans>=k)
    return 1;
    return 0;
}
int main()
{
  long long int n,k;
  cin>>n>>k;
  vector< int>arr(n);
  for( int i=0;i<n;i++)
  cin>>arr[i];
  long long int mn=0;
 long long  int mx=1000000007;
  while(mn<=mx)
  {
      long long int mid=(mn+mx)/2;
      if(fun(mid,k,arr))
      mn=mid+1;
      else 
      mx=mid-1;

  }
  if(fun(mn,k,arr))
  cout<<mn;
  else
  cout<<mn-1;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:20: error: invalid initialization of reference of type 'std::vector<long long int>&' from expression of type 'std::vector<int>'
   26 |       if(fun(mid,k,arr))
      |                    ^~~
a.cc:3:65: note: in passing argument 3 of 'int fun(long long int, long long int, std::vector<long long int>&)'
    3 | int fun(long long int mid,long long int k,vector<long long int>&arr)
      |                                           ~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:32:15: error: invalid initialization of reference of type 'std::vector<long long int>&' from expression of type 'std::vector<int>'
   32 |   if(fun(mn,k,arr))
      |               ^~~
a.cc:3:65: note: in passing argument 3 of 'int fun(long long int, long long int, std::vector<long long int>&)'
    3 | int fun(long long int mid,long long int k,vector<long long int>&arr)
      |                                           ~~~~~~~~~~~~~~~~~~~~~~^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int fun(long long int mid,long long int k,vector<long long int>&arr,long long int n)
{
    long long int ans=0;
    for(long long int i=0;i<n;i++)
    {
        ans+=arr[i]/mid;
    }
    if(ans>=k)
    return 1;
    return 0;
}
int main()
{
  long long int n,k;
  cin>>n>>k;
  vector<long long int>arr(n);
  for(long long int i=0;i<n;i++)
  cin>>arr[i];
  long long int mn=0;
 long long  int mx=1000000007;
  while(mn<=mx)
  {
      long long int mid=(mn+mx)/2;
      if(fun(mid,k,arr,n))
      mn=mid+1;
      else 
      mx=mid-1;

  }
  if(fun(mn,k,arr))
  cout<<mn;
  else
  cout<<mn-1;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:9: error: too few arguments to function 'int fun(long long int, long long int, std::vector<long long int>&, long long int)'
   32 |   if(fun(mn,k,arr))
      |      ~~~^~~~~~~~~~
a.cc:3:5: note: declared here
    3 | int fun(long long int mid,long long int k,vector<long long int>&arr,long long int n)
      |     ^~~
Language: C++

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

signed main(){
  int n,k;cin>>n>>k;
  vector<int>v(n);
  for(int i=0;i<n;i++)cin>>v[i];
  int l=0,r=1e9+1;
  while(r-l>1){
    int mid=(r+l)>>1,cnt=0;
    for(int i=0;i<n;i++)cnt+=(v[i]-1)/mid;
    (cnt<=K?r:l)=mid;
  }
  cout<<r<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: 'K' was not declared in this scope
   12 |     (cnt<=K?r:l)=mid;
      |           ^
Language: C

n,k=map(int,input().split())
a=list(map(int,input().split()))
l,r=max(a),0
while l-r>1:
    t=(l+r)//2
    c=0
    for i in a:
        c+=i//t
    if c>k:
        r=t
    else:
        l=t
print(l)

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | n,k=map(int,input().split())
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'k' [-Wimplicit-int]
    1 | n,k=map(int,input().split())
      |   ^
main.c:1:5: error: implicit declaration of function 'map' [-Wimplicit-function-declaration]
    1 | n,k=map(int,input().split())
      |     ^~~
main.c:1:9: error: expected expression before 'int'
    1 | n,k=map(int,input().split())
      |         ^~~
main.c:2:1: error: expected ',' or ';' before 'a'
    2 | a=list(map(int,input().split()))
      | ^
Language: C++

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

#define ll long long 

#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif

template <typename Arg1>
void __f(const char* name, Arg1&& arg1)
{
	cerr << name << ": " << arg1 << endl;
}

template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << ": " << arg1 << " |";
	__f(comma + 1, args...);
}

const int N = 2e6+1;

ll int a[N] = {0};

int main()
{
	ios_base::sync_with_stdio(nullptr);
	cin.tie(nullptr);
	cout.tie(nullptr);
	
	ll int n, k, r;
	cin >> n >> k;
	
	for(int i = 1; i <= n; ++i)
	{
		cin >> a[i];
		r = max(r, a[i]);
	}
	ll int l = 1, total ;
	while(r != l)
	{
		ll int mid;
		mid = (r + l)/2;
		ll cnt = 0;
		for(int i = 1; i<=n; ++i)
			cnt += (a[i] - 1) /mid;
			
	
		
		if(cnt <= k) r = mid;
		else l = mid + 1;
		
		
//		trace(r, mid, cnt, l);
	}
	cout << l << "\n";
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:35: error: converting to 'bool' from 'std::nullptr_t' requires direct-initialization [-fpermissive]
   33 |         ios_base::sync_with_stdio(nullptr);
      |                                   ^~~~~~~
In file included from /usr/include/c++/14/streambuf:43,
                 from /usr/include/c++/14/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54,
                 from a.cc:1:
/usr/include/c++/14/bits/ios_base.h:803:26: note:   initializing argument 1 of 'static bool std::ios_base::sync_with_stdio(bool)'
  803 |     sync_with_stdio(bool __sync = true);
      |                     ~~~~~^~~~~~~~~~~~~
Language: C++

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

#define ll long long 

#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif

template <typename Arg1>
void __f(const char* name, Arg1&& arg1)
{
	cerr << name << ": " << arg1 << endl;
}

template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << ": " << arg1 << " |";
	__f(comma + 1, args...);
}

const int N = 1e6+1;

ll int a[N] = {0};

int main()
{
	ios_base::sync_with_stdio(nullptr);
	cin.tie(nullptr);
	cout.tie(nullptr);
	
	ll int n, k, r;
	cin >> n >> k;
	
	for(int i = 1; i <= n; ++i)
	{
		cin >> a[i];
		r = max(r, a[i]);
	}
	ll int l = 1, total ;
	while(r != l)
	{
		ll int mid;
		mid = (r + l)/2;
		ll cnt = 0;
		for(int i = 1; i<=n; ++i)
		{
			cnt += (a[i] - 1) /mid;
			
		}
		
		if(cnt <= k)
		{
			r = mid;
		}
		else
		{
			l = mid + 1;
		}
		
//		trace(r, mid, cnt, l);
	}
	cout << l << "\n";
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:35: error: converting to 'bool' from 'std::nullptr_t' requires direct-initialization [-fpermissive]
   33 |         ios_base::sync_with_stdio(nullptr);
      |                                   ^~~~~~~
In file included from /usr/include/c++/14/streambuf:43,
                 from /usr/include/c++/14/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54,
                 from a.cc:1:
/usr/include/c++/14/bits/ios_base.h:803:26: note:   initializing argument 1 of 'static bool std::ios_base::sync_with_stdio(bool)'
  803 |     sync_with_stdio(bool __sync = true);
      |                     ~~~~~^~~~~~~~~~~~~
Language: C++

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

#define ll long long 

#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif

template <typename Arg1>
void __f(const char* name, Arg1&& arg1)
{
	cerr << name << ": " << arg1 << endl;
}

template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << ": " << arg1 << " |";
	__f(comma + 1, args...);
}

const int N = 1e6+1;

ll int a[N] = {0};

int main()
{
	ios_base::sync_with_stdio(nullptr);
	cin.tie(nullptr);
	cout.tie(nullptr);
	
	ll int n, k, r;
	cin >> n >> k;
	
	for(int i = 1; i <= n; ++i)
	{
		cin >> a[i];
		r = max(r, a[i]);
	}
	ll int l = 1, total ;
	while(r != l)
	{
		ll int mid;
		mid = (r + l)/2;
		ll cnt = 0;
		for(int i = 1; i<=n; ++i)
		{
			cnt += (a[i] - 1) /mid;
			
		}
		
		if(cnt <= k)
		{
			r = mid;
		}
		else
		{
			l = mid + 1;
		}
		
//		trace(r, mid, cnt, l);
	}
	cout << r << "\n";
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:35: error: converting to 'bool' from 'std::nullptr_t' requires direct-initialization [-fpermissive]
   33 |         ios_base::sync_with_stdio(nullptr);
      |                                   ^~~~~~~
In file included from /usr/include/c++/14/streambuf:43,
                 from /usr/include/c++/14/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54,
                 from a.cc:1:
/usr/include/c++/14/bits/ios_base.h:803:26: note:   initializing argument 1 of 'static bool std::ios_base::sync_with_stdio(bool)'
  803 |     sync_with_stdio(bool __sync = true);
      |                     ~~~~~^~~~~~~~~~~~~
Language: C++

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

#define ll long long 

#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif

template <typename Arg1>
void __f(const char* name, Arg1&& arg1)
{
	cerr << name << ": " << arg1 << endl;
}

template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << ": " << arg1 << " |";
	__f(comma + 1, args...);
}

const int N = 1e6+1;

ll int a[N] = {0};

int main()
{
	ios_base::sync_with_stdio(nullptr);
	cin.tie(nullptr);
	cout.tie(nullptr);
	
	ll int n, k, r;
	cin >> n >> k;
	
	for(int i = 1; i <= n; ++i)
	{
		cin >> a[i];
		r = max(r, a[i]);
	}
	ll int l = 1, total ;
	while(r != l)
	{
		ll int mid;
		mid = (r + l)/2;
		ll cnt = 0;
		for(int i = 1; i<=n; ++i)
		{
			cnt += (a[i] - 1) /mid;
			
		}
		
		if(cnt <= k)
		{
			r = mid;
		}
		else
		{
			l = mid + 1;
		}
		
//		trace(r, mid, cnt, l);
	}
	
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:35: error: converting to 'bool' from 'std::nullptr_t' requires direct-initialization [-fpermissive]
   33 |         ios_base::sync_with_stdio(nullptr);
      |                                   ^~~~~~~
In file included from /usr/include/c++/14/streambuf:43,
                 from /usr/include/c++/14/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54,
                 from a.cc:1:
/usr/include/c++/14/bits/ios_base.h:803:26: note:   initializing argument 1 of 'static bool std::ios_base::sync_with_stdio(bool)'
  803 |     sync_with_stdio(bool __sync = true);
      |                     ~~~~~^~~~~~~~~~~~~
Language: C++

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

#define ll long long 

#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif

template <typename Arg1>
void __f(const char* name, Arg1&& arg1)
{
	cerr << name << ": " << arg1 << endl;
}

template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << ": " << arg1 << " |";
	__f(comma + 1, args...);
}

const int N = 1e6+1;

ll int a[N] = {0};

int main()
{
	ios_base::sync_with_stdio(nullptr);
	cin.tie(nullptr);
	cout.tie(nullptr);
	
	ll int n, k, r;
	cin >> n >> k;
	
	for(int i = 1; i <= n; ++i)
	{
		cin >> a[i];
		r = max(r, a[i]);
	}
	ll int l = 1, total ;
	while(r != l)
	{
		ll int mid;
		mid = (r + l)/2;
		ll cnt = 0;
		for(int i = 1; i<=n; ++i)
		{
			cnt += (a[i] - 1) /mid;
			
		}
		
		if(cnt <= k)
		{
			r = mid;
		}
		else
		{
			l = mid + 1;
		}
		
		trace(r, mid, cnt, l);
	}
	
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:35: error: converting to 'bool' from 'std::nullptr_t' requires direct-initialization [-fpermissive]
   33 |         ios_base::sync_with_stdio(nullptr);
      |                                   ^~~~~~~
In file included from /usr/include/c++/14/streambuf:43,
                 from /usr/include/c++/14/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54,
                 from a.cc:1:
/usr/include/c++/14/bits/ios_base.h:803:26: note:   initializing argument 1 of 'static bool std::ios_base::sync_with_stdio(bool)'
  803 |     sync_with_stdio(bool __sync = true);
      |                     ~~~~~^~~~~~~~~~~~~
Language: C++

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i]--;
  }
  int l = 0, r = 1001001001;
  while (r - l > 1) {
    int c = (l + r) / 2;
    auto ok = [&] {
      long long cnt = 0;
      for (int i = 0; i < n; i++) cnt += a[i] / c;
      return cnt <= k;
    };
    (ok(c) ? r : l) = c;
  }
  cout << r << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:8: error: no match for call to '(main()::<lambda()>) (int&)'
   20 |     (ok(c) ? r : l) = c;
      |      ~~^~~
a.cc:15:15: note: candidate: 'main()::<lambda()>'
   15 |     auto ok = [&] {
      |               ^
a.cc:15:15: note:   candidate expects 0 arguments, 1 provided
Language: C++

#include<stdio.h>
using namespace std;
int main(){
  int n,d;
  cin>>n>>d;
  int x[n],y[n];
  for(int i=0;i<n;i++)
  {
    cin>>x[i]>>y[i];
  }
  int c=0;
  for(int i=0;i<n;i++)
  {
    if(sqrt((x[i]*x[i])+(y[i]*y[i]))<=d){
      c++;}
    cout<<c;}]
      

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   cin>>n>>d;
      |   ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<stdio.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:14:8: error: 'sqrt' was not declared in this scope
   14 |     if(sqrt((x[i]*x[i])+(y[i]*y[i]))<=d){
      |        ^~~~
a.cc:16:5: error: 'cout' was not declared in this scope
   16 |     cout<<c;}]
      |     ^~~~
a.cc:16:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:16:14: error: expected primary-expression before ']' token
   16 |     cout<<c;}]
      |              ^
a.cc:16:15: error: expected '}' at end of input
   16 |     cout<<c;}]
      |               ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
ll n,k;
bool is_able_to_cut(ll x,vector<ll> a){
    ll total = 0;
    if(x == 0){
        return true;
    }
    REP(i,a.size()){
        total+=(a[i]-1)/x;
    }
    return k >= total;
}

ll BinarySearch(vector<ll>a){
    ll ng=0,ok = 1000000000;
    while(llabs(ok-ng) > 1){
        ll mid = (ng+ok)/2;
        if(is_able_to_cut(mid,a)){
            ok = mid;a
        }else{
            ng = mid;
        }
    }

    return ok;
}

int main(){
    cin >> n >> k;
    vector<ll>a(n);
    REP(i,n)cin >> a[i];
    if(k==0){
        SORT(a);
        reverse(ALL(a));
        cout << a[0] << endl;
        return 0;
    }
    cout << BinarySearch(a) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'll BinarySearch(std::vector<long long int>)':
a.cc:34:23: error: expected ';' before '}' token
   34 |             ok = mid;a
      |                       ^
      |                       ;
   35 |         }else{
      |         ~
Language: Java

from sys import stdin
rs = stdin.readline
ri = lambda : int(rs())
ril = lambda : list(map(int, rs().split()))

def main():
    N, K = ril()
    A = ril()
    l = 1
    r = 1000000000
    while l < r:
        m = (l + r) // 2
        k = 0
        for a in A:
            k += (a - 1) // m
        if k <= K:
            r = m
        else:
            l = m + 1
    print(r)

if __name__ == '__main__':
    main()


Compiler output:
Main.java:1: error: class, interface, enum, or record expected
from sys import stdin
^
Main.java:22: error: unclosed character literal
if __name__ == '__main__':
               ^
Main.java:22: error: unclosed character literal
if __name__ == '__main__':
                        ^
3 errors
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
 
typedef long long ll;
typedef vector<int> vi;
typedef unsigned long ul;
typedef vector<ll> vl;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef set<int> si;
typedef multiset<int> mi;
 
const ll INF = 1e18;
const int MOD = 1e9+7;

int n,k;
vi a;

bool valid(int mx) {

	int cnt=0;

	for(int i=0; i<n && cnt<=n+k; ++i) {
		cnt+=ceil(a[i]/double(mx));
	}

	return cnt<=n+k;

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

	cin>>n>>k;
	int mx=INT_MIN;
	a.resize(n);
	for(int&q : a) cin>>q, mx=max(mn, q);

	if(k==0) {
		cout<<mx<<"\n";
		return 0;
	}

	int ans=1;
	
	for(int k=mx; k>=1; k/=2)
		while(!valid(ans+k))
			ans+=k;

	cout<<ans+1<<"\n";

	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:47:39: error: 'mn' was not declared in this scope; did you mean 'mx'?
   47 |         for(int&q : a) cin>>q, mx=max(mn, q);
      |                                       ^~
      |                                       mx
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
 
typedef long long ll;
typedef vector<int> vi;
typedef unsigned long ul;
typedef vector<ll> vl;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef set<int> si;
typedef multiset<int> mi;
 
const ll INF = 1e18;
const int MOD = 1e9+7;

int n,k;
vi a;

bool valid(int mx) {

	int cnt=0;

	for(int i=0; i<n && cnt<=n+k; ++i) {
		cnt+=ceil(a[i]/double(mx));
	}

	return cnt<=n+k;

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

	cin>>n>>k;
	int mn=INT_MIN;
	a.resize(n);
	for(int&q : a) cin>>q, mx=max(mn, q);

	if(k==0) {
		cout<<mx<<"\n";
		return 0;
	}

	int ans=1;
	
	for(int k=mx; k>=1; k/=2)
		while(!valid(ans+k))
			ans+=k;

	cout<<ans+1<<"\n";

	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:47:32: error: 'mx' was not declared in this scope; did you mean 'mn'?
   47 |         for(int&q : a) cin>>q, mx=max(mn, q);
      |                                ^~
      |                                mn
a.cc:50:23: error: 'mx' was not declared in this scope; did you mean 'mn'?
   50 |                 cout<<mx<<"\n";
      |                       ^~
      |                       mn
a.cc:56:19: error: 'mx' was not declared in this scope; did you mean 'mn'?
   56 |         for(int k=mx; k>=1; k/=2)
      |                   ^~
      |                   mn
Language: C++

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

const int MOD = 1000000007;
const int INF = 1e9;

int main(){
  int n,k;
  const int max_n = 2 * 1e5;
  int a[max_n + 1];
  cin >> n >> k;
  int max_a = 0;
  for(int i = 0; i < n; i++) {
    cin >> a[i];
    max_a = max(max_a, a[i]);
  }
  int left = 0;
  int right = max_a;
  int sum = 0;
  while(right - left > 1){
    sum = 0;
    x = (right + left) / 2;
    for(int i = 0; i < n; i++){
      if(a[i] == x) sum += a[i] / x - 1;
      else sum += a[i] / x;
    }
    // cout << "x= " << x << ", sum = " << sum << endl;
    if(sum <= k) right = x;
    else left = x;
    // if(right - left <= 1) break;
  }

  cout << right << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: 'x' was not declared in this scope
   22 |     x = (right + left) / 2;
      |     ^
Language: C++

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

int main() {
   int n, k;
   cin >> n >> k ;
   vi a(n);
   rep(i, n) cin >> a.at(i);
   //二分探索
   int l = 0, r = 1e9;
   while(r-l > 1) {
       int x = (l+r)/2;
       auto f = [&](int x) {
           ll now = 0;
           //丸太を切る回数を求める
           rep(i, n) now += (a.at(i)-1)/x;
           return now <= k;
       };
       if (f(x)) r = x; else l = x;
   }
   cout << r << endl;
   return 0;
}

Compiler output:
a.cc:1:26: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                          ^
a.cc: In function 'int main()':
a.cc:10:8: error: 'i' was not declared in this scope
   10 |    rep(i, n) cin >> a.at(i);
      |        ^
a.cc:10:4: error: 'rep' was not declared in this scope
   10 |    rep(i, n) cin >> a.at(i);
      |    ^~~
Language: C++

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

int N, K;
vector<int> A;

bool judge(int t) {

    int cnt = 0;
    for(int i = 0; i < N; i++) {
        cnt += A.at(i) / t;
        if(A.at(i) % t == 0) {
            cnt--;
        }
    }

    if(cnt <= K) {
        return true;
    } else {
        return false;
    }
}

int binary_search(int ng, int ok) {

    int mid;
    while(abs(ok - ng) != 1) {
        mid = (ok + ng) / 2;
        if(judge(A, mid)) {
            ok = mid;
        } else {
            ng = mid;
        }
    }

    return ok;
}

int main() {

    cin >> N >> K;
    vector<int> A(N);

    for(int i = 0; i < N; i++) {
        cin >> A.at(i);
    }

    int ans;
    ans = binary_search(A, 0, 1000000000);
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int binary_search(int, int)':
a.cc:29:18: error: cannot convert 'std::vector<int>' to 'int'
   29 |         if(judge(A, mid)) {
      |                  ^
      |                  |
      |                  std::vector<int>
a.cc:7:16: note:   initializing argument 1 of 'bool judge(int)'
    7 | bool judge(int t) {
      |            ~~~~^
a.cc: In function 'int main()':
a.cc:49:24: error: no matching function for call to 'binary_search(std::vector<int>&, int, int)'
   49 |     ans = binary_search(A, 0, 1000000000);
      |           ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate: 'template<class _FIter, class _Tp> bool std::binary_search(_FIter, _FIter, const _Tp&)'
 2194 |     binary_search(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2194:5: note:   template argument deduction/substitution failed:
a.cc:49:24: note:   deduced conflicting types for parameter '_FIter' ('std::vector<int>' and 'int')
   49 |     ans = binary_search(A, 0, 1000000000);
      |           ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2228:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> bool std::binary_search(_FIter, _FIter, const _Tp&, _Compare)'
 2228 |     binary_search(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2228:5: note:   candidate expects 4 arguments, 3 provided
a.cc:24:5: note: candidate: 'int binary_search(int, int)'
   24 | int binary_search(int ng, int ok) {
      |     ^~~~~~~~~~~~~
a.cc:24:5: note:   candidate expects 2 arguments, 3 provided
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int n; 
ll k; 
int get_center(int int_lower, int int_upper){
    return int_lower+(int_upper-int_lower)/2;
}

bool can_cut(ll A[], ll X){
    ll count = 0;
    for(int i=0; i<n; i++) count += (A[i]-1)/X;
    if(count <= k){
        return true;
    }else{
        return false;
    }
}

int main(){
    cin >> n >> k;
    ll a[n]; 
    ll max_a = 0;
    for(int i=0; i<n; i++){
        cin >> a[i];
        max_a = max(max_a, a[i]);
    }
    ll lower = 0;
    ll upper = max_a;
    while(ok-ng>1){
        ll x = (lower+upper)/2;
        bool bool_can_cut = can_cut(a, x);
        if(bool_can_cut){
            upper = x;
        }else{
            lower = x;
        }
    }

    cout << upper << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:11: error: 'ok' was not declared in this scope; did you mean 'k'?
   31 |     while(ok-ng>1){
      |           ^~
      |           k
a.cc:31:14: error: 'ng' was not declared in this scope; did you mean 'n'?
   31 |     while(ok-ng>1){
      |              ^~
      |              n
Language: C++

#include<iostream>
#include<cmath>
#include<vector>
#include<fstream>
#include<iomanip>
using namespace std;

///////////////////////////////////////////////////////////
//
// int 二分探索のテンプレートに使っていいよ
//
///////////////////////////////////////////////////////////


int main(){
    long long N, K, A;
    long long ans = 0;
    long long champ = 0;
    double ok, ng, mid;
    long long tmp;
     std::cin >> N >> K;
    // ifstream ifs("./handmade11");
    // ifs >> N >> K;
    vector<long long> A_list(N);
    for(long long i = 0; i < N; i++){
        std::cin >> A;
        // ifs >> A;
        A_list[i] =  A;
        if(A > champ){
            champ = A;
        }
    }
    ifs.close();


    //ここから二分探索
    ng = 0;
    ok = champ;

    while(ok - ng > 0.01){
        mid = (ok + ng)/2.0;
        // std::cout << std::setprecision(20) << ng << " " << ok << "\n";
        tmp = 0;
        for(long long i = 0; i < A_list.size(); i++){
            tmp = tmp + ceil(A_list[i]/mid) - 1;
        }
        if(tmp <= K){
            ok = mid;
        }else{
            ng = mid;
        }
    }
        
    ans = (long long)round(ceil(ok));
    tmp = 0;
    for(long long i = 0; i < A_list.size(); i++){
            tmp = tmp + ceil(A_list[i]/(ans-1)) - 1;
    }
    if(tmp <= K){
        ans = ans - 1;
    }
    std::cout << ans;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:5: error: 'ifs' was not declared in this scope
   33 |     ifs.close();
      |     ^~~
Language: C++

#include <iostream>
#include<vector>
#include <algorithm>
using namespace std;
vector<long> a;
long n,k;

bool ok(long n){
      long sum = 0;
      for(int i = 0;i < a.size();i++){
            sum += a[i] / n;
      }
      return sum <= k;
}
int main(void){
    cin >> n >> k;
    a.resize(n);
    int bot = 0;
    int top = 0;
    for(int i = 0;i < n;i++){
          cin >> a[i];
          top = max(top,a[i]);
    }
    
    while(top - bot > 1){
          int mid = (top + bot) / 2;
          if(ok(mid)){
                top = mid;
          }else{
                bot = mid;
          }
    }
    
    cout << top << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:20: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type&)'
   22 |           top = max(top,a[i]);
      |                 ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:20: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'})
   22 |           top = max(top,a[i]);
      |                 ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/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:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   22 |           top = max(top,a[i]);
      |                 ~~~^~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using ll = long long;

signed main(){
  int n, K; std::cin >> n >> K;
  std::vector<int> a(n);
  for(int i = 0; i < n; i++) std::cin >> a[i];
  int low = 0, high = 1e9+1;
  while(high - low > 1){
    int mid = (high + low) / 2;
    int cnt = 0;
    for(int i = 0; i < n; i++){
      cnt += a[i] / mid;
    }
    if(cnt <= K) high = mid;
    else low = mid;
  }
  std::cout <<　high << std::endl;
}

Compiler output:
a.cc:18:15: error: extended character 　 is not valid in an identifier
   18 |   std::cout <<　high << std::endl;
      |               ^
a.cc: In function 'int main()':
a.cc:18:15: error: '\U00003000high' was not declared in this scope; did you mean 'high'?
   18 |   std::cout <<　high << std::endl;
      |               ^~~~~~
      |               high
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(){
  	long long N, K;
  	cin >> N >> K;
  	vector<long long> A(N);
  	long long max = *max_element(A.begin(), A.end()), min = 0;;
  	while (1){
      	long long X = (max + min)/2;
      	if(X == min) break;
      	long long Xreal = 0;
      	for(int i=0;i<N;i++) Xreal += (A[i]+X-1)/X -1;
      	if(Xreal < X) max = X;
        else min = X;      	
    }
  	cout << max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:26: error: 'max_element' was not declared in this scope
   10 |         long long max = *max_element(A.begin(), A.end()), min = 0;;
      |                          ^~~~~~~~~~~
a.cc:12:28: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator+'
   12 |         long long X = (max + min)/2;
      |                        ~~~~^~~~~
a.cc:13:14: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator=='
   13 |         if(X == min) break;
      |            ~~^~~~~~
a.cc:17:20: error: overloaded function with no contextual type information
   17 |         else min = X;
      |                    ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,k;
  int ar[1000000];
bool check(int x )
{
  int sum =0;
  for(int i=0;i<n;i++)
  {
sum+=(ar[i]-1)/x
  }
  if(sum<=k)
    return true;
  return false;
}
int main()
{
  
  cin>>n>>k;

  int longest=-1;//save length of longets log
  for(int i=0;i<n;i++)
  {//finding longest log
    cin>>ar[i];
    longest=max(longest, ar[i]);
    }
  //now we know longest log and our ans depends on it
  // we  find now how to cut the longest log to cut ans 
  // obvious max we can get if we divide it in 2 halfves 
  // but taking care of thye total cuts to make its length is tend 
  // decrease or increase to satisfy the given condition
  
   int l=1,r=longest;
    //cout<<"start l val : "<<l<<",  r value : "<<r;
    while(l<r) {
        int mid=(l+r)/2;
        if(check(mid))
        {r=mid;
       // cout<<"l value :  "<<l<<", r value  : "<<r<<endl;
        }
 
        else 
        {l=mid+1;
     //   cout<<" check mid false l value : "<<l<<", r value  : "<<r<<endl;
        }
    }
  cout<<l;
  
  
  
}


Compiler output:
a.cc: In function 'bool check(int)':
a.cc:10:17: error: expected ';' before '}' token
   10 | sum+=(ar[i]-1)/x
      |                 ^
      |                 ;
   11 |   }
      |   ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,k;
bool check(int x, int ar[100000] )
{
  int sum =0;
  for(int i=0;i<n;i++)
  {
sum+=(ar[i]-1)/x
  }
  if(sum<=k)
    return true;
  return false;
}
int main()
{
  
  cin>>n>>k;
  int ar[n];
  int longest=-1;//save length of longets log
  for(int i=0;i<n;i++)
  {//finding longest log
    cin>>ar[i];
    longest=max(longest, ar[i]);
    }
  //now we know longest log and our ans depends on it
  // we  find now how to cut the longest log to cut ans 
  // obvious max we can get if we divide it in 2 halfves 
  // but taking care of thye total cuts to make its length is tend 
  // decrease or increase to satisfy the given condition
  
   int l=1,r=longest;
    //cout<<"start l val : "<<l<<",  r value : "<<r;
    while(l<r) {
        int mid=(l+r)/2;
        if(check(mid))
        {r=mid;
       // cout<<"l value :  "<<l<<", r value  : "<<r<<endl;
        }
 
        else 
        {l=mid+1;
     //   cout<<" check mid false l value : "<<l<<", r value  : "<<r<<endl;
        }
    }
  cout<<l;
  
  
  
}


Compiler output:
a.cc: In function 'bool check(int, int*)':
a.cc:9:17: error: expected ';' before '}' token
    9 | sum+=(ar[i]-1)/x
      |                 ^
      |                 ;
   10 |   }
      |   ~              
a.cc: In function 'int main()':
a.cc:36:17: error: too few arguments to function 'bool check(int, int*)'
   36 |         if(check(mid))
      |            ~~~~~^~~~~
a.cc:4:6: note: declared here
    4 | bool check(int x, int ar[100000] )
      |      ^~~~~
Language: C

#include <stdio.h>
#define max(a, b) ((a) > (b) ? (a) : (b))

int n, k;
int a[200010];
char check(const int n);

int main() {
	scanf("%d%d", &n, &k);
	int maxv = 0;
	long long sum = 0;
	for (int i = 0; i < n; ++i) {
		scanf("%d", &a[i]);
		sum += a[i], maxv = max(maxv, a[i]);
	}
	
	int l = (sum + n + k - 1) / (n + k), r = maxv;
	while (l < r) {
		int m = l + r >> 1;
		if (check(m))
			r = m;
		else
			l = m + 1;
	}
	assert(l == r);
	assert(check(l));
	assert(!check(l - 1));
	printf("%d\n", l);
	return 0;
}

char check(const int m) {
	int sum = 0;
	for (int i = 0; i < n; ++i)
		sum += 2 * a[i] / (2 * m + 1) + 1;
	return sum <= n + k;
}



Compiler output:
main.c: In function 'main':
main.c:25:9: error: implicit declaration of function 'assert' [-Wimplicit-function-declaration]
   25 |         assert(l == r);
      |         ^~~~~~
main.c:2:1: note: 'assert' is defined in header '<assert.h>'; this is probably fixable by adding '#include <assert.h>'
    1 | #include <stdio.h>
  +++ |+#include <assert.h>
    2 | #define max(a, b) ((a) > (b) ? (a) : (b))
Language: C++

#include <iostream>
#include <vector>
 
using namespace std;
 
bool check(vector <int> as, int len, int k) {
  for (const auto& a : as) {
    int num = (long double)a / (long double) len - 1;
    if (int(num) > k) return false;
  }
  return true;
}
 
int main() {
  int n, k; cin >> n >> k;
  vector <int> as(n,0);
  for (int i = 0; i < n; i++) cin >> as[i];
  int left = 0;
  int right = 1 << 9;
  while (left < right) {
    int center = (left + right) / 2;
    if (check(as, center, k)) left = center;
    else right = center;
  }
  cout << left << endl;
}
#include <iostream>
#include <vector>
 
using namespace std;
 
bool check(vector <int> as, int len, int k) {
  for (const auto& a : as) {
    int num = (long double)a / (long double) len - 1;
    if (int(num) > k) return false;
  }
  return true;
}
 
int main() {
  int n, k; cin >> n >> k;
  vector <int> as(n,0);
  for (int i = 0; i < n; i++) cin >> as[i];
  int left = 0;
  int right = 1 << 9;
  while (left < right) {
    int center = (left + right) / 2;
    if (check(as, center, k)) right = center;
    else left = center;
  }
  cout << left << endl;
}

Compiler output:
a.cc:32:6: error: redefinition of 'bool check(std::vector<int>, int, int)'
   32 | bool check(vector <int> as, int len, int k) {
      |      ^~~~~
a.cc:6:6: note: 'bool check(std::vector<int>, int, int)' previously defined here
    6 | bool check(vector <int> as, int len, int k) {
      |      ^~~~~
a.cc:40:5: error: redefinition of 'int main()'
   40 | int main() {
      |     ^~~~
a.cc:14:5: note: 'int main()' previously defined here
   14 | int main() {
      |     ^~~~
Language: C++

#include <iostream>
#include <vector>
 
using namespace std;
 
bool check(vector <int> as, int len, int k) {
  for (const auto& a : as) {
    int num = (long double)a / (long double) len - 1;
    if (int(num) > k) return false;
  }
  return true;
}
 
int main() {
  int n, k; cin >> n >> k;
  vector <int> as(n,0);
  for (int i = 0; i < n; i++) cin >> as[i];
  int left = 0;
  int right = 1 << 9;
  while (left < right) {
    int center = (left + right) / 2;
    if (check(as, center, k)) left = center;
    else right = center;
  }
  cout << left << endl;
}
#include <iostream>
#include <vector>
 
using namespace std;
 
bool check(vector <int> as, int len, int k) {
  for (const auto& a : as) {
    int num = (long double)a / (long double) len - 1;
    if (int(num) > k) return false;
  }
  return true;
}
 
int main() {
  int n, k; cin >> n >> k;
  vector <int> as(n,0);
  for (int i = 0; i < n; i++) cin >> as[i];
  int left = 0;
  int right = 1 << 9;
  while (left < right) {
    int center = (left + right) / 2;
    if (check(as, center, k)) right = center;
    else left = center;
  }
  cout << left << endl;
}
提出情報

Compiler output:
a.cc:32:6: error: redefinition of 'bool check(std::vector<int>, int, int)'
   32 | bool check(vector <int> as, int len, int k) {
      |      ^~~~~
a.cc:6:6: note: 'bool check(std::vector<int>, int, int)' previously defined here
    6 | bool check(vector <int> as, int len, int k) {
      |      ^~~~~
a.cc:40:5: error: redefinition of 'int main()'
   40 | int main() {
      |     ^~~~
a.cc:14:5: note: 'int main()' previously defined here
   14 | int main() {
      |     ^~~~
a.cc:53:1: error: '\U000063d0\U000051fa\U000060c5\U00005831' does not name a type
   53 | 提出情報
      | ^~~~~~~~