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

#include<stdio.h>

 long long int check(int);
 long long int solve();

 long long int num,van_num;
 long long int cab[1000000];

 int main(){
      long long int i;
      long long int ans;

      scanf("%d %d",&num,&van_num);
      for(i=0;i<num;i++){
             scanf("%d",&cab[i]);
             {
      ans=solve();
      printf("%d\n",ans);

      return 0;
      }

 long long int check(int max_burd){
      long long int i=0,j;
      long long int van_burd;
      for(j=0;j< van_num;j++){
           van_burd=0;
           while(van_burd+cab[i]<=max_burd){
                 van_burd+=cab[i];
                 i++;
                 if(i==num)return num;
                 }
           }
       return i;
       }

 long long int solve(){
  long long int left=0;
  long long int right=100000*10000;
  long long int mid;
  long long int num_pie;

  while(right-left>1){
    mid=(left+right)/2;
    num_pie=check(mid);
    if(num_pie>=num){
      right=mid;
    }else{
      left=mid;
    }
  }

  return right;
}


Compiler output:
main.c: In function 'main':
main.c:54:1: error: expected declaration or statement at end of input
   54 | }
      | ^
main.c:54:1: error: expected declaration or statement at end of input
Language: C

#include<stdio.h>
#include<limits.h>

#define NK 100000

int main() 
{
	int n, k;
	int w[NK], P=INT_MAX;

	scanf( "%d%d", &n, &k );

	int i;
	int sum = 0;	
	for ( i=0; i<n; i++ ) {
		scanf( "%d", &w[i] );
		sum += w[i];
	}
	
	int miniLoadings = sum/k;
	int j, start;
	int truck, truckCnt, loadings;
	
	if( 1 == k ) {
        P = (int)sum;    
    } else if( k < n ) {
    	miniLoadings--; 
		start = loadings = 0;
		for( i=0; i<n; i++ ) {
			loadings += w[i];
			if( P < loadings ) { 
				loadings -= w[ start++ ];
				loadings -= w[ i-- ];
				continue;
			}
			if( miniLoadings < loadings ) {
				truck = 0;
				truckCnt = k;
				for( j=0; truckCnt!=0 &&  j<n; j++ ) {
					truck += w[j];
					if( loadings < truck ) {
						truckCnt--;
						j--;
						truck = 0;
					}
				}
				if( truckCnt && loadings <= P ) {
					P = loadings;
					loadings -= w[ start++ ];
					loadings -= w[ i-- ];
				} else {
					miniLoadings = loadings;
				}
			}
	} else {
		P = miniLoadings;
	}
	printf( "%d\n", P );
	
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:55:11: error: expected '}' before 'else'
   55 |         } else {
      |           ^~~~
Language: C

#include <stdio.h>
int check(long long);
int solve(void);
 
int n,k;
long long W[100000];
 
int main(){
  int i,P;
  scanf("%d %d",&n,&k);
  for(i = 0; i < n; i++){
  scanf("%d",&W[i]);
}
  P = solve();
  printf("%d\n",P);
  return 0;
}

int CanLay(int n, int k, int m, int *weight)
{
    int i;
    int stack = 0;
    int numTracks = 1;
 
    for(i = 0; i < n; i++)
    {
        if(weight[i] > m) return 0;
        stack += weight[i];
        if(stack > m)
        {
            stack = weight[i];
            numTracks++;
        }
    }
    if(numTracks <= k) return 1;
    else return 0;
}

Compiler output:
/usr/bin/ld: /tmp/ccyQ6sRE.o: in function `main':
main.c:(.text+0x77): undefined reference to `solve'
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>
int main(int argc, char const *argv[]) {

  int num_baggages;???// ???????????°
  int num_trucks;   // ?????????????????°
  int p;            // ?????????
  int i;
  int sum_w;        // ???????????????????????§????????????????????????????¨?
  int count_trucks; // ?????????????????°??°???????????????

  scanf("%d%d",&num_baggages,&num_trucks);
  int baggages[num_baggages]; // ??????????????????

  for( i = 0 ; i < num_baggages ; i++ ){
    scanf("%d",&baggages[i]);
    p += baggages[i];
  }

  // ?????????????????????????????????????????????
  p /= num_trucks;

  while( 1 ){

    // ?????????????????????1??°??????
    count_trucks = 1;
    sum_w = 0;

    for( i = 0 ; i < num_baggages ; i++ ){

      // ??????????????????????????????
      // ??????????????£????????\????????????????????????

      if( sum_w + baggages[i] < p ){
        sum_w += baggages[i];
      }else if( sum_w + baggages[i] == p ){
        sum_w = 0;
        count_trucks++;
      }else if( sum_w + baggages[i] > p ){
        sum_w = 0;
        count_trucks++;
        sum_w += baggages[i];
      }

    }

    // ???????????????????????????????????°???????????????????????????????????°??¨?????£??????
    // ????????????????????????????¢???????????????????????????????????????´
    if( count_trucks == num_trucks){
      break;
    }else if( count_trucks > num_trucks ){
      p++;
    }else if( count_trucks < num_trucks ){
      p--;
    }

  }

  printf("%d\n",p);

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:4:21: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
    4 |   int num_baggages;???// ???????????°
main.c:4:20: error: expected expression before '?' token
    4 |   int num_baggages;???// ???????????°
      |                    ^
main.c:11:31: error: 'num_trucks' undeclared (first use in this function); did you mean 'count_trucks'?
   11 |   scanf("%d%d",&num_baggages,&num_trucks);
      |                               ^~~~~~~~~~
      |                               count_trucks
main.c:11:31: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#define PMAX 1000000000
int wmax=0;
int n,k,w[100000];

int check(int P){
    int i;
    int count=1,now=P;
    if(P<wmax) return 0;
    for(i=0;i<n;i++){
        if(now>=w[i]){
           now-=w[i];
        }else{
            count++;
            now=P-w[i];
        }
    }
    if(count>k) return 0;
    else return 1;
}

int main(void){
    int i;
    int left,right,mid;
    scanf("%d %d",&n,&k);
    for(i=0;i<n;i++){
        scanf("%d",&w[i]);
        if(w[i]>wmax) wmax=w[i];
    }

    left=0,right=PMAX;
    while(right-left>1){
        mid=(left+right)/2;
        if( check(mid) ) right=mid;
        else left=mid;
    }
    printf("%d\n",right);

   

Compiler output:
main.c: In function 'main':
main.c:37:5: error: expected declaration or statement at end of input
   37 |     printf("%d\n",right);
      |     ^~~~~~
Language: C

{
      if( sum + w[i] <= P )   sum += w[i];
      else {
	sum = 0;
	temp++;
	if(temp >= k) return 0;
        continue;
      }
      i++;
    }

Compiler output:
main.c:1:1: error: expected identifier or '(' before '{' token
    1 | {
      | ^
Language: C

#include<stdio.h>
#define PMAX 1000000000
#difine MAX 100000
int wmax=0;
int n,k,w[MAX];  
int check(int P){
    int i;
    int count=1,now=P;
    if(P<wmax) return 0;
    for(i=0;i<n;i++){
        if(now>=w[i]){
           now-=w[i];
        }else{
            count++;
            now=P-w[i];
        }
    }
    if(count>k) return 0;
    else return 1;
}
  
int main(void){
    int i;
    int left,right,mid;
    scanf("%d %d",&n,&k);
    for(i=0;i<n;i++){
        scanf("%d",&w[i]);
        if(w[i]>wmax) wmax=w[i];
    }
    left=0,right=PMAX;
    while(right-left>1){
        mid=(left+right)/2;
        if( check(mid) ) right=mid;
        else left=mid;
    }
    printf("%d\n",right);
    return 0;
}

Compiler output:
main.c:3:2: error: invalid preprocessing directive #difine; did you mean #define?
    3 | #difine MAX 100000
      |  ^~~~~~
      |  define
main.c:5:11: error: 'MAX' undeclared here (not in a function); did you mean 'PMAX'?
    5 | int n,k,w[MAX];
      |           ^~~
      |           PMAX
Language: C

#include<stdio.h>

int n, k, S[100000]

int maxload(int P){
  int r = k, load = 0, remain = P;
  while(r > 0 && S[load] > 0){
    if(S[load] <= remain){
      remain -= S[load];
      load++;
    } else {
      r--;
      remain = P;
    }
  }
  return load;
}

int main(void){
  int i;
  scanf("%d %d", &n, &k);
  for(i=0;i<n;i++)
    scanf("%d", &S[i]);
  int left = 0, right = 10000 * n, middle;
  while(left != right - 1){
    middle = (left + right) / 2;
    if(maxload(middle) >= n)
      right = middle + 1;
    else
      left = middle + 1;
  }
  printf("%d\n", middle);
  return 0;
}

Compiler output:
main.c:5:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
    5 | int maxload(int P){
      | ^~~
main.c: In function 'main':
main.c:23:18: error: 'S' undeclared (first use in this function)
   23 |     scanf("%d", &S[i]);
      |                  ^
main.c:23:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:27:8: error: implicit declaration of function 'maxload' [-Wimplicit-function-declaration]
   27 |     if(maxload(middle) >= n)
      |        ^~~~~~~
Language: C

w[100000],n,k,g;
f(int p)
{
    int c=1;g=0;
    for(int i=0;i<n;)g+w[i]>p?(g>0?c++:return k+1),g=0:g+=w[i++];
    return c;
}
main()
{
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;scanf("%d",w+i++));
    int l=0,r=1e9,m;
    while(l<r)
    {
        m=(l+r)/2;
        if(f(m)>k)l=m+1;
        else r=m;
    }
    for(m--;;m++)
    {
        if(f(m)<=k)break;
    }
    printf("%d\n",m);
    return 0;
}

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | w[100000],n,k,g;
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'w' [-Wimplicit-int]
main.c:1:11: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
    1 | w[100000],n,k,g;
      |           ^
main.c:1:13: error: type defaults to 'int' in declaration of 'k' [-Wimplicit-int]
    1 | w[100000],n,k,g;
      |             ^
main.c:1:15: error: type defaults to 'int' in declaration of 'g' [-Wimplicit-int]
    1 | w[100000],n,k,g;
      |               ^
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
    2 | f(int p)
      | ^
main.c: In function 'f':
main.c:5:40: error: expected expression before 'return'
    5 |     for(int i=0;i<n;)g+w[i]>p?(g>0?c++:return k+1),g=0:g+=w[i++];
      |                                        ^~~~~~
main.c:5:57: error: lvalue required as left operand of assignment
    5 |     for(int i=0;i<n;)g+w[i]>p?(g>0?c++:return k+1),g=0:g+=w[i++];
      |                                                         ^~
main.c: At top level:
main.c:8:1: error: return type defaults to 'int' [-Wimplicit-int]
    8 | main()
      | ^~~~
main.c: In function 'main':
main.c:10:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   10 |     scanf("%d%d",&n,&k);
      |     ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | w[100000],n,k,g;
main.c:10:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   10 |     scanf("%d%d",&n,&k);
      |     ^~~~~
main.c:10:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:23:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   23 |     printf("%d\n",m);
      |     ^~~~~~
main.c:23:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:23:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:23:5: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include <stdio.h>
 
using namespace std;
 
#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 = s + T[i];
            i++;
            if(i == n) return n;
        }
    }
    return i;
}
 
int solve()
{
    long long left = 0;
    long long right = 100000 * 10000;
    long long 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() {
    scanf("%d %d", &n, &k);
    for(int i = 0; i < n; i++) {
        scanf("%lld", &T[i]);
    }
    int res = solve();
    printf("%lld\n", res);
    return 0;
}

Compiler output:
main.c:3:1: error: unknown type name 'using'
    3 | using namespace std;
      | ^~~~~
main.c:3:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
    3 | using namespace std;
      |                 ^~~
Language: C

#include <stdio.h>
#include <stdlib.h>

#define MAX_LUGGAGE_NUM    100000
#define MAX_TRUCK_NUM      100000
#define MAX_DATA_NUM        10000

#define OFF             0
#define ON              1




/***********************************************************************************
 ++module <main>
 ++outline
	main function
 ++arguments
	<>			<>					[]
 ++supp
 	<return>
 	  nothing
 ++end_module
************************************************************************************/
int main(void)
{
    int left = 0;
	int right;
	int mid;
	int sum = 0;
	int luggage_num;		/* luggage num */
	int truck_num;			/* truck num */
	int *weight_buff;		/* luggage weight buffer */
	int truck_point;
	int truck_max = 0;
	int min_value;
	int reply_count = 0;
	int temp;
	int loop = 0;
	int ans;
	
	scanf("%d %d", &luggage_num, &truck_num);			/* get luggage num and truck num */
	
	if((luggage_num <= MAX_LUGGAGE_NUM)					/* If luggage num is within max luggage num */
		&& (truck_num <= MAX_TRUCK_NUM))
	{
		weight_buff = (int*)malloc(luggage_num * sizeof(int));
		
		while(((scanf("%d", &(weight_buff[loop]))) != EOF) && (loop < luggage_num))
		{
			sum += weight_buff[loop];
			loop++;
		}
		
		right = sum;
		
		while(right - left > 1)
		{
	        mid = (right + left) / 2;
			ans = BinarySearch(weight_buff, luggage_num, truck_num, mid);
	        if(ans >= luggage_num)
			{
	            right = mid;
			}
			else
			{
	            left = mid + 1;
			}
		}
    }
    printf("%d\n",right);
	
    return 0;
}

static void BinarySearch(int *weight_buff, int luggage_num, int truck_num, int mid)
{
	int loop;
	int temp;
	int weight_point = 0;
	
	
	for(loop = 0; loop < truck_num; loop++ )
	{
		temp = 0;
		while((temp + weight_buff[weight_point] <= mid)
			&& (weight_point < luggage_num))
		{
			temp += weight_buff[weight_point];
			weight_point++;
		}
	}
	return weight_point;
}


Compiler output:
main.c: In function 'main':
main.c:60:31: error: implicit declaration of function 'BinarySearch' [-Wimplicit-function-declaration]
   60 |                         ans = BinarySearch(weight_buff, luggage_num, truck_num, mid);
      |                               ^~~~~~~~~~~~
main.c: At top level:
main.c:76:13: warning: conflicting types for 'BinarySearch'; have 'void(int *, int,  int,  int)'
   76 | static void BinarySearch(int *weight_buff, int luggage_num, int truck_num, int mid)
      |             ^~~~~~~~~~~~
main.c:76:13: error: static declaration of 'BinarySearch' follows non-static declaration
main.c:60:31: note: previous implicit declaration of 'BinarySearch' with type 'void(int *, int,  int,  int)'
   60 |                         ans = BinarySearch(weight_buff, luggage_num, truck_num, mid);
      |                               ^~~~~~~~~~~~
main.c: In function 'BinarySearch':
main.c:93:16: error: 'return' with a value, in function returning void [-Wreturn-mismatch]
   93 |         return weight_point;
      |                ^~~~~~~~~~~~
main.c:76:13: note: declared here
   76 | static void BinarySearch(int *weight_buff, int luggage_num, int truck_num, int mid)
      |             ^~~~~~~~~~~~
Language: C

#include <stdio.h>
int allocation(int *,int,int);
int check(int *,int,int,int);
int main(){
  int i,n,k,w[10000];
  long ans;
  scanf("%d%d",&n,&k);
  for(i=0;i<n;i++)scanf("%d",&w[i]);
  ans=allocation(w,n,k);
  printf("%d\n",ans);
  return 0;
}

int allocation(int *w,int n,int k){
  long left=0,right=1000000000,v;
  long mid;
  while(right-left>1){
    mid=(right+left)/2;
    v=check(w,n,k,mid);
    if(v>=n)right=mid;
    else left=mid;
  }
  return right;
}
int check(int *w,int n,int k,long P){
  int i,j=0,x;
  for(i=0;i<k;i++){
    x=0;
    while(x+w[j]<=P){
      x+=w[j];
      j++;
      if(n==j)return n;
    }
  }
  return j;
}


Compiler output:
main.c:25:5: error: conflicting types for 'check'; have 'int(int *, int,  int,  long int)'
   25 | int check(int *w,int n,int k,long P){
      |     ^~~~~
main.c:3:5: note: previous declaration of 'check' with type 'int(int *, int,  int,  int)'
    3 | int check(int *,int,int,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 ; 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:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int M, N;
cin >> N >> M;
    vector<int> books(N);
    for(int i=0; i<N; i++) {
      cin >> books[i];
    }
     
    int l = 1, r = 1500001;
    while(r - l > 1) {
      int m = (l+r)/2;
      int BPS = 0;
      for(int i=0; i<M; i++) {
    int size = m;
    for(;;) {
      if(BPS == N) break;
      if(size - books[BPS] < 0) break;
      size -= books[BPS++];
    }
    if(BPS == N) break;
      }
      if(BPS == N) {
    r = m;
      } else l = m;
    }
     
    cout << l+1 << endl;
 
   
  return 0;
}

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

int a[100000];
int ok(int M,int N,int C){
	int sum=0,ret=1,i=0;
	for(;i<N;i++){
		if(a[i]>M)return 0;
		sum+=a[i];
		if(sum>M)sum=a[i],ret++;
	}
	return ret<=C;
}
main(){
	int N,C;
	scanf("%d%d",&N,&C);
	for(int i=0;i<N;i++)scanf("%d",a+i);
	int l=0,h=1LL<<30;
	for(;l+1<h;){
		int m=(l+h)/2;
		if(ok(m,N,C))h=m;else l=m;
	}
	printf("%d\n",l+1);
	exit(0);
}

Compiler output:
main.c:11:1: error: return type defaults to 'int' [-Wimplicit-int]
   11 | main(){
      | ^~~~
main.c: In function 'main':
main.c:13:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   13 |         scanf("%d%d",&N,&C);
      |         ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int a[100000];
main.c:13:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   13 |         scanf("%d%d",&N,&C);
      |         ^~~~~
main.c:13:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:20:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   20 |         printf("%d\n",l+1);
      |         ^~~~~~
main.c:20:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:20:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:20:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:21:9: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
   21 |         exit(0);
      |         ^~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
  +++ |+#include <stdlib.h>
    1 | int a[100000];
main.c:21:9: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
   21 |         exit(0);
      |         ^~~~
main.c:21:9: note: include '<stdlib.h>' or provide a declaration of 'exit'
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:4: error: expected ';' before ':' token
   13 | i++:
      |    ^
      |    ;
a.cc: At global scope:
a.cc:31:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   31 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:34:11: error: expected initializer before 'solve'
   34 | llong ans solve();
      |           ^~~~~
a.cc:35:8: error: 'ans' was not declared in this scope; did you mean 'abs'?
   35 | cout <<ans << endl;
      |        ^~~
      |        abs
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:31:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   31 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:34:11: error: expected initializer before 'solve'
   34 | llong ans solve();
      |           ^~~~~
a.cc:35:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   35 | cout << ans << endl;
      |         ^~~
      |         abs
Language: C++

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

int n,k;
llong W[MAX];

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

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 >> W[i];
	llong ans = solve();
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int check(int)':
a.cc:16:33: error: expected primary-expression before '<' token
   16 |                 for(j = 0; sum =< p; j++)
      |                                 ^
Language: C++

#ifdef 0


#endif // 0

#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
using namespace std;
const int MAXN = (int) 1e5 + 10;
const int INF = (int) 0x3f3f3f3f;
typedef long long LL;

int n,k;
int w[MAXN];

bool is_judge(int x){
    int cnt=0,cur=0;
    int p=1;
    while(p<=n){
        while(p<=n){
            if(cur+w[p]>x) break;
            cur+=w[p++];
        }
        cur=0;
        cnt++;
    }
    return cnt<=k;
}

void work(){
    scanf("%d%d",&n,&k);
    int L=1,R=1000000000;
    for(int i=1;i<=n;i++){
        scanf("%d",&w[i]);
        L=max(L,w[i]);
    }
    int ans=0;
    while(L<=R){
        int mid=(L+R)>>1;
        if(is_judge(mid)){
            R=mid-1;
            ans=mid;
        }
        else{
            L=mid+1;
        }
    }
    printf("%d\n",ans);
}

int main(){
    work();
    return 0;
}





Compiler output:
a.cc:1:8: error: macro names must be identifiers
    1 | #ifdef 0
      |        ^
Language: C++

#include <iostream>

using namespace std;

int n, k;
int* w;

bool search(int x) {
  int cost = 0;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (w[i] > x)
      return false;
    cost += w[i];
    if (cost > x) {
      cost = w[i];
      cnt++;
      if (cnt == k)
        return false;
    }
  }
  return true;
}

int main() {
  cin >> n >> k;
  w = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> w[i];
  }
  
  int l = 0;
  int r = INT_MAX;

  while (l < r) {
    int m = (l + r) / 2;
    if (search(m)) 
      r = m;
    else
      l = m + 1;
  }

  cout << l << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:11: error: 'INT_MAX' was not declared in this scope
   33 |   int r = 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 <iostream>
#include "math.h"
using namespace std;

int n, k;
int* w;

bool search(int x) {
  int cost = 0;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (w[i] > x)
      return false;
    cost += w[i];
    if (cost > x) {
      cost = w[i];
      cnt++;
      if (cnt == k)
        return false;
    }
  }
  return true;
}

int main() {
  cin >> n >> k;
  w = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> w[i];
  }
  
  int l = 0;
  int r = INT_MAX;

  while (l < r) {
    int m = (l + r) / 2;
    if (search(m)) 
      r = m;
    else
      l = m + 1;
  }

  cout << l << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:11: error: 'INT_MAX' was not declared in this scope
   33 |   int r = INT_MAX;
      |           ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include "math.h"
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
using namespace std;
//#define __int64
int ta[100001];
__int64 n,k;
__int64 ok(__int64 x){
	__int64 cnt=1,now=0;
	int i=0;
	while(i<n){
	if(now+ta[i]<=x)now+=ta[i],i++;
	else now=0,cnt++;//オーバー
	if(cnt>k)return i;
	}
	if(cnt<=k)return n;
	else return 0;
}
int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++)scanf("%d",&ta[i]);
	__int64 a=0,b=20000000000000000,mid=0;
	for(int i=0;i<3000;i++){
	//cout<<a<<" "<<b<<" "<<mid<<endl;
	mid=(a+b)/2;
	int bi=ok(mid);
	if(bi<n)a=mid;//鋼板
	else if(bi>=n)b=mid;//前半
	}
	cout<<b<<endl;
	return 0;
}

Compiler output:
a.cc:12:1: error: '__int64' does not name a type; did you mean '__int64_t'?
   12 | __int64 n,k;
      | ^~~~~~~
      | __int64_t
a.cc:13:1: error: '__int64' does not name a type; did you mean '__int64_t'?
   13 | __int64 ok(__int64 x){
      | ^~~~~~~
      | __int64_t
a.cc: In function 'int main()':
a.cc:25:14: error: 'n' was not declared in this scope; did you mean 'yn'?
   25 |         cin>>n>>k;
      |              ^
      |              yn
a.cc:25:17: error: 'k' was not declared in this scope
   25 |         cin>>n>>k;
      |                 ^
a.cc:27:9: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
   27 |         __int64 a=0,b=20000000000000000,mid=0;
      |         ^~~~~~~
      |         __ynf64
a.cc:30:9: error: 'mid' was not declared in this scope
   30 |         mid=(a+b)/2;
      |         ^~~
a.cc:30:14: error: 'a' was not declared in this scope
   30 |         mid=(a+b)/2;
      |              ^
a.cc:30:16: error: 'b' was not declared in this scope
   30 |         mid=(a+b)/2;
      |                ^
a.cc:31:16: error: 'ok' was not declared in this scope
   31 |         int bi=ok(mid);
      |                ^~
a.cc:35:15: error: 'b' was not declared in this scope
   35 |         cout<<b<<endl;
      |               ^
Language: C++

#include <bits/stdc++.h>
??
using namespace std;
??
#define FOR(i,s,e) for((i)=(s);(i)<(int)(e);(i)++)
#define REP(i,e) FOR(i,0,e)
??
#define all(o) (o).begin(), (o).end()
#define psb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
??
typedef long long ll;
typedef pair<int, int> PII;
??
const double EPS = 1e-10;
??
const int N = 100000;
const int K = 100000;
int n, k;
int w[N], t[K];
??
bool check(int limit) {
????int i, j;
??
????for (i=0; i<n; i++)
????????if (limit < w[i]) return false;

  i = j = 0;
  while (i<n && j<k) {
    if (t[j] + w[i] < limit) 
      t[j] += w[i++];
    else if (t[j] + w[i] == limit)
      t[j++] = w[i++];
    else
      j++;
  }

  if (i<n && j==k)
    return false;
  else??
  ????return true;
}
??
int main() {
????int i;
????scanf("%d%d ", &n, &k);
????for (i=0; i<n; i++)
????????scanf("%d ", w+i);
????memset(t, 0, sizeof(t));
??
????int l = 0;
  int u = 0;
????for (i=0; i<n; i++) u += w[i];

????while (u-l > 1) {
????????int m = (l+u)/2;
????????if (check(m))
????????????u = m;
????????else
????????????l = m;
????}
??
????printf("%d\n", u);
??
????return 0;
}

Compiler output:
a.cc:2:1: error: expected unqualified-id before '?' token
    2 | ??
      | ^
a.cc:4:1: error: expected unqualified-id before '?' token
    4 | ??
      | ^
a.cc:13:9: error: 'pair' does not name a type
   13 | typedef pair<int, int> PII;
      |         ^~~~
a.cc:14:1: error: expected unqualified-id before '?' token
   14 | ??
      | ^
a.cc:16:1: error: expected unqualified-id before '?' token
   16 | ??
      | ^
a.cc:20:7: error: 'N' was not declared in this scope
   20 | int w[N], t[K];
      |       ^
a.cc:21:1: error: expected unqualified-id before '?' token
   21 | ??
      | ^
a.cc:43:1: error: expected unqualified-id before '?' token
   43 | ??
      | ^
Language: C++

#include<iostream>
using namespace std;
int n, m;
int a[101];
bool search(int v);
int main(){

		cin >> n >> m;
		for (int i = 0; i < n; i++){
			cin >> a[i];
		}
		int l, r;
		l = 0; r = 1 << 24;
		for (int i = 0; i < 100; i++){
			int mi = (l + r) / 2;
			if (search(mi))r = mi;
			else l = mi;
		}
		cout << r << endl;
}
bool search(int v){
	int n2=0, m2=0,b=0;
	while (n2 < n&&m2 < m){
		if (b + a[n2] <= v){
			b += a[n2];
			n2++;
		}
		else{
			b = 0;
			m2++;
		}
	}
	if (n2 == n&&m2 < m)return true;
	

Compiler output:
a.cc: In function 'bool search(int)':
a.cc:33:41: error: expected '}' at end of input
   33 |         if (n2 == n&&m2 < m)return true;
      |                                         ^
a.cc:21:19: note: to match this '{'
   21 | bool search(int v){
      |                   ^
a.cc:33:41: warning: control reaches end of non-void function [-Wreturn-type]
   33 |         if (n2 == n&&m2 < m)return true;
      |                                         ^
Language: C++

#include <iostream>

int value(int a[], int size, int p){
	int w = 0, k = 1;
	for (int i = 0; i < size; i++){
		if (w + a[i] <= p){
			w += a[i];
		}else{
			w = a[i];
			k++;
		}
	}
	return k;
}
int main(){
	int n, k;
	std::cin >> n >> k;
	int w[n];
	int max = 0; int sum = 0;
	for (int i = 0; i < n; i++){
		std::cin >> w[i];
		if (max < w[i]){
			max = w[i];
		}
		sum += w[i];
	}
	while (max != sum){
		int mid = (max + sum) / 2;
		if (value(w, n, mid) > k){
			max = mid + 1;
		}else{
			sum = mid;
		}
	}
	std::cout << max << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:29: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   35 |         std::cout << max << endl;
      |                             ^~~~
      |                             std::endl
In file included from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

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

int n, k;
int p = 0;
int w[100000];
bool use[100000];

bool test(int s){
	int u = 0;
	memset(use, 0, sizeof(use));
	for(int i=0;i<k;i++){
		int ss = s;
		for(int j=i;j<n && ss;j++){
			if (use[j]) continue;
			int ww =w[j];
			if (ss>=ww){
				ss -= ww;
				use[j] = true;
				u++;
			}
		}
	}
	return (u == n);
}	

int main()
{
	cin >> n;
	cin >> k;
	for (int i=0;i<n;i++){
		cin >> w[i];
	}
	
	sort(w, w+n, [](int a, int b) { return (a>b); });
		
	for (int s=w[0];s<n*w[0];s++) {
		if (test(s)){
			cout << s << endl;
			return 0;
		}
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'bool test(int)':
a.cc:12:9: error: 'memset' was not declared in this scope
   12 |         memset(use, 0, sizeof(use));
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <algorithm>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

// ALDS1_4.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//

#include "stdafx.h"
#include <map>
#include <iostream>
using namespace std;
void A()
{
	int S[10000];
	int T[500];
	int N;
	int Q;
	int C = 0;
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> S[i];
	}

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

	for (int i = 0; i < Q; i++)
	{
		for (int j = 0; j < N; j++)
		{
			if (T[i] == S[j])
			{
				C++;
				break;
			}
		}
	}

	cout << C << endl;
}

void B()
{
	int S[100001];
	int T[50000];
	int N;
	int Q;
	int C = 0;

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

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

	for (int i = 0; i < Q; i++)
	{
		int left = 0;
		int right = N;
		while (left < right)
		{
			int center = (left + right) / 2;

			if (T[i] == S[center])
			{
				C++;
				break;
			}

			if (T[i] > S[center])
			{
				left = center + 1;
			}
			else
			{
				right = center;
			}
		}
	}

	cout << C << endl;
}
/*long MAX = 1000000;
char a = 'A';
char c ='C';
char g = 'G';
char t = 'T';
bool table[1000000][20];

int toNumber(char ch)
{
	if (ch == 'A')
	{
		return 1;
	}
	else if (ch == 'C')
	{
		return 2;
	}
	else if (ch == 'G')
	{
		return 3;
	}
	else if (ch == 'T')
	{
		return 4;
	}
	else
	{
		return 0;
	}
}
int hash(int num,int i)
{
	return (hash1(num) + (i*hash2(num))) % MAX;
}

int hash1(int num)
{
	return num % MAX;
}
int hash2(int num)
{
	return num %(MAX - 1);
}

void insert(char data[])
{
	int sum = 0;
	for (int i = 0; i < strlen(data); i++)
	{
		sum += toNumber(data[i]);
	}

	for (int i = 0; i < strlen(data); i++)
	{
		table[sum][i] = data[i];
	}
}

void find(char data[])
{

}*/

void C()
{
	map<string, bool> dictionary;
	int N;
	scanf_s("%d", &N);
	//cin >> N;
	char command[20],data[20];
	for (int i = 0; i < N; i++)
	{
		scanf_s("%s", command, 20);
		scanf_s("%s", data, 20);
		//cin >> command;
		//cin >> data;

		if (command[0] == 'i')
		{
			string key = data;
			dictionary[key] = true;
		}
		else if (command[0] =='f')
		{
			string key = data;
			if (dictionary.find(key) == dictionary.end())
			{
				cout << "no" << endl;
			}
			else
			{
				cout << "yes" << endl;
			}
		}
	}

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

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

	long long left = 0;
	long long right = 100000 * 10000;
	long long mid = 0;
	while (left + 1 < right)
	{
		mid = (left + right) >> 1;
		int r = check(mid,w,n,k);
		if (r >= n)right = mid;
		else left = mid;
	}
	cout << right << endl;

}
int main()
{
	//A();
	//B();
	//C();
	D();
	return 0;
}

Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <map>
#include <iostream>
using namespace std;
void A()
{
	int S[10000];
	int T[500];
	int N;
	int Q;
	int C = 0;
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> S[i];
	}

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

	for (int i = 0; i < Q; i++)
	{
		for (int j = 0; j < N; j++)
		{
			if (T[i] == S[j])
			{
				C++;
				break;
			}
		}
	}

	cout << C << endl;
}

void B()
{
	int S[100001];
	int T[50000];
	int N;
	int Q;
	int C = 0;

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

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

	for (int i = 0; i < Q; i++)
	{
		int left = 0;
		int right = N;
		while (left < right)
		{
			int center = (left + right) / 2;

			if (T[i] == S[center])
			{
				C++;
				break;
			}

			if (T[i] > S[center])
			{
				left = center + 1;
			}
			else
			{
				right = center;
			}
		}
	}

	cout << C << endl;
}
/*long MAX = 1000000;
char a = 'A';
char c ='C';
char g = 'G';
char t = 'T';
bool table[1000000][20];

int toNumber(char ch)
{
	if (ch == 'A')
	{
		return 1;
	}
	else if (ch == 'C')
	{
		return 2;
	}
	else if (ch == 'G')
	{
		return 3;
	}
	else if (ch == 'T')
	{
		return 4;
	}
	else
	{
		return 0;
	}
}
int hash(int num,int i)
{
	return (hash1(num) + (i*hash2(num))) % MAX;
}

int hash1(int num)
{
	return num % MAX;
}
int hash2(int num)
{
	return num %(MAX - 1);
}

void insert(char data[])
{
	int sum = 0;
	for (int i = 0; i < strlen(data); i++)
	{
		sum += toNumber(data[i]);
	}

	for (int i = 0; i < strlen(data); i++)
	{
		table[sum][i] = data[i];
	}
}

void find(char data[])
{

}*/

void C()
{
	map<string, bool> dictionary;
	int N;
	scanf_s("%d", &N);
	//cin >> N;
	char command[20],data[20];
	for (int i = 0; i < N; i++)
	{
		scanf_s("%s", command, 20);
		scanf_s("%s", data, 20);
		//cin >> command;
		//cin >> data;

		if (command[0] == 'i')
		{
			string key = data;
			dictionary[key] = true;
		}
		else if (command[0] =='f')
		{
			string key = data;
			if (dictionary.find(key) == dictionary.end())
			{
				cout << "no" << endl;
			}
			else
			{
				cout << "yes" << endl;
			}
		}
	}

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

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

	long long left = 0;
	long long right = 100000 * 10000;
	long long mid = 0;
	while (left + 1 < right)
	{
		mid = (left + right) >> 1;
		int r = check(mid,w,n,k);
		if (r >= n)right = mid;
		else left = mid;
	}
	cout << right << endl;

}
int main()
{
	//A();
	//B();
	//C();
	D();
	return 0;
}

Compiler output:
a.cc: In function 'void C()':
a.cc:152:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
  152 |         scanf_s("%d", &N);
      |         ^~~~~~~
      |         scanf
Language: C++

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

//?????§????????????P?????¨??????k??°???????????????????????¶?????¨?????§?????????????????°(?????§??§n???)????????????
int C_num(int P,int k,vector<int> w){
  int i=0,cnt=0,sum,cnt=0;
  while(i<k){
    sum=0;
    for(int j=0;j<w.size();j++){
      if(sum+w[j]<=P){
        sum+=w[j];
        w[j]+=1000000000;
        cnt++;
      }
    }
    i++;
  }
  return cnt;
}

int solve(int k,vector<int> w,int n){
  int left=0;
  int right=10000*100000; //?????§?????????????????§??????
  int mid;
  while(right-left>1){
    mid=(right+left)/2;
    int v=C_num(mid,k,w,n);
    if(v>=n) right=mid;
    else left = mid;
  }
  return right;
}

int main(){
  vector<int> w;
  int n,k,temp;
  cin >> n >> k;
  for(int i=0;i<n;i++) {
    cin >> temp;
    w.push_back(temp);
  }
  int ans=solve(k,w,n);
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int C_num(int, int, std::vector<int>)':
a.cc:8:21: error: redeclaration of 'int cnt'
    8 |   int i=0,cnt=0,sum,cnt=0;
      |                     ^~~
a.cc:8:11: note: 'int cnt' previously declared here
    8 |   int i=0,cnt=0,sum,cnt=0;
      |           ^~~
a.cc: In function 'int solve(int, std::vector<int>, int)':
a.cc:29:16: error: too many arguments to function 'int C_num(int, int, std::vector<int>)'
   29 |     int v=C_num(mid,k,w,n);
      |           ~~~~~^~~~~~~~~~~
a.cc:7:5: note: declared here
    7 | int C_num(int P,int k,vector<int> w){
      |     ^~~~~
Language: C++

#include "iostream"

using namespace std;

int nes(int n, int w[10000], int m ) {
	int ne = 1;
	int x = 0;

	for (int i = 0; i < n; i++) {
		if( x+w[i] <= m ) x += w[i];
		else {
			ne++;
			x = w[i];
		}
	}
	return ne;
}

int main() {

	int n, k;
	int w[100000], max;

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

	int head, mid, tail;

	head = max;
	tail = 10000 * 100000 / k + ;
	mid = (head + tail) / 2;
	int ne;
	while( head != tail ) {

		ne = nes(n, w, mid);
		if (ne == k) break;
		else if (ne < k) tail = mid;
		else head = mid + 1;

		mid = (head + tail) / 2;
	}
	do {
		mid--;
		ne = nes(n, w, mid);
	} while (ne <= k && mid >= max);
	cout << mid+1 << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:37: error: expected primary-expression before ';' token
   35 |         tail = 10000 * 100000 / k + ;
      |                                     ^
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:3:19: error: expected ']' before ';' token
    3 | #define MAX 100000;
      |                   ^
a.cc:7:9: note: in expansion of macro 'MAX'
    7 | llong T[MAX];
      |         ^~~
a.cc:7:12: error: expected unqualified-id before ']' token
    7 | llong T[MAX];
      |            ^
a.cc: In function 'int check(llong)':
a.cc:13:28: error: 'T' 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(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:37:44: error: 'T' was not declared in this scope
   37 |         for (int i = 0; i < n; i++) cin >> T[i];
      |                                            ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstdio>
#include <queue>
using namespace std;

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

  int left = 0, right = INT_MAX;
  while(left + 10 < right){
    int mid = (left + right) / 2;
    int sum=0, track = k;
    int i;
    for(i=0;i<n;i++){
      if(sum + v[i] > mid){
        sum = 0;
        track--;
      }
      if(track < 1) break;
      sum += v[i];
    }
    if(i == n)
      right = mid;
    else 
      left = mid + 1;
  } 
  for(int val=left;val<right;val++){
    int sum=0, track = k;
    int i;
    for(i=0;i<n;i++){
      if(sum + v[i] > val){
        sum = 0;
        track--;
      }
      if(track < 1) break;
      sum += v[i];
    }
    if(track==1 && sum <= val){
      cout << val << endl;
      break;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:25: error: 'INT_MAX' was not declared in this scope
   20 |   int left = 0, right = INT_MAX;
      |                         ^~~~~~~
a.cc:11:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   10 | #include <queue>
  +++ |+#include <climits>
   11 | using namespace std;
Language: C++

#include <iostream>
#include <vector>

using namespace std;
int n, k;

bool check(vector<int>& w, int m)
{
	int cnt = 0;
	int sum = 0;
	for (int i = 0; i < n; ++i)
	{
		sum += w[i];
		while (sum > m)
		{
			sum = w[i];
			++cnt;
			if (cnt == k)
			{
				return(false);
			}
		}
	}
	return(true);
}

void solve()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> n >> k;
	vector<int> w(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> w[i];
	}
	int l = 0;
	int r = INT_MAX;
	while (l < r)
	{
		int mid = (l + r) / 2;		
		if (check(w, mid))
		{
			r = mid;
		}
		else
		{
			l = mid + 1;
		}
	}
	cout << l << endl;
}

int main()
{
	solve();
	return(0);
}

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

#include<iostream>
#include<climits>
using namespace std;
int max_arr( int arr[], int size )
{
	int max=int_min;
	for( int i=0; i<size; i++ ){
		max=( arr[i] > max )? arr[i] : max;
	}
	return max;
}
int min_arr( int arr[], int size )
{
	int min=int_max;
	for( int i=0; i<size; i++ ){
		min=( arr[i] < min )? arr[i] : min;
	}
	return min;
}
int sum_arr( int arr[], int size) 
{
	int sum=0;
	for( int i=0; i<size; i++ ){
		sum+= arr[i];
	}
	return sum;
}


int cancarry( int carrylim, int t_num, int w[], int w_num ){

	int w_i=0;
	for( int t_i=0; t_i<t_num; t_i++ ){
			int wsum=0;
		for( ; w_i<w_num; w_i++ ){
			if( wsum + w[w_i] <= carrylim ){
				wsum+= w[w_i];
			}else{
				break;
			}
		}

		if( w_i==w_num ){
			return w_num;
		}
	}
	return w_i;
}
		
int solve(int w[], int w_num, int t_num ){
	int carrylim_left= max_arr(w, w_num)-1, carrylim_middle=sum_arr(w, w_num);
	int carrylim_right=2*carrylim_middle - carrylim_left;


	while( carrylim_right > carrylim_left+1 ){
		carrylim_middle= (carrylim_left + carrylim_right) /2;
		int cancarry= canCarry( carrylim_middle, t_num, w, w_num );

//		cout<<"??????????????§????????? : "<<carrylim_middle<<endl;
//		cout<<"??°?????????????????° : "<<cancarry<<endl;
//		cout<<endl;


		if( cancarry >= w_num ){
			carrylim_right= carrylim_middle;
		}else if( cancarry < w_num ){
			carrylim_left=  carrylim_middle;
		}
	}
	return carrylim_right;
}

		



int main()
{
	int w_num, t_num;
	cin>>w_num>>t_num;
	int *w=new int[w_num];
	for( int i=0; i<w_num; i++ ) cin>>w[i];

	cout<<solve(w, w_num, t_num)<<endl;
}

Compiler output:
a.cc: In function 'int max_arr(int*, int)':
a.cc:6:17: error: 'int_min' was not declared in this scope
    6 |         int max=int_min;
      |                 ^~~~~~~
a.cc: In function 'int min_arr(int*, int)':
a.cc:14:17: error: 'int_max' was not declared in this scope
   14 |         int min=int_max;
      |                 ^~~~~~~
a.cc: In function 'int solve(int*, int, int)':
a.cc:57:31: error: 'canCarry' was not declared in this scope; did you mean 'cancarry'?
   57 |                 int cancarry= canCarry( carrylim_middle, t_num, w, w_num );
      |                               ^~~~~~~~
      |                               cancarry
Language: C++

ostream>
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 = s + T[i];
			i++;
			if (i == n) return n;
		}
	}
	return i;
}

llong solve() {
	llong left = 0;
	llong right = 10000 * 10000;
	llong mid;
	while (left < right) {
		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:1:1: error: 'ostream' does not name a type
    1 | ostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:35:9: error: 'cin' was not declared in this scope
   35 |         cin >> n >> k;
      |         ^~~
a.cc:38:9: error: 'cout' was not declared in this scope
   38 |         cout << ans << endl;
      |         ^~~~
a.cc:38:24: error: 'endl' was not declared in this scope
   38 |         cout << ans << endl;
      |                        ^~~~