Language: Java

//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007

signed main(){
    multiset<int> inp;

    int N,K;
    cin>>N>>K;

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

    int l=0;
    int r=LLONG_MAX;
    while(1){
        int m=(l+r)/2;
        multiset<int> log=inp;
        for(int i=0;i<K;i++){
            int L=*(log.rbegin());
            log.erase(log.find(L));
            if(L<=m) break;
            log.insert(m);
            log.insert(L-m);
        }
        int L=*(log.rbegin());
        if(L<=m){
            if(r==m) break;
            r=m;
        }
        else{
            if(l==m) break;
            l=m;
        }
    }
    cout<<r<<endl;
}



Compiler output:
Main.java:2: error: illegal character: '#'
#include<iostream>
^
Main.java:3: error: illegal character: '#'
#include<algorithm>
^
Main.java:4: error: illegal character: '#'
#include<cmath>
^
Main.java:5: error: illegal character: '#'
#include<vector>
^
Main.java:6: error: illegal character: '#'
#include<queue>
^
Main.java:7: error: illegal character: '#'
#include<set>
^
Main.java:20: error: illegal character: '#'
#define int long long
^
Main.java:20: error: class, interface, enum, or record expected
#define int long long
        ^
Main.java:21: error: illegal character: '#'
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
^
Main.java:21: error: class, interface, enum, or record expected
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
                               ^
Main.java:21: error: class, interface, enum, or record expected
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
                                       ^
Main.java:22: error: illegal character: '#'
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
^
Main.java:22: error: class, interface, enum, or record expected
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
                                    ^
Main.java:22: error: class, interface, enum, or record expected
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
                                             ^
Main.java:23: error: illegal character: '#'
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
^
Main.java:23: error: class, interface, enum, or record expected
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
                             ^
Main.java:23: error: class, interface, enum, or record expected
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
                                     ^
Main.java:24: error: illegal character: '#'
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
^
Main.java:24: error: class, interface, enum, or record expected
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
                                  ^
Main.java:24: error: class, interface, enum, or record expected
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
                                           ^
Main.java:25: error: illegal character: '#'
#define MOD 1000000007
^
Main.java:30: error: class, interface, enum, or record expected
    int N,K;
    ^
Main.java:31: error: class, interface, enum, or record expected
    cin>>N>>K;
    ^
Main.java:33: error: class, interface, enum, or record expected
    for(int i=0;i<N;i++){
    ^
Main.java:33: error: class, interface, enum, or record expected
    for(int i=0;i<N;i++){
                ^
Main.java:33: error: class, interface, enum, or record expected
    for(int i=0;i<N;i++){
                    ^
Main.java:35: error: class, interface, enum, or record expected
        cin>>A;
        ^
Main.java:36: error: class, interface, enum, or record expected
        inp.insert(A);
        ^
Main.java:37: error: class, interface, enum, or record expected
    }
    ^
Main.java:40: error: unnamed classes are a preview feature and are disabled by default.
    int r=LLONG_MAX;
    ^
  (use --enable-preview to enable unnamed classes)
Main.java:41: error: class, interface, enum, or record expected
    while(1){
    ^
Main.java:44: error: class, interface, enum, or record expected
        for(int i=0;i<K;i++){
        ^
Main.java:44: error: class, interface, enum, or record expected
        for(int i=0;i<K;i++){
                    ^
Main.java:44: error: class, interface, enum, or record expected
        for(int i=0;i<K;i++){
                        ^
Main.java:46: error: class, interface, enum, or record expected
            log.erase(log.find(L));
            ^
Main.java:47: error: class, interface, enum, or record expected
            if(L<=m) break;
            ^
Main.java:48: error: class, interface, enum, or record expected
            log.insert(m);
            ^
Main.java:49: error: class, interface, enum, or record expected
            log.insert(L-m);
            ^
Main.java:50: error: class, interface, enum, or record expected
        }
        ^
Main.java:52: error: class, interface, enum, or record expected
        if(L<=m){
        ^
Main.java:54: error: class, interface, enum, or record expected
            r=m;
            ^
Main.java:55: error: class, interface, enum, or record expected
        }
        ^
Main.java:58: error: class, interface, enum, or record expected
            l=m;
            ^
Main.java:59: error: class, interface, enum, or record expected
        }
        ^
Main.java:62: error: class, interface, enum, or record expected
}
^
45 errors