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

#include <iostream>
#include <string>
#include <math.h>
#define N 1000000
#define M 100003
using namespace std;

void insert(string val);
bool find(string val);
int h(int, int);
int getNumber(char);
string hashTable[N];

int n;

int main(){

string com;
string val;

cin >> n;

for(int i=0; i<n; i++){
cin >> com;
cin >> val;
if(com[0] == 'i'){
insert(val);
}else if(com[0] == 'f'){
if(find(val) == true){
cout << "yes\n";
}else{
cout << "no\n";
}
}
}

return 0;

}

void insert(string val){

int code = 0;
int p = 1;
for(int i=0, len=val.size(); i<len; i++){
code += getNumber(val[i]) * p;
p *= 4;
}

for(int i=0; ;i++){
int key = h(code,i);
if(hashTable[key] == ""){
hashTable[key] = val;
break;
}
}

}

bool find(string val){

long long code = 0;
int p = 1;
for(int i=0, len=val.size(); i<len; i++){
code += getNumber(val[i]) * p;
p *= 4;
}

for(int i=0; ;i++){
int key = h(code,i);
if(hashTable[key] == val){
return true;
}else if(hashTable[key] == ""){
return false;
}
}

return false;

}

int h(int code, int i){
return ((code % M) + i * (1 + (code % (M-1)))) % M;
}

int getNumber(char val){

if(val == 'A') return 0;
if(val == 'C') return 1;
if(val == 'G') return 2;
if(val == 'T') return 3;

assert(false);
return 0;

}

Compiler output:
a.cc: In function 'int getNumber(char)':
a.cc:93:1: error: 'assert' was not declared in this scope
   93 | assert(false);
      | ^~~~~~
a.cc:4:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    3 | #include <math.h>
  +++ |+#include <cassert>
    4 | #define N 1000000
Language: C++

#include <iostream>
#include <string>
#include <math.h>
#define N 1000000
#define M 100003
using namespace std;

void insert(string val);
bool find(string val);
int h(int, int);
int getNumber(char);
string hashTable[N];

int n;

int main(){

string com;
string val;

cin >> n;

for(int i=0; i<n; i++){
cin >> com;
cin >> val;
if(com[0] == 'i'){
insert(val);
}else if(com[0] == 'f'){
if(find(val) == true){
cout << "yes\n";
}else{
cout << "no\n";
}
}
}

return 0;

}

void insert(string val){

int code = 0;
int p = 1;
for(int i=0, len=val.size(); i<len; i++){
code += getNumber(val[i]) * p;
p *= 4;
}

for(int i=0; i<N;i++){
int key = h(code,i);
if(hashTable[key] == ""){
hashTable[key] = val;
break;
}
}

}

bool find(string val){

int code = 0;
int p = 1;
for(int i=0, len=val.size(); i<len; i++){
code += getNumber(val[i]) * p;
p *= 4;
}

for(int i=0; i<N;i++){
int key = h(code,i);
if(hashTable[key] == val){
return true;
}else if(hashTable[key] == ""){
return false;
}
}

return false;

}

int h(int code, int i){
return ((code % M) + i * (1 + (code % (M-1)))) % M;
}

int getNumber(char val){

if(val == 'A') return 0;
if(val == 'C') return 1;
if(val == 'G') return 2;
if(val == 'T') return 3;

assert(false);
return 0;

}

Compiler output:
a.cc: In function 'int getNumber(char)':
a.cc:93:1: error: 'assert' was not declared in this scope
   93 | assert(false);
      | ^~~~~~
a.cc:4:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    3 | #include <math.h>
  +++ |+#include <cassert>
    4 | #define N 1000000
Language: C++

#include <iostream>
#include <string>
#include <math.h>
#define M 1000003
using namespace std;

void insert(string val);
bool find(string val);
int h(int, int);
int getNumber(char);
char hashTable[M][13];

int n;

int main(){

string com;
string val;

cin >> n;

for(int i=0; i<n; i++){
cin >> com;
cin >> val;
if(com[0] == 'i'){
insert(val);
}else if(com[0] == 'f'){
if(find(val) == true){
cout << "yes\n";
}else{
cout << "no\n";
}
}
}

return 0;

}

void insert(string val){

int code = 0;
int p = 1;
for(int i=0, len=val.size(); i<len; i++){
code += getNumber(val[i]) * p;
p *= 4;
}

int key;
for(int i=0; ;i++){
key = h(code,i);
if(hashTable[key] == ""){
hashTable[key] = val;
break;
}
}

}

bool find(string val){

int code = 0;
int p = 1;
for(int i=0, len=val.size(); i<len; i++){
code += getNumber(val[i]) * p;
p *= 4;
}

int key;
for(int i=0; ;i++){
key = h(code,i);
if(hashTable[key] == val){
return true;
}else if(hashTable[key] == ""){
return false;
}
}

return false;

}

int h(int code, int i){
return ((code % M) + i * (1 + (code % (M-1)))) % M;
}

int getNumber(char val){

if(val == 'A') return 0;
if(val == 'C') return 1;
if(val == 'G') return 2;
if(val == 'T') return 3;

return 9999;

}

