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

/*
????°??????????????£? = ??????????????????
while(?????? == false){
    ????°??????????????£?++;
}
*/
#include <cassert>
#include <iostream>
#include <algorithm>

bool Check(const std::vector<int> Wi, int k, int P)
{
    int p = 0;
    --k;
    for(int i = 0; i < Wi.size(); ++i){
        if(P - p >= Wi[i]){
            p += Wi[i];
        }else{
            p = Wi[i];
            --k;
        }
    }
    return k >= 0;
}
int main()
{
    int n,k;
    std::cin >> n >> k;
    std::vector<int> Wi(n);
    for(int i = 0; i < n; ++i){
        std::cin >> Wi[i];
    }
    int P = *std::max_element(Wi.begin(), Wi.end());
    while(Check(Wi, k, P) == false){
        ++P;
    }
    std::cout << P << std::endl;
    return 0;
}

Compiler output:
a.cc:11:23: error: 'vector' in namespace 'std' does not name a template type
   11 | bool Check(const std::vector<int> Wi, int k, int P)
      |                       ^~~~~~
a.cc:10:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    9 | #include <algorithm>
  +++ |+#include <vector>
   10 | 
a.cc:11:29: error: expected ',' or '...' before '<' token
   11 | bool Check(const std::vector<int> Wi, int k, int P)
      |                             ^
a.cc: In function 'bool Check(int)':
a.cc:14:7: error: 'k' was not declared in this scope
   14 |     --k;
      |       ^