Compiler output:
a.cc: In function 'void insert(std::string)':
a.cc:53:16: error: incompatible types in assignment of 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char [13]'
   53 | hashTable[key] = val;
      | ~~~~~~~~~~~~~~~^~~~~
Language: C++

#include <iostream>
#include <string.h>
#include <math.h>
#define M 1000003
using namespace std;

void insert(char* val);
bool find(char* val);
int h(int, int);
int getNumber(char);
char hashTable[M][14];
bool hashIsUsed[M];
bool myStrcmp(char* str1, char* str2);

int n;

int main(){

string com;
char val[14];

cin >> n;

for(int i=0; i<n; i++){
cin >> com;
cin >> val;
if(com[0] == 'i'){
insert(val);
}else if(com[0] == 'f'){
if(find(val) == true){
cout << "yes\n";
}else{
cout << "no\n";
}
}
}

return 0;

}

void insert(char* val){

int code = 0;
int p = 1;
for(int i=0, len=strlen(val); i<len; i++){
code += getNumber(*(val+i)) * p;
p *= 4;
}

int key;
for(int i=0; ;i++){
key = h(code,i);
if(hashIsUsed[key] != true){
	strcpy(hashTable[key],val);
	hashIsUsed[key] = true;
break;
}
}

}

bool find(char* val){

int code = 0;
int p = 1;
for(int i=0, len=strlen(val); i<len; i++){
code += getNumber(*(val+i)) * p;
p *= 4;
}

int key;
for(int i=0; ;i++){
key = h(code,i);
if(!myStrcmp(hashTable[key],val)){
return true;
}else if(hashIsUsed[key] != true){
return false;
}
}

return false;

}

bool myStrcmp(char* str1, char* str2){
	
	int len1 = strlen(str1);
	int len2 = strlen(str2);
	if(len1 != len2){
		return false;	
	}
	
	int i = 0;
	while(len1--){
		if(*(len1+i) != *(len2+i)){
			return false;
		}
		i++;
	}
	return true;
	
}

int h(int code, int i){
return ((code % M) + i * (1 + (code % (M-1)))) % M;
}

int getNumber(char val){

if(val == 'A') return 0;
if(val == 'C') return 1;
if(val == 'G') return 2;
if(val == 'T') return 3;

return 9999;

}

Compiler output:
a.cc: In function 'bool myStrcmp(char*, char*)':
a.cc:96:20: error: invalid type argument of unary '*' (have 'int')
   96 |                 if(*(len1+i) != *(len2+i)){
      |                    ^~~~~~~~~
a.cc:96:33: error: invalid type argument of unary '*' (have 'int')
   96 |                 if(*(len1+i) != *(len2+i)){
      |                                 ^~~~~~~~~
Language: C++

#include <iostream>
#include <string.h>
#include <math.h>
#define M 1000003
#define L 13
using namespace std;
 
void insert(char* val);
bool find(char* val);
int h(int, int);
int getNumber(char);

char hashTable[M][L];
bool hashIsUsed[M];
int codes[4][L];
 
int n;
 
int main(){
 
char com[7];
char val[L];
int p[L];
p[0] = 1;
for(int i=1; i<L; i++){
p[i] = p[i-1] * 4;
}
	
for(i=0; i<4; i++){
for(j=0; j<L; j++){
    codes[i][j] = i * p[j]; 
}
}
 
cin >> n;
 
while(n--){
cin >> com;
cin >> val;
if(com[0] == 'i'){
insert(val);
}else if(com[0] == 'f'){
if(find(val) == true){
cout << "yesn";
}else{
cout << "non";
}
}
}
 
return 0;
 
}
 
void insert(char* val){
 
int code = 0;
int p = 1;
	int len;
	int i;
	
for(i=0, len=strlen(val); i<len; i++){
code += codes[getNumber(*(val+i))][i];
}
 
int key;
for(int i=0; ;i++){
key = h(code,i);
if(hashIsUsed[key] != true){
    memcpy(hashTable[key],val,len);
    hashIsUsed[key] = true;
break;
}
}
 
}
 
bool find(char* val){
 
int code = 0;
int p = 1;
	int len;
	int i;
for(i=0, len=strlen(val); i<len; i++){
code += codes[getNumber(*(val+i))][i];
}
 
int key;
for(int i=0; ;i++){
key = h(code,i);
if(hashIsUsed[key] != true){
return false;
}else if(!strcmp(hashTable[key],val)){
return true;
}
}
 
return false;
 
}
 
int h(int code, int i){
return ((code % M) + i * (1 + (code % (M-1)))) % M;
}
 
int getNumber(char val){
  
return (val == 'A') ? 0 :
       (val == 'C') ? 1 :
       (val == 'G') ? 2 :
       (val == 'T') ? 3 : -1;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:5: error: 'i' was not declared in this scope
   29 | for(i=0; i<4; i++){
      |     ^
a.cc:30:5: error: 'j' was not declared in this scope
   30 | for(j=0; j<L; j++){
      |     ^
Language: C++


#include <cstdio>
#include <cstring>
using namespace std;

typedef unsigned int U;
U L=1<<21;
bool HA[L];
char T[256];

int main() {
    U n, s, t;
    char c;
    T['A'] = (char)1, T['C'] = (char)2, T['G'] = (char)3, T['T'] = (char)4;
    scanf("%d", &n);
    while ( getchar() != '\n' );
    for ( register U i = 0; i++ < n; ) {
        s = 0;
        t = 1;
        bool flag = ( c = getchar() ) == 'i';
        while ( ( c = getchar() ) != ' ' );
        while ( ( c = T[getchar()] ) != 0 ) {
            s += c * t;
            t *= 4;
        }
        if ( flag ) {
            HA[s] = true;
        } else {
            puts( HA[s] ? "yes" : "no" );
        }
    }
    return 0;
}

Compiler output:
a.cc:8:9: error: size of array 'HA' is not an integral constant-expression
    8 | bool HA[L];
      |         ^
a.cc: In function 'int main()':
a.cc:17:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   17 |     for ( register U i = 0; i++ < n; ) {
      |                      ^
Language: C++


#include <cstdio>
#include <cstring>
using namespace std;

typedef unsigned int U;
int L=1<<21;
bool HA[L];
char T[256];

int main() {
    U n, s, t;
    char c;
    T['A'] = (char)1, T['C'] = (char)2, T['G'] = (char)3, T['T'] = (char)4;
    scanf("%d", &n);
    while ( getchar() != '\n' );
    for ( register U i = 0; i++ < n; ) {
        s = 0;
        t = 1;
        bool flag = ( c = getchar() ) == 'i';
        while ( ( c = getchar() ) != ' ' );
        while ( ( c = T[getchar()] ) != 0 ) {
            s += c * t;
            t *= 4;
        }
        if ( flag ) {
            HA[s] = true;
        } else {
            puts( HA[s] ? "yes" : "no" );
        }
    }
    return 0;
}

Compiler output:
a.cc:8:9: error: size of array 'HA' is not an integral constant-expression
    8 | bool HA[L];
      |         ^
a.cc: In function 'int main()':
a.cc:17:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   17 |     for ( register U i = 0; i++ < n; ) {
      |                      ^
Language: C++

#include<iostream>
#include<string>
#include <bitset>
#include <fstream>
using namespace std;

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 0;
  return 3;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 4;
  }
  return sum;
}
	std::bitset<16*1024*1024> flg;

int main(){
	int n;
	std::istream & c_in = cin;
	string s;
	getline(c_in,s);
	sscanf(s.c_str(),"%d",&n);

	for(int i=0;i<n;++i){
		getline(c_in,s);

		int value;
		if (s[0] == 'i') {				//"insert x"
			sscanf(&(s[6]),"%d",&value);
			flg.set(::getKey(&(s[6])));
		} else //{						//find x
			if (flg.test(::getKey(&(s[4]))))
				printf("yes\n");
			else 
				printf("no\n");
	}
}

Compiler output:
a.cc: In function 'long long int getKey(char*)':
a.cc:18:20: error: 'strlen' was not declared in this scope
   18 |   for ( i = 0; i < strlen(str); i++ ){
      |                    ^~~~~~
a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <fstream>
  +++ |+#include <cstring>
    5 | using namespace std;
Language: C++

#include<iostream>
#include<string>
#include <bitset>
#include <fstream>
#include<string.h>
using namespace std;

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 0;
  return 3;
}

long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < ::strlen(str); i++ ){
	  sum *= 4;
    sum += getChar(str[i]);
  }
  return sum;
}
	std::bitset<16*1024*1024> flg;

int main(){
	int n;
//*
	ifstream myfile (_T("G:\\Users\\shuji\\Documents\\10.??????\\02.?????????\\it\\2012\\judge_u-aizu\\100\\100\\??\???\\SearchIII-in9.txt"));
//	ifstream myfile (_T("G:\\Users\\shuji\\Documents\\10.??????\\02.?????????\\it\\2012\\judge_u-aizu\\100\\100\\??\???\\SearchIII-in2.txt"));
	if (!myfile.is_open())
	{
		return 1;
	}
	std::istream & c_in = myfile;
/*/
	std::istream & c_in = cin;
//*/
	string s;
	getline(c_in,s);
	sscanf(s.c_str(),"%d",&n);

	for(int i=0;i<n;++i){
		getline(c_in,s);

		int value;
		if (s[0] == 'i') {				//"insert x"
			sscanf(&(s[6]),"%d",&value);
			flg.set(::getKey(&(s[6])));
		} else //{						//find x
			if (flg.test(::getKey(&(s[4]))))
				printf("yes\n");
			else 
				printf("no\n");
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:26: error: '_T' was not declared in this scope
   29 |         ifstream myfile (_T("G:\\Users\\shuji\\Documents\\10.??????\\02.?????????\\it\\2012\\judge_u-aizu\\100\\100\\??\???\\SearchIII-in9.txt"));
      |                          ^~
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

#define M 1009//999983 //or 1000003
#define NIL (-1)
#define L 14

char H[M][L]; /* Hash Table */

int getChar(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;
}

/* convert a string into an integer value */
long long getKey(char str[]){
    long long sum = 0, p = 1, i;
    for ( i = 0; i < strlen(str); i++ ){
        sum += p*(getChar(str[i]));
        p *= 5;
    }
    return sum;
}

int h1(int key){
    return key % M;
}
int h2(int key){
    int c=397;
    return (c - key % c) % M;
}

int find(char str[]){
    int key = getKey(str);
    int para1 = h1(key);
    int para2 = h2(key);
    while (1) {
        int i=0;
        int hash = (para1 + i * para2))%M;
        if (strcmp(H[hash], str) == 0 ) {
            return 1;
        }
        if (H[hash][0] == '\0') {
            return 0;
        }
        i++;
    }
    
}

void insert(char str[]){
    int key = getKey(str);
    int para1 = h1(key);
    int para2 = h2(key);
    while (1) {
        int i=0;
        int hash = (para1 + i * para2)%M;
        if (H[hash][0] == '\0') {
            strcpy(H[hash] ,str);
            return;
        }
        i++;
    }
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
        scanf("%s %s", com, str);
        
        if ( com[0] == 'i' ){
            insert(str);
        } else {
            if (find(str)){
                printf("yes\n");
            } else {
                printf("no\n");
            }
        }
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int find(char*)':
a.cc:44:39: error: expected ',' or ';' before ')' token
   44 |         int hash = (para1 + i * para2))%M;
      |                                       ^
a.cc: In function 'int getChar(char)':
a.cc:18:1: warning: control reaches end of non-void function [-Wreturn-type]
   18 | }
      | ^
Language: C++

#include <cstdio>
#include <string>
#include <unordered_set>
using namespace std;

int main() {
    int N; scanf("%d", &N);
    unordered_set<string> histo;
    while(N--) {
        char s[80], t[80];
        scanf("%s%s", s, t);
        if(strcmp(s, "insert") == 0) {
            histo.emplace(s);
        }
        else {
            printf("%s\n", histo.count(string(t)) ? "yes" : "no");
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: 'strcmp' was not declared in this scope
   12 |         if(strcmp(s, "insert") == 0) {
      |            ^~~~~~
a.cc:4:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <unordered_set>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
#include <cctype>

using namespace std;

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

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

	int n;
	cin >> n;

	vector<string> S;

	string st1, st2;

Compiler output:
a.cc: In function 'int main()':
a.cc:36:25: error: expected '}' at end of input
   36 |         string st1, st2;
      |                         ^
a.cc:27:1: note: to match this '{'
   27 | {
      | ^
Language: C++

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

int main(){
 int n = 0;
 cin >> n;
 vector<string> dictionary;
 vector<string> answer;
 for(int i = 0; i < n; i++){
  string buf1, buf2;
  cin >> buf1 >> buf2;
  if(buf1 == "insert"){
   //if( dictionary.end() == find(dictionary.begin(), dictionary.end(), buf1)){
    dictionary.push_back(buf2);
    sort(dictionary.begin(), dictionary.end());
   }
  }else{
   if(dictionary.end() != find(dictionary.begin(), dictionary.end(), buf2)){
    cout << "yes" << '\n';
   }else{
    cout << "no" << '\n';
   }
  }
 }
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:4: error: 'else' without a previous 'if'
   19 |   }else{
      |    ^~~~
a.cc:20:70: error: 'buf2' was not declared in this scope
   20 |    if(dictionary.end() != find(dictionary.begin(), dictionary.end(), buf2)){
      |                                                                      ^~~~
a.cc: At global scope:
a.cc:27:2: error: expected unqualified-id before 'return'
   27 |  return 0;
      |  ^~~~~~
a.cc:28:1: error: expected declaration before '}' token
   28 | }
      | ^
Language: C++

#include <cstdio>
#include<iostream>
#include<string>
#include<algorithm>
 
#define NMAX 10000
#define ai (max+min)/2
using namespace std;
  
int main(void){

    std::ios_base::sync_with_stdio(false);
    string disc[NMAX];
    string iof,str;
    int cnt=0;
 
    cin>>n;
 
    for(int i=0;i<n;i++){
        cin>>iof>>str;
        if(iof=="insert"){
            disc[cnt]=str;
            cnt++;  
        }
        else if(iof=="find"){
			if(find(disc,disc+cnt,str)!=disc+cnt) cout<<"yes"<<endl;
			else cout<<"no"<<endl;
        }
    }
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:10: error: 'n' was not declared in this scope
   17 |     cin>>n;
      |          ^
Language: Java

class Main {
    public static void main(String[] args) {
        try {
                BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            String str = br.readLine();
            int n = Integer.parseInt(str.split(" ")[0]);
            int k = Integer.parseInt(str.split(" ")[1]);
            int[] nimotu = new int[n];
            int totalWeight = 0;
            for (int i = 0; i < n; i++) {
                nimotu[i] = Integer.parseInt(br.readLine());
                totalWeight += nimotu[i];
            }
            int aver = totalWeight / k;
            int maxweight = aver;
            int tracknum;
            while(maxweight <= totalWeight){
                int weight = 0;
                tracknum = 1;
                boolean flg = true;
                for(int i = 0;i < n && tracknum <= k;) {
                    if(weight + nimotu[i] <= maxweight){
                        weight += nimotu[i];
                        i++;
                    } else if(weight > 0){
                        if(maxweight < weight){
                            maxweight = weight;
                        }
                        weight = 0;
                        tracknum++;
                    } else {
                        flg = false;
                        break;
                    }
                }
                if(tracknum <= k && flg){
                    System.out.println(maxweight);
                    break;
                }
                maxweight++;
            }
        } catch (IOException e) {
            System.out.println("error");
        }
    }
}

Compiler output:
Main.java:4: error: cannot find symbol
                BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                ^
  symbol:   class BufferedReader
  location: class Main
Main.java:4: error: cannot find symbol
                BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                                        ^
  symbol:   class BufferedReader
  location: class Main
Main.java:4: error: cannot find symbol
                BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                                                           ^
  symbol:   class InputStreamReader
  location: class Main
Main.java:42: error: cannot find symbol
        } catch (IOException e) {
                 ^
  symbol:   class IOException
  location: class Main
4 errors
Language: Java

import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main_allocation {

  static final int N = 100000;
  static final int K = 100000;
  static int n, k;
  static int w[], c[];

  public static boolean check(int lmt) {
    int i, j;

    for (i=0; i<n; i++)
      if (lmt < w[i]) return false;

    Arrays.fill(c, 0);
    int full = -1;
    for (i=0; i<n; i++) {
      boolean is_put = false;
      for (j=full+1; j<k; j++) {
        if (lmt < c[j] + w[i])
          full++; 
        else {
          c[j] += w[i];
          if (c[j] == lmt) full++;
          is_put = true;
          break;
        }
      }
      if (!is_put) return false;
    }

    return true;
  }

  public static void main(String[] args) {
    int i;
    Scanner sc = new Scanner(System.in); 
    n = Integer.parseInt(sc.next());
    w = new int[n];
    k = Integer.parseInt(sc.next());
    c = new int[k];
    for (i=0; i<n; i++)
      w[i] = Integer.parseInt(sc.next());

    Arrays.fill(c, 0);

    //?±?????????????(l, u]????????????????????¨??????????????¢?´¢
    int l = 0, 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;
    }

    System.out.println(u);
  }
}

Compiler output:
Main.java:7: error: class Main_allocation is public, should be declared in a file named Main_allocation.java
public class Main_allocation {
       ^
1 error
Language: Java

import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main_allocation {

  static final int N = 100000;
  static final int K = 50000;
  static int n, k;
  static int w[], t[];

  public static boolean check_load(int limit) {
    int i, j;

    for (i=0; i<n; i++)
      if (limit < w[i]) return false;

    Arrays.fill(t, 0);
    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++;
    }

    return (i<n && j==k) ? false : true;
  }

  public static void main(String[] args) {
    int i;
    Scanner sc = new Scanner(System.in); 
    n = Integer.parseInt(sc.next());
    w = new int[n];
    k = Integer.parseInt(sc.next());
    t = new int[k];
    for (i=0; i<n; i++)
      w[i] = Integer.parseInt(sc.next());

    int l = 0, u = 0;
    for (i=0; i<n; i++) u += w[i];
    while (u-l > 1) {
      int m = (l+u)/2;
      if (check_load(m))
        u = m;
      else
        l = m;
    }
    System.out.println(u);
  }
}

Compiler output:
Main.java:7: error: class Main_allocation is public, should be declared in a file named Main_allocation.java
public class Main_allocation {
       ^
1 error
Language: Java

import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main_allocation {

  static final int N = 100000;
  static final int K = 50000;
  static int n, k;
  static int w[], t[];

  public static boolean check_load(int limit) {
    int i, j;

    for (i=0; i<n; i++)
      if (limit < w[i]) return false;

    Arrays.fill(t, 0);
    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++;
    }

    return (i==n) ? true : false;
  }

  public static void main(String[] args) {
    int i;
    Scanner sc = new Scanner(System.in); 
    n = Integer.parseInt(sc.next());
    w = new int[n];
    k = Integer.parseInt(sc.next());
    t = new int[k];
    for (i=0; i<n; i++)
      w[i] = Integer.parseInt(sc.next());

    int l = 0, u = 0;
    for (i=0; i<n; i++) u += w[i];
    while (u-l > 1) {
      int m = (l+u)/2;
      if (check_load(m))
        u = m;
      else
        l = m;
    }
    System.out.println(u);
  }
}

Compiler output:
Main.java:7: error: class Main_allocation is public, should be declared in a file named Main_allocation.java
public class Main_allocation {
       ^
1 error
Language: Java

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(new System.in));
		// BufferedReader br = new BufferedReader(new FileReader("in1.txt"));
		// BufferedReader br = new BufferedReader(new FileReader("in2.txt"));
		String[] line = br.readLine().split(" ");
		int n = Integer.parseInt(line[0]);
		int k = Integer.parseInt(line[1]);
		List<Integer> w = new ArrayList<Integer>();
		for (int i = 0; i < n; i++)
			w.add(Integer.parseInt(br.readLine()));
		
		// O(kn^2)?????¢?????´??????????????????????????????...
		List<List<Integer>> P = new ArrayList<List<Integer>>();
		List<Integer> P0 = new ArrayList<Integer>();
		P0.add(w.get(0));
		for (int j = 1; j < n; j++)
			P0.add(P0.get(j - 1) + w.get(j));
		P.add(P0);
		for (int i = 1; i < k; i++) {
			List<Integer> Pk = new ArrayList<Integer>();
			for (int j = 0; j < n; j++) {
				int min = P.get(i - 1).get(j);
				int sum = 0;
				for (int l = 0; l < j; l++) {  // j??????????????????????????????l+1???????????????
					sum += w.get(j - l);
					if (min < sum)
						break;
					min = Math.max(P.get(i - 1).get(j - l - 1), sum);
				}
				Pk.add(min);
			}
			P.add(Pk);
		}
		
		System.out.println(P.get(k - 1).get(n - 1));
	}
}

Compiler output:
Main.java:3: error: '(' or '[' expected
		BufferedReader br = new BufferedReader(new InputStreamReader(new System.in));
		                                                                          ^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Allocation {
    public static void main (String[] args) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String[] inputs = br.readLine().split(" ");
	int n = Integer.parseInt(inputs[0]);
	int k = Integer.parseInt(inputs[1]);
	int[] w = new int[n];
	int max = 0;
	for (int i = 0; i < n; i++) {
	    w[i] = Integer.parseInt(br.readLine());
	    if (max < w[i]) {
		max = w[i];
	    }
	}

	int p = max, sum, cnt;
	while (true) {
	    sum = 0;
	    cnt = 1;
	    for (int i = 0; i < n; i++) {
		if (sum + w[i] > p) {
		    cnt++;
		    sum = w[i];
		} else {
		    sum += w[i];
		}
		if (cnt > k && i < n) {
		    p++;
		    break;
		}
	    }
	    if (cnt == k) {
		break;
	    }
	}
	System.out.println(p);
    }
}

Compiler output:
Main.java:4: error: class Allocation is public, should be declared in a file named Allocation.java
public class Allocation {
       ^
1 error
Language: Java

public class Main
{
	public static void main(String[] args)
	{
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		int k=scan.nextInt();
		int[] data=new int[n];
		for(int i=0;i<n;i++){
			data[i]+=scan.nextInt();
		}
		System.out.println(load(data,0,new int[k]));
		scan.close();
	}
	private static int load(int[] data,int next,int[] track)
	{
		if(data.length<=next){
			/*if(max(track)==10){
				printTracks(track);
			}*/
			return max(track);
		}else{
			int min=Integer.MAX_VALUE;
			int w=0;
			for(int i=0;i<track.length;i++){
				int[] tmp=Arrays.copyOf(track, track.length);
				tmp[i]+=data[next];
				w=load(data,next+1,tmp);
				if(i==0){
					min=w;
				}else{
					if(w<min){
						min=w;
					}
				}
			}
			return min;
		}
	}
/*
	private static void printTracks(int[] track)
	{
		int sum=0;
		for(int i=0;i<track.length;i++){
			System.out.print(track[i]+" ");
			sum+=track[i];
		}
		System.out.print(sum);
		System.out.println();
	}
*/
	private static int max(int[] track)
	{
		int max=0;
		for(int i=0;i<track.length;i++){
			if(max<track[i]){
				max=track[i];
			}
		}
		return max;
	}
}

Compiler output:
Main.java:5: error: cannot find symbol
		Scanner scan=new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
		Scanner scan=new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
Main.java:26: error: cannot find symbol
				int[] tmp=Arrays.copyOf(track, track.length);
				          ^
  symbol:   variable Arrays
  location: class Main
3 errors
Language: Java

mport java.util.*;
public class Main {	
	public static int check(long p,int[] T,int k,int n){
		int i =0;
		for(int j=0;j<k;j++){
			long  s = 0;
			while(s+T[i]<=p){
				s +=T[i];
				i++;
				if(i==n) return n;
			}
		}
		return i ;
	}
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n,k;
		n = sc.nextInt();
		k = sc.nextInt();
		int[] T = new int[n];
		for(int i=0;i<n;i++){
			T[i] = sc.nextInt();
		}
		long l=0;
		long r = 100000*10000;
		long mid=0 ;
		while(r-l>1){
			 mid = l+(r-l)/2;
			int v = check(mid,T,k,n);
			if(v>=n) r=mid;
			else l = mid;
		}
		System.out.println(mid);
		
	}
}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
mport java.util.*;
^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;

/*
????????????????????? wi(i=0,1,...n???1) ??? n ??????????????????????????????????????¢????????????????????????????????????????????????????????? k ??°????????????????????????????????????????????????????????£?¶??????? 0 ?????\??????????????????????????¨?????§??????????????????????????????????????????????????????????????§????????? P ????¶?????????????????????????????????§????????? P ?????????????????????????????§??±?????§??????

n ???k???wi ???????????????????????§?????????????????????????????????????????????????????§????????? P ???????°????????±???????????????°????????????????????????????????????
??\???

??????????????????????????° n ??¨?????????????????° k ????????????????????§??????????????????????¶???? n ?????? n ????????´??° wi ?????????????????????????????????????????????
??????

P ???????°???????????????????????????????????????????
??¶?´?

1???n???100,000
1???k???100,000
1???wi???10,000
*/
public class Main {
    
    public statics void main(String[] args){
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] tmp;
        int ttl = 0;
        tmp = br.readLine().split(" ");
        int n = tmp[0];
        int k = tmp[1];
//        ??????????????????????????´????????°
        int M = n/k;
        int[] w = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = Integer.parseInt(br.readLine());
            ttl += w[i];
        }
        int ave = ttl/n;
        System.out.println(ave);
        
    }
}

Compiler output:
Main.java:22: error: <identifier> expected
    public statics void main(String[] args){
                  ^
1 error
Language: Java

import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] array = new int[k];
        int input = 0;
        for(int i = 0; i < n; i++){
            input = sc.nextInt();
            int minIndex = 0;
            for(int j = 1; j < k; j++){
                if(k[minIndex] > k[j]){
                    minIndex = j;
                }
            }
            k[minIndex] += input;
        }
        
        int max = k[0];
        for(int i = 0; i < k; i++){
            if(max < k[i]){
                max = k[i];
            }
        }
        
        System.out.println(max);
    }
} 


Compiler output:
Main.java:14: error: array required, but int found
                if(k[minIndex] > k[j]){
                    ^
Main.java:14: error: array required, but int found
                if(k[minIndex] > k[j]){
                                  ^
Main.java:18: error: array required, but int found
            k[minIndex] += input;
             ^
Main.java:21: error: array required, but int found
        int max = k[0];
                   ^
Main.java:23: error: array required, but int found
            if(max < k[i]){
                      ^
Main.java:24: error: array required, but int found
                max = k[i];
                       ^
6 errors
Language: Java

import java.util.Scanner;

public class ALDS1_4_D_Allocation {
    // public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] w = new int[n];

        int minP = 0;
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
            minP = Math.max(minP, w[i]);
        }

        int p = minP;
//        U.println("minP: " + minP);
        while (true) {
            int kNeeded = 1;
            int remainedP = p;

            for (int i = 0; i < n; i++) {
//                U.println("kN: " + kNeeded + ", rP: " + remainedP + ", i: " + i);
//                U.println("\t w[i]: " + w[i]);
                if (remainedP >= w[i]) {
                    remainedP -= w[i];
                } else {
                    kNeeded++;
                    remainedP = p - w[i];
                }
            }
//            U.println("kNeeded: " + kNeeded);
            if (kNeeded <= k)
                break;
            p++;
        }

        System.out.println(p);
    }
}


Compiler output:
Main.java:3: error: class ALDS1_4_D_Allocation is public, should be declared in a file named ALDS1_4_D_Allocation.java
public class ALDS1_4_D_Allocation {
       ^
1 error
Language: Java


import java.util.Scanner;

import common.U;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] w = new int[n];

        long minP = 0;
        long maxP = 0;
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
            minP = Math.max(minP, w[i]);
            maxP += w[i];
        }

        // kは固定して、pをminPからmaxPまで調べる。
        // tempN = f(p, k, w) が初めてn以上になるpを求める。
        long midP = 0;
        while (maxP > minP) {
            midP = (maxP + minP) / 2;
            int tempN = f(midP, k, w);
            
            if (tempN < n) {
                maxP = midP - 1;
                
            } else if (tempN > n) {
                minP = midP + 1;
            } else {
                while (tempN == n && midP >= minP) {
                    midP--;
                    tempN = f(midP, k, w);
                }
                midP++;
                break;
            }
        }
        System.out.println(midP);
    }
    
    static int f(long p, int k, int[] w) {
        int  remainK = k;
        long remainP = p; // トラック1台あたりの容量
        
        int i = 0;
        for (i = 0; i < w.length; i++) {
            if (remainP < w[i]) {
                remainK--;
                remainP = p - w[i];
            } else {
                remainP -= w[i];
            }
            if (remainK <= 0) {
                break;
            }
        }
        return i;
    }
}