a.cc:15:24: error: 'Wi' was not declared in this scope; did you mean 'i'?
   15 |     for(int i = 0; i < Wi.size(); ++i){
      |                        ^~
      |                        i
a.cc:16:12: error: 'P' was not declared in this scope
   16 |         if(P - p >= Wi[i]){
      |            ^
a.cc: In function 'int main()':
a.cc:29:10: error: 'vector' is not a member of 'std'
   29 |     std::vector<int> Wi(n);
      |          ^~~~~~
a.cc:29:10: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:29:17: error: expected primary-expression before 'int'
   29 |     std::vector<int> Wi(n);
      |                 ^~~
a.cc:31:21: error: 'Wi' was not declared in this scope; did you mean 'i'?
   31 |         std::cin >> Wi[i];
      |                     ^~
      |                     i
a.cc:33:31: error: 'Wi' was not declared in this scope
   33 |     int P = *std::max_element(Wi.begin(), Wi.end());
      |                               ^~
Language: C++

/*
????°??????????????£? = ??????????????????
while(?????? == false){
    ????°??????????????£?++;
}

?????????:1 2 3 4 5 6 
???  ???:X X X O O O
X???1???????????????O???????°??????????

????°????O??¨?????§???X?????????????????????
??????????????????????????°??????
*/
//--- --- --- debug function --- --- ---
// #define DEBUG // switch this macro
#ifdef DEBUG
#include <cstdio>
typedef int (*printf_t)(const char* format, ...);
printf_t printfd = std::printf;
#else
int printfd(const char* format, ...){return 0;}
#endif
//--- --- --- debug function --- --- ---
#include <cassert>
#include <iostream>
#include <vector>
#include <algorithm>

bool Check(const std::vector<int> Wi, int k, int P)
{
    if(*std::max_element(Wi.begin(), Wi.end()) > P) return false;
    int p = 0;
    --k;
    for(int i = 0; i < Wi.size(); ++i){
        if(P - p >= Wi[i]){
            p += Wi[i];
        }else{
            p = Wi[i];
            --k;
        }
    }
    return k >= 0;
}
int main()
{
    int n,k;
    std::cin >> n >> k;
    std::vector<int> Wi(n);
    for(int i = 0; i < n; ++i){
        std::cin >> Wi[i];
    }

    int MaxBad  = std::accumulate(Wi.begin(), Wi.end(), 0) / k - 1;
    int MinGood = std::ceil(((double)n / k)) * *std::max_element(Wi.begin(), Wi.end());
    int P = (MaxBad + MinGood) / 2;
    printfd("Max:%d, Min:%d, P:%d\n", MaxBad, MinGood, P);
    while(MaxBad + 1 != MinGood){
        if(Check(Wi, k, P)){
            MinGood = P;
        }else{
            MaxBad = P;
        }
        P = (MaxBad + MinGood) / 2;
        printfd("Max:%d, Min:%d, P:%d\n", MaxBad, MinGood, P);
    }
    std::cout << MinGood << std::endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:24: error: 'accumulate' is not a member of 'std'
   53 |     int MaxBad  = std::accumulate(Wi.begin(), Wi.end(), 0) / k - 1;
      |                        ^~~~~~~~~~
a.cc:54:24: error: 'ceil' is not a member of 'std'
   54 |     int MinGood = std::ceil(((double)n / k)) * *std::max_element(Wi.begin(), Wi.end());
      |                        ^~~~
Language: C++

/*
????°??????????????£? = ??????????????????
while(?????? == false){
    ????°??????????????£?++;
}

?????????:1 2 3 4 5 6 
???  ???:X X X O O O
X???1???????????????O???????°??????????

????°????O??¨?????§???X?????????????????????
??????????????????????????°??????
*/
//--- --- --- debug function --- --- ---
// #define DEBUG // switch this macro
#ifdef DEBUG
#include <cstdio>
typedef int (*printf_t)(const char* format, ...);
printf_t printfd = std::printf;
#else
int printfd(const char* format, ...){return 0;}
#endif
//--- --- --- debug function --- --- ---
#include <cassert>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

bool Check(const std::vector<int> Wi, int k, int P)
{
    if(*std::max_element(Wi.begin(), Wi.end()) > P) return false;
    int p = 0;
    --k;
    for(int i = 0; i < Wi.size(); ++i){
        if(P - p >= Wi[i]){
            p += Wi[i];
        }else{
            p = Wi[i];
            --k;
        }
    }
    return k >= 0;
}
int main()
{
    int n,k;
    std::cin >> n >> k;
    std::vector<int> Wi(n);
    for(int i = 0; i < n; ++i){
        std::cin >> Wi[i];
    }

    int MaxBad  = std::accumulate(Wi.begin(), Wi.end(), 0) / k - 1;
    int MinGood = std::ceil(((double)n / k)) * *std::max_element(Wi.begin(), Wi.end());
    int P = (MaxBad + MinGood) / 2;
    printfd("Max:%d, Min:%d, P:%d\n", MaxBad, MinGood, P);
    while(MaxBad + 1 != MinGood){
        if(Check(Wi, k, P)){
            MinGood = P;
        }else{
            MaxBad = P;
        }
        P = (MaxBad + MinGood) / 2;
        printfd("Max:%d, Min:%d, P:%d\n", MaxBad, MinGood, P);
    }
    std::cout << MinGood << std::endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:24: error: 'ceil' is not a member of 'std'
   55 |     int MinGood = std::ceil(((double)n / k)) * *std::max_element(Wi.begin(), Wi.end());
      |                        ^~~~
Language: C++

/**************
*	Allocation
*************/

#include <iostream>
#include <vector>	//??£?¨?
#include <numeric>	//??¢??°
#include <algorithm>
using namespace std;

//??\???
vector<int> getLoadList(int n)//??????????????°
{	
	vector<int>loadList(n);//?????????
	
	for(int i=0; i<n; i++){
		cin >> loadList[i];
	}
	return loadList;//????????????
}

	//??????
bool check(vector<int>loadList, int k, int minP){
	int truck=1; 
	int sum  =0;
	for(int i=0; i< loadList.size(); i++){
		
		if(minP < (sum + loadList[i])){//
			truck ++;
			sum = 0 ;//??????????????????
		}
		sum += loadList[i];
	}
	if(k < truck){
		//????????????????????????????????????????????????????????£??????
		return false;
	}
	return true;
}

int main()
{
	//???????????°n??¨?????????????????°k??????????????????
	int n;
	cin >> n;
	
	int k;
	cin >> k;
	
	//?????????????????°??§??????????????????????????????
	vector<int> loadList = getLoadList(n);
	
	//?????????????±???????
//	int aveload = accumulate(loadList.begin(),loadList.end(),0)/n; 
	//?????????????????§??????
//	int minP = aveload+1;
	
	//minP????????§???????´???\???
	int minP = *max_element(loadList.begin(), loadList.end());
	int xxx = binary_search(loadList.begin(), loadList.end(), loadList[n/2]);
	
	//?????????????????????????????¢??°???????????????????????°??????????????°??????????????????
	while(!check(loadList,k,minP)){
		//????????????P????????????????¢???????
		if(n>10000);{
			minP = minP + xxx ;	//????????????????????????
		}
		else{
		minP = minP ;
		}
	}
	
	//?????§????????? P???????°?????????????
	cout << minP << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:17: error: 'else' without a previous 'if'
   68 |                 else{
      |                 ^~~~
Language: C++

#include <iostream>
#include <limits>

const int MAX_N = 100000;
const int MAX_K = 100000;

int main() {
  int n = 0;
  int k = 0;

  int w[MAX_N] = {0};
  int tracks[MAX_K] = {0};

  std:: cin >> n;
  std:: cin >> k;

  int minWeight = INT_MAX;
  int maxWeight = 0;

  for (int i = 0; i < n; i++) {
    std:: cin >> w[i];

    if (w[i] < minWeight) {
      minWeight = w[i];
    }

    maxWeight += w[i];
  }

  int weight = INT_MAX;

  for (int i = minWeight; i <= maxWeight; i++) {
    int j = 0;
    int m = 0;

    int sum = 0;

    while ((j < n) && (m < k)) {
      if ((sum + w[j]) <= i) {
	sum += w[j];
	j++;
      } else {
	tracks[m] = sum;
	m++;
	sum = 0;
      }
    }
    
    if ((j == n) && (i < weight)) {
      weight = i;
    }
  }

  std::cout << weight << std::endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:19: error: 'INT_MAX' was not declared in this scope
   17 |   int minWeight = INT_MAX;
      |                   ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <limits>
  +++ |+#include <climits>
    3 |
Language: C++

#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
??
vector<int> Input(const int n)
{
????????vector<int> W;
????????for(int i = 0; i < n; i++){
????????????????int w;
????????????????cin >> w;
????????????????W.push_back(w);
????????}
????????return W;
}
??
bool IsAllLoaded(int P, vector<int> W, int k)
{
????????int TrackIndex = 0;
????????int CurrentSum = 0;
????????int i = 0;
????????for(i = 0; i < W.size(); i++){
????????????????if(W[i] > P){
????????????????????????return false;
????????????????}
????????????????if(CurrentSum + W[i] > P){
????????????????????????TrackIndex++;
????????????????????????if(TrackIndex == k){
????????????????????????????????return false;
????????????????????????}
????????????????????????CurrentSum = 0;
????????????????}
????????????????CurrentSum += W[i];
????????}
????????return true;
}
??
int Calc(vector<int> W, int k)
{
????????int Sum = accumulate(W.begin(), W.end(), 0 );
????????int P = (Sum + k - 1) / k;
????????while(!IsAllLoaded(P, W, k)){
????????????????P++;
????????}
????????return P;
}
??
int main()
{
????????int n, k; //n:????????????° k:??????????????????°?? 
????????cin >> n >> k;
????????vector<int> W = Input(n);
????????int P = Calc(W, k); //P:???????????????????????????????????????????????????§?????????????????°????
????????cout << P << endl;
????????return 0;
}

Compiler output:
a.cc:5:1: error: expected unqualified-id before '?' token
    5 | ??
      | ^
a.cc:16:1: error: expected unqualified-id before '?' token
   16 | ??
      | ^
a.cc:37:1: error: expected unqualified-id before '?' token
   37 | ??
      | ^
a.cc:47:1: error: expected unqualified-id before '?' token
   47 | ??
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
??
vector<int> Input(const int n)
{
????????vector<int> W;
????????for(int i = 0; i < n; i++){
????????????????int w;
????????????????cin >> w;
????????????????W.push_back(w);
????????}
????????return W;
}
??
bool IsAllLoaded(int P, vector<int> W, int k)
{
????????int TrackIndex = 0;
????????int CurrentSum = 0;
????????int i = 0;
????????for(i = 0; i < W.size(); i++){
????????????????if(W[i] > P){
????????????????????????return false;
????????????????}
????????????????if(CurrentSum + W[i] > P){
????????????????????????TrackIndex++;
????????????????????????if(TrackIndex == k){
????????????????????????????????return false;
????????????????????????}
????????????????????????CurrentSum = 0;
????????????????}
????????????????CurrentSum += W[i];
????????}
????????return true;
}
??
int Calc(vector<int> W, int k)
{
????????int Sum = accumulate(W.begin(), W.end(), 0 );
????????int P = (Sum + k - 1) / k;
????????while(!IsAllLoaded(P, W, k)){
????????????????P++;
????????}
????????return P;
}
??
int main()
{
????????int n, k;
????????cin >> n >> k;
????????vector<int> W = Input(n);
????????int P = Calc(W, k);
????????cout << P << endl;
????????return 0;
}

Compiler output:
a.cc:5:1: error: expected unqualified-id before '?' token
    5 | ??
      | ^
a.cc:16:1: error: expected unqualified-id before '?' token
   16 | ??
      | ^
a.cc:37:1: error: expected unqualified-id before '?' token
   37 | ??
      | ^
a.cc:47:1: error: expected unqualified-id before '?' token
   47 | ??
      | ^
Language: C++

#include <iostream>
using namespace std;
#define MAX 100000
typedef long long llong;

int n,k;
llong T[MAX];

int check(long p){
	int i =0;
	for (int j=0;j<k;j++){
		llong s=0;
		while(s+T[i]<=p){
			s +=T[i];
			i++;
			if (i==n) return n;
		}
	}
	return i;
}


int solve(){
	llong left =0;
	llong right = 100000 * 10000;
	llong mid;
	while(right - left >1 ){
		mid =(left+right)/2;
		int v=check(mid);
		if(v>=n)right=mid;
		else left=mid;
	}
	return right;
}


int main(){
	cin() >> n >> k;
	for (int i =0; i<n;i++){
	cin >> T[i];
	}
	llong ans=solve();
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:12: error: no match for call to '(std::istream {aka std::basic_istream<char>}) ()'
   38 |         cin() >> n >> k;
      |         ~~~^~
Language: C++

#include <iostream>
using namespace std;
#define MAX 100000
typedef long long llong;

int n,k;
llong T[MAX];

int check(long p){
	int i =0;
	for (int j=0;j<k;j++){
		llong s=0;
		while(s+T[i]<=p){
			s +=T[i];
			i++;
			if (i==n) return n;
		}
	}
	return i;
}


int solve(){
	llong left =0;
	llong right = 100000 * 10000;
	llong mid;
	while(right - left >1 ){
		mid =(left+right)/2;
		int v=check(mid);
		if(v>=n)right=mid;
		else left=mid;
	}
	return right;
}


main(){
	cin() >> n >> k;
	for (int i =0; i<n;i++){
	cin >> T[i];
	}
	llong ans=solve();
	cout << ans << endl;
}

Compiler output:
a.cc:37:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   37 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:38:12: error: no match for call to '(std::istream {aka std::basic_istream<char>}) ()'
   38 |         cin() >> n >> k;
      |         ~~~^~
Language: C++

#include <iostream>

using namespace std;

bool ok(const int& p, const int& n, const int& k, const int w[])
{
    int c = 0, sum = 0;
    for(int i = 0; i < n; i++)
    {
        if(w[i] <= p)
        {
            sum += w[i];
            if(sum > p)
            {
                c++;
                sum = w[i];
            }
        }
        else
            return false;
    }
    return c < k;
}

int main() {
    int n,k;
    cin >> n >> k;
    int w[n];
    for(int i = 0; i < n; i++)
        cin >> w[i];
    int l = 0, h = INT_MAX;
    while(l+1 < h)
    {
        int m = (l+h)/2;
        if(ok(m,n,k,w)) h = m;
        else l = m;
    }
    cout << h << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:20: error: 'INT_MAX' was not declared in this scope
   31 |     int l = 0, h = INT_MAX;
      |                    ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 |
Language: C++

#include <algorithm>
#include <iostream>
#include <math.h>
using namespace std;

bool truck(int M,int n,int k,int bag[]);

int main(){
    int n,k,bag[100000+10];
    cin >> n >> k;
    for(int j=0;j<n;j++){
        cin >> bag[j];
    }
    int l=0;
    double h=pow(2,31);
    bool test;
    while(l+1<h){
        int m=(l+h)/2;
        test=truck(m,n,k,bag);
        if(test) h=m;
        else l=m;
    }
    cout << h << endl;
}

bool truck(int M,int n,int k,int bag[]){
    int wgt=0,num=1;
    for(int i=0;i<n;i++){
        if(wgt+bag[i]<=M) wgt+=bag[i];
        else{
            num++;
            if(bag[i]<=M) wgt=bag[i];
            else{
                num=100000+10;
                break;
            }
        }
    }
//    if(num<=k) cout << 1 << endl;
//    else cout << 0 << endl;
    return num<=k;
}


bool truck(int M,int n,int k,int bag[]){
    int wgt=0,num=1;
    for(int i=0;i<n;i++){
        if(wgt+bag[i]<=M) wgt+=bag[i];
        else{
            num++;
            if(bag[i]<=M) wgt=bag[i];
            else{
                num=100000+10;
                break;
            }
        }
    }
//    if(num<=k) cout << 1 << endl;
//    else cout << 0 << endl;
    return num<=k;
}

Compiler output:
a.cc:45:6: error: redefinition of 'bool truck(int, int, int, int*)'
   45 | bool truck(int M,int n,int k,int bag[]){
      |      ^~~~~
a.cc:26:6: note: 'bool truck(int, int, int, int*)' previously defined here
   26 | bool truck(int M,int n,int k,int bag[]){
      |      ^~~~~
Language: C++

#include <algorithm>
#include <iostream>
#include <math.h>
using namespace std;

bool truck(int M,int n,int k,int bag[]);

int main(){
    int n,k,bag[100000+10];
    cin >> n >> k;
    for(int j=0;j<n;j++){
        cin >> bag[j];
    }
    int l=0;
    long int h=pow(2,31);
    bool test;
    while(l+1<h){
        int m=(l+h)/2;
        test=truck(m,n,k,bag);
        if(test) h=m;
        else l=m;
    }
//    cout << h << endl;
    
    printf("%ld\n",h);

}

bool truck(int M,int n,int k,int bag[]){
    int wgt=0,num=1;
    for(int i=0;i<n;i++){
        if(wgt+bag[i]<=M) wgt+=bag[i];
        else{
            num++;
            if(bag[i]<=M) wgt=bag[i];
            else{
                num=100000+10;
                break;
            }
        }
    }
//    if(num<=k) cout << 1 << endl;
//    else cout << 0 << endl;
    return num<=k;
}


bool truck(int M,int n,int k,int bag[]){
    int wgt=0,num=1;
    for(int i=0;i<n;i++){
        if(wgt+bag[i]<=M) wgt+=bag[i];
        else{
            num++;
            if(bag[i]<=M) wgt=bag[i];
            else{
                num=100000+10;
                break;
            }
        }
    }
//    if(num<=k) cout << 1 << endl;
//    else cout << 0 << endl;
    return num<=k;
}

Compiler output:
a.cc:48:6: error: redefinition of 'bool truck(int, int, int, int*)'
   48 | bool truck(int M,int n,int k,int bag[]){
      |      ^~~~~
a.cc:29:6: note: 'bool truck(int, int, int, int*)' previously defined here
   29 | bool truck(int M,int n,int k,int bag[]){
      |      ^~~~~
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;
long long w[10000];
long long n,k;
long long work(long long p)
{
    long long sum,i=0,j=k;
    while(j--)
    {
        sum=0;
        while(sum+w[i]<=p)
        {
            sum += w[i];
            i++;
            if(i==n)
                return n;
        }
    }
    return i;
}
long long main()
{
    long long i,left=0,right=1000000000,mid;
    cin>>n>>k;
    for(i=0;i<n;i++)
        cin>>w[i];
        //scanf("%d",&w[i]);
    while(right-left>1)
    {
        mid = (right+left)/2;
        if(work(mid)<n)
            left = mid;
        else
            right = mid;
    }
    cout<<right<<endl;
    return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

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

int n, P, p, s, k, w[100010];

bool judge(int p) {
	int sum[100010], i=0, j=0;

	while (i<n) {

		while (sum[j] <= p) {
			sum[j] += w[i];
			i++;
		}
		j++;

		if (j > k) return false;
	}

	return true;
}

int max_min(int p) {
	int sum[100010], i = 0, j = 0;

	while (i<n) {

		while (sum[j] <= p) {
			sum[j] += w[i];
			i++;
		}
		
		if (max < sum[j]) {
			max = sum[j];
		}

			j++;
	}
	return max;
}

int binary_search(int k) {
	int l = 0, r = n;

	while (r - l >= 1) {
		int m = (l + r) / 2;

		if (!judge(m) && judge(m+1)) return m;
		else if (!judge(m)) {
			r=m;
		}
		else if (judge(m)) {
			l = m + 1;
		}
	}
}

int main() {

	cin >> n >> k;

	for (int i = 0; i < n; i++) {
		cin >> w[i];
	}

	P = binary_search(k);

	s = max_min(P);

	cout << s << endl;

}

Compiler output:
a.cc: In function 'int max_min(int)':
a.cc:34:21: error: parse error in template argument list
   34 |                 if (max < sum[j]) {
      |                     ^~~~~~~~~~~~
a.cc:34:33: error: cannot resolve overloaded function 'max' based on conversion to type 'bool'
   34 |                 if (max < sum[j]) {
      |                                 ^
a.cc:35:36: error: overloaded function with no contextual type information
   35 |                         max = sum[j];
      |                                    ^
a.cc:40:16: error: cannot resolve overloaded function 'max' based on conversion to type 'int'
   40 |         return max;
      |                ^~~
a.cc: In function 'int binary_search(int)':
a.cc:57:1: warning: control reaches end of non-void function [-Wreturn-type]
   57 | }
      | ^
Language: C++

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

int n, P, Max p, s, k, w[100010];

bool judge(int p) {
	int sum[100010], i=0, j=0;

	while (i<n) {

		while (sum[j] <= p) {
			sum[j] += w[i];
			i++;
		}
		j++;

		if (j > k) return false;
	}

	return true;
}

int max_min(int p) {
	int sum[100010], i = 0, j = 0;

	while (i<n) {

		while (sum[j] <= p) {
			sum[j] += w[i];
			i++;
		}
		
		if (Max < sum[j]) {
			Max = sum[j];
		}

			j++;
	}
	return Max;
}

int binary_search(int k) {
	int l = 0, r = n;

	while (r - l >= 1) {
		int m = (l + r) / 2;

		if (!judge(m) && judge(m+1)) return m;
		else if (!judge(m)) {
			r=m;
		}
		else if (judge(m)) {
			l = m + 1;
		}
	}
}

int main() {

	cin >> n >> k;

	for (int i = 0; i < n; i++) {
		cin >> w[i];
	}

	P = binary_search(k);

	s = max_min(P);

	cout << s << endl;

}

Compiler output:
a.cc:5:15: error: expected initializer before 'p'
    5 | int n, P, Max p, s, k, w[100010];
      |               ^
a.cc: In function 'bool judge(int)':
a.cc:13:35: error: 'w' was not declared in this scope
   13 |                         sum[j] += w[i];
      |                                   ^
a.cc:18:25: error: 'k' was not declared in this scope
   18 |                 if (j > k) return false;
      |                         ^
a.cc: In function 'int max_min(int)':
a.cc:30:35: error: 'w' was not declared in this scope
   30 |                         sum[j] += w[i];
      |                                   ^
a.cc:34:21: error: 'Max' was not declared in this scope
   34 |                 if (Max < sum[j]) {
      |                     ^~~
a.cc:40:16: error: 'Max' was not declared in this scope
   40 |         return Max;
      |                ^~~
a.cc: In function 'int main()':
a.cc:61:21: error: 'k' was not declared in this scope
   61 |         cin >> n >> k;
      |                     ^
a.cc:64:24: error: 'w' was not declared in this scope
   64 |                 cin >> w[i];
      |                        ^
a.cc:69:9: error: 's' was not declared in this scope
   69 |         s = max_min(P);
      |         ^
a.cc: In function 'int binary_search(int)':
a.cc:57:1: warning: control reaches end of non-void function [-Wreturn-type]
   57 | }
      | ^
Language: C++

#include <iostream>
using namespace std;
#define MAX 100000
typedef long long llong;

int n, k;
llong T[MAX];

int check(llong P) {
int i = 0;
for (int j = 0; j < k; j++) {
llong s = 0;
while(s + T[i] <= p) {
s += T[i];
i++;
if (i == n) return n;
}
}
return i;
}

int solve() {
llong left = 0;
llong right = 100000* 10000;
llong mid;
while(right - left > 1){
mid = (left + right) / 2;
int v = check(mid);
if(v >= n) right = mid;
else left = mid;
}
return right;
}

main () {
	cin >> n >> k;
	for (int i = 0; i < n; i++) cin >> T[i];
llong ans = solve();
cout << ans << endl;
}

Compiler output:
a.cc: In function 'int check(llong)':
a.cc:13:19: error: 'p' was not declared in this scope
   13 | while(s + T[i] <= p) {
      |                   ^
a.cc: At global scope:
a.cc:35:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   35 | main () {
      | ^~~~
Language: C++

#include<vector>
#include<iostream>
#include<algorithm>
int ReturnCap(std::vector<int> Baggage, int P, int k) {
	int v = 0, c = 0, ntrack = 0;
	for (int i = 0; i < Baggage.size(); ++i) {
		if (c > 0 && P > 0 && c + Baggage[i] > P) {
			c = 0;
			++ntrack;
		}
		if (ntrack == k) {
			break;
		}
		if (c + Baggage[i] <= P) {
			c += Baggage[i];
			++v;
		}
	}
	return v;
}
int main(void) {
	std::ios::sync_with_stdio(false);
	int n, k,max=0;
	std::cin >> n >> k;
	std::vector<int> Baggage(n, 0);
	for (int i = 0; i < n; ++i) {
		std::cin >> Baggage[i];
		max += Baggage[i];
	}
	int min = 1,P=(min+max)/2;
	while (min <= max) {
		if (n <= ) {
			max = P - 1;
		}
		else {
			min = P + 1;
		}
		P = (min + max) / 2;
	}
	std::cout << P + 1 << std::endl;
	//	system("pause");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:26: error: expected primary-expression before ')' token
   32 |                 if (n <= ) {
      |                          ^
Language: C++

#include<vector>
#include<iostream>
#include<algorithm>
int ReturnNumberBaggage(std::vector<int> Baggage, int MaxWeightPerTruck, int k) {
	int NumberBaggage = 0, weightPerTruck = 0, NumberTruck = 0;
	for (int i = 0; i < Baggage.size(); ++i) {
		//next_truck
		if (weightPerTruck > 0 && MaxWeightPerTruck > 0 && weightPerTruck + Baggage[i] > MaxWeightPerTruck) {
			weightPerTruck = 0;
			++NumberTruck;
		}
		//finish_put
		if (NumberTruck == k) {
			break;
		}
		//put
		if (weightPerTruck + Baggage[i] <= MaxWeightPerTruck) {
			weightPerTruck += Baggage[i];
			++NumberBaggage;
		}
	}
	return NumberBaggage;
}
int main(void) {
	std::ios::sync_with_stdio(false);
	int n, k,max=0;
	std::cin >> n >> k;
	std::vector<int> Baggage(n, 0);
	for (int i = 0; i < n; ++i) {
		std::cin >> Baggage[i];
		max += Baggage[i];
	}
	int min = 1, MaxWeightPerTruck =(min+max)/2;
	while (min <= max) {
		if (n <= ReturnNumberBaggage(Baggage, MaxWeightPerTruck,  k)) {
			max = MaxWeightPerTruck - 1;
		}
		else {
			min = MaxWeightPerTruck + 1;
		}
		MaxWeightPerTruck = (min + max) / 2;
	}
	std::cout << P + 1 << std::endl;
	//	system("pause");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:22: error: 'P' was not declared in this scope
   43 |         std::cout << P + 1 << std::endl;
      |                      ^
Language: C++

#include<iostream>
using namespace std;
#define MAX 100000
typedef long long llong;

int n, k;
llong T[MAX];

int check(llong p) {
	int i=0;
	for(int j = 0; j < k; j++ ) {
		llong sum = 0;
		while( sum + T[i] <= p) {
			sum += T[i];
			i++;
			if(i == n ) return n;
		}
	}
	return i;
}

int solve() {
	llong left = 0;
	llong right = 100000 * 10000;
	llong mid;
	while(left < right) {
		mid = (left + right) / 2;
		int v = check(mid);
		if(v == n) right = mid;
		else left = mid + 1};
	}
	return right;
}

main() {
	cin >> n >> k;
	for( int i = 0; i < n; i++) cin >> T[i];
	llong ans = solve();
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int solve()':
a.cc:30:36: error: expected ';' before '}' token
   30 |                 else left = mid + 1};
      |                                    ^
      |                                    ;
a.cc:31:9: warning: no return statement in function returning non-void [-Wreturn-type]
   31 |         }
      |         ^
a.cc: At global scope:
a.cc:32:9: error: expected unqualified-id before 'return'
   32 |         return right;
      |         ^~~~~~
a.cc:33:1: error: expected declaration before '}' token
   33 | }
      | ^
a.cc:35:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   35 | main() {
      | ^~~~
Language: C++

#include <cstdio>
#include <vector>
#include <unordered_map>
using namespace std;

vector<vector<int> > pack;

int make_min_packing(int n, int k,vector<int>& sum) {
	int m=sum[n-1];
	if(k==1) {
		m=sum[n-1];
		pack[n][k]=m;
	} else {
		for(int i=1; i<=n-k+1; ++i) {
			if(pack[n-i][k-1]==-1) {
				pack[n-i][k-1]=make_min_packing(n-i,k-1,sum);
			}
			m=min(m,max(pack[n-i][k-1],sum[n-1]-sum[n-i-1]));
		}
	}
	return m;
}

int main() {
	int n,k,w;
	vector<int> sum;
	scanf("%d%d",&n,&k);
	sum.resize(n);
	pack.resize(n);
	pack[0].emplace_back(k,-1);
	scanf("%d",&sum[0]);
	for(int i=1; i<n; ++i) {
		pack[i].emplace_back(k,-1);
		scanf("%d",&w);
		sum[i]=sum[i-1]+w;
	}
	printf("%d\n",make_min_packing(n,k,sum));
	return 0;
}

Compiler output:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/c++allocator.h:33,
                 from /usr/include/c++/14/bits/allocator.h:46,
                 from /usr/include/c++/14/vector:63,
                 from a.cc:2:
/usr/include/c++/14/bits/new_allocator.h: In instantiation of 'void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = int; _Args = {int&, int}; _Tp = int]':
/usr/include/c++/14/bits/alloc_traits.h:575:17:   required from 'static void std::allocator_traits<std::allocator<_Tp1> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = int; _Args = {int&, int}; _Tp = int; allocator_type = std::allocator<int>]'
  575 |           __a.construct(__p, std::forward<_Args>(__args)...);
      |           ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:117:30:   required from 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {int&, int}; _Tp = int; _Alloc = std::allocator<int>; reference = int&]'
  117 |             _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
      |             ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  118 |                                      std::forward<_Args>(__args)...);
      |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:30:22:   required from here
   30 |         pack[0].emplace_back(k,-1);
      |         ~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/include/c++/14/bits/new_allocator.h:191:11: error: new initializer expression list treated as compound expression [-fpermissive]
  191 |         { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <cstdio>
#include <vector>
#include <unordered_map>
using namespace std;

vector<vector<int>> pack;

int make_min_packing(int n, int k,vector<int>& sum) {
	int m=sum[n-1];
	if(k==1) {
		m=sum[n-1];
		pack[n][k]=m;
	} else {
		for(int i=1; i<=n-k+1; ++i) {
			if(pack[n-i][k-1]==-1) {
				pack[n-i][k-1]=make_min_packing(n-i,k-1,sum);
			}
			m=min(m,max(pack[n-i][k-1],sum[n-1]-sum[n-i-1]));
		}
	}
	return m;
}

int main() {
	int n,k,w;
	vector<int> sum;
	scanf("%d%d",&n,&k);
	sum.resize(n);
	pack.resize(n);
	pack[0].emplace_back(k,-1);
	scanf("%d",&sum[0]);
	for(int i=1; i<n; ++i) {
		pack[i].emplace_back(k,-1);
		scanf("%d",&w);
		sum[i]=sum[i-1]+w;
	}
	printf("%d\n",make_min_packing(n,k,sum));
	return 0;
}

Compiler output:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/c++allocator.h:33,
                 from /usr/include/c++/14/bits/allocator.h:46,
                 from /usr/include/c++/14/vector:63,
                 from a.cc:2:
/usr/include/c++/14/bits/new_allocator.h: In instantiation of 'void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = int; _Args = {int&, int}; _Tp = int]':
/usr/include/c++/14/bits/alloc_traits.h:575:17:   required from 'static void std::allocator_traits<std::allocator<_Tp1> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = int; _Args = {int&, int}; _Tp = int; allocator_type = std::allocator<int>]'
  575 |           __a.construct(__p, std::forward<_Args>(__args)...);
      |           ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:117:30:   required from 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {int&, int}; _Tp = int; _Alloc = std::allocator<int>; reference = int&]'
  117 |             _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
      |             ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  118 |                                      std::forward<_Args>(__args)...);
      |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:30:22:   required from here
   30 |         pack[0].emplace_back(k,-1);
      |         ~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/include/c++/14/bits/new_allocator.h:191:11: error: new initializer expression list treated as compound expression [-fpermissive]
  191 |         { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <cstdio>

using namespace std;


int main() {
	int c,n,i,j,k,l;
	int w;
	int *sum;
	int *pack_before;
	int *pack_after;

	scanf("%d%d",&n,&k);
	pack_before = (int *)malloc(sizeof(int)*n);
	pack_after = (int *)malloc(sizeof(int)*n);
	sum = (int *)malloc(sizeof(int)*n);

	scanf("%d",&w);
	sum[0]=w;
	for(i=1; i<n; ++i) {
		scanf("%d",&w);
		sum[i]=sum[i-1]+w;
	}
	for(j=0; j<k; ++j) {
		swap(pack_after,pack_before);
		for(i=j; i<n; ++i) {
			if(j==0) {
				pack_after[i]=pack_before[i]=sum[i];
				continue;
			}
			l=i;
			pack_after[i]=sum[n-1];
			while(l>=j) {
				c=sum[i]-sum[l-1];
				if(c<pack_before[l-1]) {
					c=pack_before[l-1];
				}
				if(c>pack_after[i] && l!=i) break;
				pack_after[i]=c;
				--l;
			}
		}
	}
	printf("%d\n",pack_after[n-1]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:30: error: 'malloc' was not declared in this scope
   14 |         pack_before = (int *)malloc(sizeof(int)*n);
      |                              ^~~~~~
a.cc:2:1: note: 'malloc' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
    1 | #include <cstdio>
  +++ |+#include <cstdlib>
    2 | 
a.cc:25:17: error: 'swap' was not declared in this scope
   25 |                 swap(pack_after,pack_before);
      |                 ^~~~
Language: C++

#include<stdio.h>
#include<algorithm>
#define MAX 100000
int n, k;
long long T[MAX];

int check(long long p){
	int i = 0;
	for (int j = 0; j < k; j++){
		long long s = 0;
		while (s + T[i] <= p){
			s += T[i];
			i++;
			if (i == n)return n;
		}
	}
	return i;
}


int solve(){
	int v;
	long long left = 0;
	long long right = 100000 * 10000;
	while (right > left + 1){
		mid = (left + right) / 2;
		v = check(mid);
		if (v >= n)right = mid;
		else left = mid;
	}
	return right;
}
int main(){
	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; i++){
		scanf("%d", &T[i]);
	}
	long long p = solve();
	printf("%d\n", p);
	return 0;
}

Compiler output:
a.cc: In function 'int solve()':
a.cc:26:17: error: 'mid' was not declared in this scope
   26 |                 mid = (left + right) / 2;
      |                 ^~~
Language: C++

#include<stdio.h>
#include<stdlib.h>
#define MAX 100000
int baggage[MAX],track[MAX];
int n, k;

bool vertification(int P){
	int j = 0;
	for (int i = 0; i < k; i++){
		track[i] = 0;
	}
	for (int i = 0; i < n; i++){
		if (track[j] + baggage[i] <= P){
			track[j] += baggage[i];
		}else{
			if (j < k){
				j++;
			}
			else{
				return false;
			}
		}
	}
	return true;
}

int check(){
	int left = 0;
	int right = MAX*10000;
	while (left > right + 1){
		int mid = (left + right) / 2;
		if (check(mid)){
			right = mid;
		}
		else{
			left = mid;
		}
	}
	return mid;
}

int main(){
	int result;
	scanf("%d %d", &n, &k);
	for (int i = 0; i < k; i++){
		scanf("%d", baggage[i]);
	}
	result = check();
}

Compiler output:
a.cc: In function 'int check()':
a.cc:32:26: error: too many arguments to function 'int check()'
   32 |                 if (check(mid)){
      |                     ~~~~~^~~~~
a.cc:27:5: note: declared here
   27 | int check(){
      |     ^~~~~
a.cc:39:16: error: 'mid' was not declared in this scope
   39 |         return mid;
      |                ^~~
Language: C++

#include<stdio.h>
#include<stdlib.h>
#define MAX 100000
int baggage[MAX],track[MAX];
int n, k;

bool vertification(int P){
	int j = 0;
	for (int i = 0; i < k; i++){
		track[i] = 0;
	}
	for (int i = 0; i < n; i++){
		if (track[j] + baggage[i] <= P){
			track[j] += baggage[i];
		}else{
			if (j < k){
				j++;
			}
			else{
				return false;
			}
		}
	}
	return true;
}

int check(){
	int left = 0;
	int right = MAX*10000;
	int mid;
	while (left > right + 1){
		mid = (left + right) / 2;
		if (check(mid)){
			right = mid;
		}
		else{
			left = mid;
		}
	}
	return mid;
}

int main(){
	int result;
	scanf("%d %d", &n, &k);
	for (int i = 0; i < k; i++){
		scanf("%d", baggage[i]);
	}
	result = check();
	printf("%d\n", &result);
	return 0;
}

Compiler output:
a.cc: In function 'int check()':
a.cc:33:26: error: too many arguments to function 'int check()'
   33 |                 if (check(mid)){
      |                     ~~~~~^~~~~
a.cc:27:5: note: declared here
   27 | int check(){
      |     ^~~~~
Language: C++

http://judge.u-aizu.ac.jp/onlinejudge/status.jsp#include<stdio.h>
#include<stdlib.h>
#define MAX 100000
int baggage[MAX],track[MAX];
int n, k;

bool vertification(int P){
	int j = 0;
	for (int i = 0; i < k; i++){
		track[i] = 0;
	}
	for (int i = 0; i < n; i++){
		if (track[j] + baggage[i] <= P){
			track[j] += baggage[i];
		}else{
			if (j < k-1){
				j++;
			}
			else{
				return false;
			}
		}
	}
	return true;
}

int check(){
	int left = 0;
	int right = MAX*10000;
	int mid;
	while (left <= right){
		mid = (left + right) / 2;
		if (vertification(mid)){
			right = mid-1;
		}
		else{
			left = mid+1;
		}
	}
	return mid;
}

int main(){
	int result;
	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; i++){
		scanf("%d", baggage[i]);
	}
	result = check();
	printf("%d\n", &result);
	return 0;
}

Compiler output:
a.cc:1:1: error: 'http' does not name a type
    1 | http://judge.u-aizu.ac.jp/onlinejudge/status.jsp#include<stdio.h>
      | ^~~~
a.cc: In function 'int main()':
a.cc:45:9: error: 'scanf' was not declared in this scope
   45 |         scanf("%d %d", &n, &k);
      |         ^~~~~
a.cc:50:9: error: 'printf' was not declared in this scope
   50 |         printf("%d\n", &result);
      |         ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 | #include<stdlib.h>
  +++ |+#include <cstdio>
    3 | #define MAX 100000
Language: C++

#include<stdio.h>
#include<stdlib.h>
#define MAX 100000
long long baggage[MAX];
int n, k;

bool vertification(int P){
	long long j = 0;
	 track=0;
	for (int i = 0; i < n; i++){
		if (track + baggage[i] <= P){
			track += baggage[i];
		}else{
			if (j < k-1){
				j++;
				track = 0;
			}
			else{
				return false;
			}
		}
	}
	return true;
}

int check(){
	long long left = 0;
	long long right = MAX*10000;
	long long mid;
	while (right-left>1){
		mid = (left + right) / 2;
		if (vertification(mid)){
			right = mid;
		}
		else{
			left = mid;
		}
	}
	return right;
}

int main(){
	int result;
	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; i++){
		scanf("%d", baggage[i]);
	}
	result = check();
	printf("%d\n", &result);
	return 0;
}

Compiler output:
a.cc: In function 'bool vertification(int)':
a.cc:9:10: error: 'track' was not declared in this scope
    9 |          track=0;
      |          ^~~~~
Language: C++

#include<cstdio.h>
#define MAX 100000
typedef long long ll;
int n,k;
ll T[MAX];
int check(ll P){
  int i,j=0;
  ll s;
  for(i=0;i<k;i++){
    s=0;
    while(s+T[j]<=P){
      s+=T[j];
      j++;
      if(j==n)return n;
    }
  }
  return j;
}
int solve(){
  ll left=0;
  ll right=100000*10000;
  ll mid;
  while(right-left>1){
    mid=(right+left)/2;
    int v=check(mid);
    if(v>=n)right=mid;
    else left=mid;
  }
  return right;
}
int main(){
  int i;
  ll ans;
  scanf("%d%d",&n,&k);
  for(i=0;i<n;i++)scanf("%d",&T[i]);
  ans=solve();
  printf("%lld\n",ans);
}

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


#include<stdio.h>
#include<string.h>
#include<algorithm>
#define MAX 10000000
#define INFTY 10000000

int H,A[MAX+1];
void maxHeapify(int i){
  
}

int extract(){
  int maxcost;
  if(H<1)return -INFTY;
  maxcost=A[1];
  A[1]=A[H--];
  maxHeapify(1);
  return maxcost;
}

void increaseKey(int i,int key){
  if(key<A[i])return;
  A[i]=key;
  while(i>1&&A[i/2]<A[i]){
    swap(A[i],A[i/2]);
    i=i/2;
  }
}

void insert(int key){
  H++;
  A[H]=-INFTY;
  increaseKey(H,key);
}

int main(){
  int key;
  char com[10];
  while(1){
    scanf("%s", com);
    if(com[0]=='e'&& com[1]=='n')break;
    if(com[0]=='i'){
      scanf("%d",&key);
      insert(key);
    }
    else{
      printf("%d\n",extract());
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'void increaseKey(int, int)':
a.cc:26:5: error: 'swap' was not declared in this scope
   26 |     swap(A[i],A[i/2]);
      |     ^~~~
a.cc:26:5: note: suggested alternatives:
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_pair.h:1106:5: note:   'std::swap'
 1106 |     swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;
      |     ^~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:61:
/usr/include/c++/14/bits/move.h:226:5: note:   'std::swap'
  226 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/14/bits/move.h:226:5: note:   'std::swap'
Language: C++

#include<iosteram>
using namespace std;

bool ok(int P,int n,int w[]){
  int weight=0;
  int ans=0;
  for(int i=0;i<n;i++){
    weight+=w[i];
    if(weight>P) ans+=1;
  }
  return ans
}
int main(){
  int n,k;
  cin>>n>>k;
  int w[n];
  for(int i=0;i++;i<n){
    cin>>w[i];
  }
  int l=0,h=1000000;
  while(l+1<h){
    int m=(l+h)/2;
    if(ok(m)) h=m; else l=m;
  }
  printf("%d\n",l);
}

Compiler output:
a.cc:1:9: fatal error: iosteram: No such file or directory
    1 | #include<iosteram>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
using namespace std;
#define MAX 19960328
typedef long long LL;

int n, k;
LL T[MAX];

int check(LL P){
    int i=0;
    for (int j=0;j<k;i++){
        LL s=0;
        while(s+T[i]<=P){
            s+=T[i];
            i++
            if(i == n){return n;}
        }
    }
    return i;
}

int solve(){
    LL left = 0;
    LL right = 100000*100000;
    LL mid;
    while(right>left){
        mid = (left+right)/2;
        int v = check(mid);
        if (v>=n) right = mid;
        else left = mid;
    }
    return right;
}

int main(){
    cin >> n>>k;
    for (int i=0;i<n;i++) cin>>T[i];
    LL ans = solve();
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int check(LL)':
a.cc:15:16: error: expected ';' before 'if'
   15 |             i++
      |                ^
      |                ;
   16 |             if(i == n){return n;}
      |             ~~  
a.cc: In function 'int solve()':
a.cc:24:22: warning: integer overflow in expression of type 'int' results in '1410065408' [-Woverflow]
   24 |     LL right = 100000*100000;
      |                ~~~~~~^~~~~~~
Language: C++

#include<iostream>
using namespace std;
#define MAX 19960328
typedef long long LL;

int n, k;
LL T[MAX];

int check(LL P){
    int i=0;
    for (int j=0;j<k;i++){
        LL s=0;
        while(s+T[i]<=P){
            s+=T[i];
            i++
            if(i == n){return n;}
        }
    }
    return i;
}

int solve(){
    LL left = 0;
    LL right = 100000*100000;
    LL mid;
    while(right>left){
        mid = (left+right)/2;
        int v = check(mid);
        if (v>=n) {
            right = mid;
        }
        else left = mid;
    }
    return right;
}

int main(){
    cin >> n>>k;
    for (int i=0;i<n;i++) cin>>T[i];
    LL ans = solve();
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int check(LL)':
a.cc:15:16: error: expected ';' before 'if'
   15 |             i++
      |                ^
      |                ;
   16 |             if(i == n){return n;}
      |             ~~  
a.cc: In function 'int solve()':
a.cc:24:22: warning: integer overflow in expression of type 'int' results in '1410065408' [-Woverflow]
   24 |     LL right = 100000*100000;
      |                ~~~~~~^~~~~~~
Language: C++

#include<iostream>
using namespace std;
#define MAX 100000;
typedef long long LL;

int n, k;
LL T[MAX];

int check(LL P){
    int i=0;
    for (int j=0;j<k;i++){
        LL s=0;
        while(s+T[i]<=P){
            s+=T[i];
            i++;
            if(i == n){return n;}
        }
    }
    return i;
}

int solve(){
    LL left = 0;
    LL right = 100000*100000;
    LL mid;
    while(right>left+1){
        mid = (left+right)/2;
        int v = check(mid);
        if (v>=n) {
            right = mid;
        }
        else left = mid;
    }
    return right;
}

int main(){
    cin >> n>>k;
    for (int i=0;i<n;i++) cin>>T[i];
    LL ans = solve();
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc:3:19: error: expected ']' before ';' token
    3 | #define MAX 100000;
      |                   ^
a.cc:7:6: note: in expansion of macro 'MAX'
    7 | LL T[MAX];
      |      ^~~
a.cc:7:9: error: expected unqualified-id before ']' token
    7 | LL T[MAX];
      |         ^
a.cc: In function 'int check(LL)':
a.cc:13:17: error: 'T' was not declared in this scope
   13 |         while(s+T[i]<=P){
      |                 ^
a.cc: In function 'int solve()':
a.cc:24:22: warning: integer overflow in expression of type 'int' results in '1410065408' [-Woverflow]
   24 |     LL right = 100000*100000;
      |                ~~~~~~^~~~~~~
a.cc: In function 'int main()':
a.cc:39:32: error: 'T' was not declared in this scope
   39 |     for (int i=0;i<n;i++) cin>>T[i];
      |                                ^
Language: C++

#include<iostream>
using namespace std;
#define MSX 100000
typedef long long llong;

int n, k;
llong T[MAX];

int check(llong P) {
	int  i = 0;
	for (int j = 0; j < k; k++)
	{
		llong s = 0;
		while (s + T[i] <= P )
		{
			s += T[i];
			i++;
			if (i == n)
			{
				return n;
			}
		}
	}
	return i;
}


int solve() {
	llong left = 0;
	llong right = 100000 * 10000;
	llong mid;
	while (right - left > 1)
	{
		mid = (left = +right) / 2;
		int v = check(mid);
		if (v >= n) right = mid;
		else left = mid;
	}
	return right;
}

main() {
	cin >> n >> k;
	for (int i = 0; i < n; i++)
	{
		llong ans = solve;
		cout << ans << endl;
	}
}

Compiler output:
a.cc:7:9: error: 'MAX' was not declared in this scope; did you mean 'MSX'?
    7 | llong T[MAX];
      |         ^~~
      |         MSX
a.cc: In function 'int check(llong)':
a.cc:14:28: error: 'T' was not declared in this scope
   14 |                 while (s + T[i] <= P )
      |                            ^
a.cc: At global scope:
a.cc:42:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   42 | main() {
      | ^~~~
a.cc: In function 'int main()':
a.cc:46:29: error: invalid conversion from 'int (*)()' to 'llong' {aka 'long long int'} [-fpermissive]
   46 |                 llong ans = solve;
      |                             ^~~~~
      |                             |
      |                             int (*)()
Language: C++

#include<iostream>
using namespace std;
#define MAX 100000
typedef long long llong;

int n, k;
llong T[MAX];

int check(llong P) {
	int  i = 0;
	for (int j = 0; j < k; k++)
	{
		llong s = 0;
		while (s + T[i] <= P )
		{
			s += T[i];
			i++;
			if (i == n)
			{
				return n;
			}
		}
	}
	return i;
}


int solve() {
	llong left = 0;
	llong right = 100000 * 10000;
	llong mid;
	while (right - left > 1)
	{
		mid = (left = +right) / 2;
		int v = check(mid);
		if (v >= n) right = mid;
		else left = mid;
	}
	return right;
}

main() {
	cin >> n >> k;
	for (int i = 0; i < n; i++)
	{
		llong ans = solve;
		cout << ans << endl;
	}
}

Compiler output:
a.cc:42:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   42 | main() {
      | ^~~~
a.cc: In function 'int main()':
a.cc:46:29: error: invalid conversion from 'int (*)()' to 'llong' {aka 'long long int'} [-fpermissive]
   46 |                 llong ans = solve;
      |                             ^~~~~
      |                             |
      |                             int (*)()