Compiler output:
Main.java:4: error: package common does not exist
import common.U;
             ^
1 error
Language: Java

import java.util.*;

class Main {
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int  num = scanner.nextInt();//要素数
		int  truck = scanner.nextInt();//トラック数
		
		Allocation(num, truck, scanner);
		
		scanner.close();
	}

	public static void Allocation(int num, int truck, Scanner scanner){
		int[] array = new int[num];
		int sum = 0;
		int ave;
		int capacity = 0;
		int sub = 0;
		long max = 0;
		
		//要素を作りながら足す
		for (int i = 0; i < num; i ++) {
			array[i] = scanner.nextInt();
			sub += array[i];
			max = Math.max(max,array[i]);
		}
		
		//2分探索準備
		long left = max;
		long rigft = sub;
		
		
		//探索
		while (left < right) {
			long p = (left+right)/2;
			int id = 0;
			long sum = 0;
			for (int i = 0; i < num; i ++) {
				if (sum + array[i] > p) {
					sum = array[i];
					id ++;
				}else {
					sum += array[i];
				}
				if (id == truck){
					break;
				}
			}
			if (id == truck){
				left = p + 1;
			}else{
				right = p;
			}
		}
		//出力
		System.out.println(left);
		
	}
}


Compiler output:
Main.java:35: error: cannot find symbol
		while (left < right) {
		              ^
  symbol:   variable right
  location: class Main
Main.java:36: error: cannot find symbol
			long p = (left+right)/2;
			               ^
  symbol:   variable right
  location: class Main
Main.java:38: error: variable sum is already defined in method Allocation(int,int,Scanner)
			long sum = 0;
			     ^
Main.java:53: error: cannot find symbol
				right = p;
				^
  symbol:   variable right
  location: class Main
4 errors
Language: Java

package drm;

import java.util.Scanner;

public class Allocation {
	static int n;
	static int k;
	static int[] weight;
	public Allocation(int n,int k,int[] weight) {
		this.n= n;
		this.k = k;
		this.weight = weight;
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();	
		int[] weight = new int[n];
		int total = 0;
		for(int i=0;i<n;i++) {
			weight[i] = sc.nextInt();
			total+=weight[i];
		}
		
		Allocation al = new Allocation(n,k,weight);
//		System.out.println(al.check(9));
		
		int p = al.binarySearch(1, total);
		System.out.println(p);
		
		
		
		

	}
	
	public static int binarySearch(int start,int end) {
		int mid;
		mid = (start + end)/2;
		if(check(mid-1) == true) {
			
			  return binarySearch(start, mid-1);
		}else if(check(mid+1) == false) {
			return binarySearch(mid+1,end);
		}else {
			return mid;
		}
		
		
	}
	
	public static boolean check(int p) {
		int next = 0;
		
		for(int i=0;i<k;i++) {	
			int max = 0;
			for(int j=next;j<n;j++) {
				max = max+weight[j];
				if(max>p) {
					next = j;
					break;
				}else if(max<=p && j==n-1) {
					return true;
				}
			}
		}
		return false;
	}

}



Compiler output:
Main.java:5: error: class Allocation is public, should be declared in a file named Allocation.java
public class Allocation {
       ^
1 error
Language: Java



import java.util.Scanner;

public class Main {
	static int n;
	static int k;
	static int[] weight;
	public Allocation(int n,int k,int[] weight) {
		this.n= n;
		this.k = k;
		this.weight = weight;
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();	
		int[] weight = new int[n];
		int total = 0;
		for(int i=0;i<n;i++) {
			weight[i] = sc.nextInt();
			total+=weight[i];
		}
		
		Allocation al = new Allocation(n,k,weight);
//		System.out.println(al.check(9));
		
		int p = al.binarySearch(1, total);
		System.out.println(p);
		
		
		
		

	}
	
	public static int binarySearch(int start,int end) {
		int mid;
		mid = (start + end)/2;
		if(check(mid-1) == true) {
			
			  return binarySearch(start, mid-1);
		}else if(check(mid+1) == false) {
			return binarySearch(mid+1,end);
		}else {
			return mid;
		}
		
		
	}
	
	public static boolean check(int p) {
		int next = 0;
		
		for(int i=0;i<k;i++) {	
			int max = 0;
			for(int j=next;j<n;j++) {
				max = max+weight[j];
				if(max>p) {
					next = j;
					break;
				}else if(max<=p && j==n-1) {
					return true;
				}
			}
		}
		return false;
	}

}



Compiler output:
Main.java:9: error: invalid method declaration; return type required
	public Allocation(int n,int k,int[] weight) {
	       ^
1 error
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<n;i++){
             scanf("%d",&cab[i]);
             {
      ans=solve();
      printf("%d\n",ans);

      return 0;
      }

 long longint 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 um_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:14:17: error: 'n' undeclared (first use in this function)
   14 |       for(i=0;i<n;i++){
      |                 ^
main.c:14:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:23:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'check'
   23 |  long longint check(int max_burd){
      |               ^~~~~
main.c:23:21: error: expected expression before 'int'
   23 |  long longint check(int max_burd){
      |                     ^~~
main.c:23:34: error: expected ';' before '{' token
   23 |  long longint check(int max_burd){
      |                                  ^
      |                                  ;
main.c:54:10: error: expected declaration or statement at end of input
   54 |          }
      |          ^
main.c:54:10: error: expected declaration or statement at end of input
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 longint 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 um_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:23:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'check'
   23 |  long longint check(int max_burd){
      |               ^~~~~
main.c:23:21: error: expected expression before 'int'
   23 |  long longint check(int max_burd){
      |                     ^~~
main.c:23:34: error: expected ';' before '{' token
   23 |  long longint check(int max_burd){
      |                                  ^
      |                                  ;
main.c:54:10: error: expected declaration or statement at end of input
   54 |          }
      |          ^
main.c:54:10: error: expected declaration or statement at end of input
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 um_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 'solve':
main.c:45:14: error: 'num_pie' undeclared (first use in this function); did you mean 'um_pie'?
   45 |              num_pie=check(mid);
      |              ^~~~~~~
      |              um_pie
main.c:45:14: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:54:10: error: expected declaration or statement at end of input
   54 |          }
      |          ^
main.c:54:10: error: expected declaration or statement at end of input
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:10: error: expected declaration or statement at end of input
   54 |          }
      |          ^
main.c:54:10: error: expected declaration or statement at end of input