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

#include <bits/stdc++.h>
using namespace std;
#define Rep(i,N) for(int i = 0; i < N; i++)

int main()
{
  string S, W;
  while(cin >> S >> W) {
    int dp[4005] = {0};
    int maxv = 0;
    Rep(i,W.size()) {
      for(int j = S.size(); j > 0; j--) {
	if(S[j - 1] == W[i]) {
	  dp[j] = dp[j - 1] + 1;
	  maxv = max(maxv, dp[j]);
	} else dp[j] = 0;
      }
    }
  }
  cout << maxv << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:11: error: 'maxv' was not declared in this scope
   20 |   cout << maxv << endl;
      |           ^~~~
Language: C++

#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<cstdlib>
#include<list>
#include<set>
#include<numeric>

#define MOD 1000000007

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

char a[4010], b[4010];
int dp[4010][4010];

int main()
{
	while (cin >> a) {
		cin >> b;
		int len_a = strlen(a);
		int len_b = strlen(b);
		for (int i = 0; i <= len_a; i++)
			for (int j = 0; j <= len_b; j++)
				dp[i][j] = 0;
		for (int i = 0; i < len_a; i++) {
			for (int j = 0; j < len_b; j++) {
				if (a[i] == b[j])
					dp[i + 1][j + 1] = dp[i][j] + 1;
			}
		}
		int ans = 0;
		for (int i = 0; i <= len_a; i++)
			for (int j = 0; j <= len_b; j++)
				ans = max(ans, dp[i][j]);
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:29: error: 'strlen' was not declared in this scope
   29 |                 int len_a = strlen(a);
      |                             ^~~~~~
a.cc:15:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   14 | #include<numeric>
  +++ |+#include <cstring>
   15 |
Language: C++

include<bits/stdc++.h>                                                                              
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define VS vector<string>

int main(void) {
    string s,t;
    int max=0;
    while(cin >> s >> t) {
        int dp[s.size()][t.size()];
        REP(i,s.size()) {
            REP(j,t.size()) {
                dp[i][j] = -1;
            }
        }
        REP(i,s.size()) {
            dp[i][0] = 0;
        }
        REP(i,t.size()) {
            dp[0][i] = 0;
        }

        FOR(i,1,s.size()) {
            FOR(j,1,t.size()) {
                if(s[i] != t[j]) dp[i][j] = 0;
                else dp[i][j] = dp[i-1][j-1] + 1;
                max = fmax(max, dp[i][j]);
            }
        }
        cout << max << endl;
        max = 0;
    }
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:8:5: error: 'string' was not declared in this scope
    8 |     string s,t;
      |     ^~~~~~
a.cc:10:11: error: 'cin' was not declared in this scope
   10 |     while(cin >> s >> t) {
      |           ^~~
a.cc:10:18: error: 's' was not declared in this scope
   10 |     while(cin >> s >> t) {
      |                  ^
a.cc:10:23: error: 't' was not declared in this scope
   10 |     while(cin >> s >> t) {
      |                       ^
a.cc:14:17: error: 'dp' was not declared in this scope
   14 |                 dp[i][j] = -1;
      |                 ^~
a.cc:18:13: error: 'dp' was not declared in this scope
   18 |             dp[i][0] = 0;
      |             ^~
a.cc:21:13: error: 'dp' was not declared in this scope
   21 |             dp[0][i] = 0;
      |             ^~
a.cc:26:34: error: 'dp' was not declared in this scope
   26 |                 if(s[i] != t[j]) dp[i][j] = 0;
      |                                  ^~
a.cc:27:22: error: 'dp' was not declared in this scope
   27 |                 else dp[i][j] = dp[i-1][j-1] + 1;
      |                      ^~
a.cc:28:33: error: 'dp' was not declared in this scope
   28 |                 max = fmax(max, dp[i][j]);
      |                                 ^~
a.cc:28:23: error: 'fmax' was not declared in this scope; did you mean 'max'?
   28 |                 max = fmax(max, dp[i][j]);
      |                       ^~~~
      |                       max
a.cc:31:9: error: 'cout' was not declared in this scope
   31 |         cout << max << endl;
      |         ^~~~
a.cc:31:24: error: 'endl' was not declared in this scope
   31 |         cout << max << endl;
      |                        ^~~~
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 100000005
#define MAX 5001
using namespace std;
//__gcd(a,b), __builtin_popcount(a);

int dp[4005][4005];
int main(){
	string s1, s2;
	while(cin >> s1 >> s2, s1){
	s1 = " " + s1;s2 = " " + s2;
	fill((int*)dp, (int*)(dp+4005), 0);
	int ans = 0;
	for(int i = 1;i <= s1.size();i++){
		for(int j = 1;j <= s2.size();j++){
			if(s1[i] == s2[j])dp[i][j] = dp[i-1][j-1]+1;
			ans = max(ans, dp[i][j]);
		}
	}
	cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:30: error: could not convert '(((void)std::operator>><char, char_traits<char>, allocator<char> >((* & std::operator>><char, char_traits<char>, allocator<char> >(std::cin, s1)), s2)), s1)' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
   12 |         while(cin >> s1 >> s2, s1){
      |               ~~~~~~~~~~~~~~~^~~~
      |                              |
      |                              std::string {aka std::__cxx11::basic_string<char>}
Language: C++

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<ll, P> E;
#define MOD (1000000007ll)
#define l_ength size
#define PI 3.14159265358979
 
void mul_mod(ll& a, ll b){
    a *= b;
    a %= MOD;
}
 
void add_mod(ll& a, ll b){
    b += MOD;
    a += b;
    a %= MOD;
}

int n,m;
int memo[4444][4444];
bool done[4444][4444];
char s[4444],t[4444];

int dp(int i, int j){
    if(done[i][j]){
        return memo[i][j];
    }
    done[i][j] = true;
    if(i == n || j == m){
        memo[i][j] = 0ll;
    }else if(s[i] != t[j]){
        memo[i][j] = 0ll;
    }else{
        memo[i][j] = dp(i+1,j+1) + 1;
    }
    return memo[i][j];
}

int main(void){
    int i,j;
    ll ans;
    while(scanf("%s",s)!=EOF){
        fill(done[0],done[4444],false);
        ans = 0ll;
        scanf("%s",t);
        n = strlen(s); m = strlen(t);
        for(i=0; i<n; ++i){
            for(j=0; j<m; ++j){
                ans = max(ans,dp(i,j));
            }
        }
        cout << ans << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:26: error: no matching function for call to 'max(ll&, int)'
   53 |                 ans = max(ans,dp(i,j));
      |                       ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:53:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   53 |                 ans = max(ans,dp(i,j));
      |                       ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:53:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   53 |                 ans = max(ans,dp(i,j));
      |                       ~~~^~~~~~~~~~~~~
Language: C++

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<ll, P> E;
#define MOD (1000000007ll)
#define l_ength size
#define PI 3.14159265358979
 
void mul_mod(ll& a, ll b){
    a *= b;
    a %= MOD;
}
 
void add_mod(ll& a, ll b){
    b += MOD;
    a += b;
    a %= MOD;
}

int n,m;
int memo[4444][4444];
bool done[4444][4444];
char s[4444],t[4444];

int dp(int i, int j){
    if(done[i][j]){
        return memo[i][j];
    }
    done[i][j] = true;
    if(i == n || j == m){
        memo[i][j] = 0;
    }else if(s[i] != t[j]){
        memo[i][j] = 0;
    }else{
        memo[i][j] = dp(i+1,j+1) + 1;
    }
    return memo[i][j];
}

int main(void){
    int i,j;
    ll ans;
    while(scanf("%s",s)!=EOF){
        fill(done[0],done[4444],false);
        ans = 0ll;
        scanf("%s",t);
        n = strlen(s); m = strlen(t);
        for(i=0; i<n; ++i){
            for(j=0; j<m; ++j){
                ans = max(ans,dp(i,j));
            }
        }
        cout << ans << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:26: error: no matching function for call to 'max(ll&, int)'
   53 |                 ans = max(ans,dp(i,j));
      |                       ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:53:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   53 |                 ans = max(ans,dp(i,j));
      |                       ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:53:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   53 |                 ans = max(ans,dp(i,j));
      |                       ~~~^~~~~~~~~~~~~
Language: C++

class Main{
public static void main(){
Scanner sc=new Scanner(System.in);
for(;sc.hasNext();){
String s=sc.next();
String t=sc.next();
System.out.println(lcs(s,t).length());
}
}

	static String lcs(String s, String t){
		int m=s.length(), n=t.length();
		int[][] d=new int[n+1][m+1];
		int[][] v=new int[n+1][m+1];
		for(int j=1; j<=n; j++){
			for(int i=1; i<=m; i++){
				if(s.charAt(i-1)==t.charAt(j-1)){
					d[j][i]=d[j-1][i-1]+1;
					v[j][i]=0;
				}else if(d[j][i-1]>d[j-1][i]){
					d[j][i]=d[j][i-1];
					v[j][i]=+1;
				}else{
					d[j][i]=d[j-1][i];
					v[j][i]=-1;
				}
			}
		}
		String r="";
		for(int i=m, j=n; i>0&&j>0;){
			debug(i, j);
			if(v[j][i]>0)
				i--;
			else if(v[j][i]<0)
				j--;
			else{
				r=s.charAt(i-1)+r;
				i--;
				j--;
			}
		}
		return r;
	}

}

Compiler output:
a.cc:2:7: error: expected ':' before 'static'
    2 | public static void main(){
      |       ^~~~~~~
      |       :
a.cc:11:16: error: 'String' does not name a type
   11 |         static String lcs(String s, String t){
      |                ^~~~~~
a.cc:45:2: error: expected ';' after class definition
   45 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main()':
a.cc:3:1: error: 'Scanner' was not declared in this scope
    3 | Scanner sc=new Scanner(System.in);
      | ^~~~~~~
a.cc:4:6: error: 'sc' was not declared in this scope
    4 | for(;sc.hasNext();){
      |      ^~
a.cc:5:1: error: 'String' was not declared in this scope
    5 | String s=sc.next();
      | ^~~~~~
a.cc:6:8: error: expected ';' before 't'
    6 | String t=sc.next();
      |        ^
a.cc:7:1: error: 'System' was not declared in this scope
    7 | System.out.println(lcs(s,t).length());
      | ^~~~~~
a.cc:7:24: error: 's' was not declared in this scope
    7 | System.out.println(lcs(s,t).length());
      |                        ^
a.cc:7:26: error: 't' was not declared in this scope
    7 | System.out.println(lcs(s,t).length());
      |                          ^
a.cc:7:20: error: 'lcs' was not declared in this scope
    7 | System.out.println(lcs(s,t).length());
      |                    ^~~
Language: C++

class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
for(;sc.hasNext();){
String s=sc.next();
String t=sc.next();
System.out.println(lcs(s,t).length());
}
}

	static String lcs(String s, String t){
		int m=s.length(), n=t.length();
		int[][] d=new int[n+1][m+1];
		int[][] v=new int[n+1][m+1];
		for(int j=1; j<=n; j++){
			for(int i=1; i<=m; i++){
				if(s.charAt(i-1)==t.charAt(j-1)){
					d[j][i]=d[j-1][i-1]+1;
					v[j][i]=0;
				}else if(d[j][i-1]>d[j-1][i]){
					d[j][i]=d[j][i-1];
					v[j][i]=+1;
				}else{
					d[j][i]=d[j-1][i];
					v[j][i]=-1;
				}
			}
		}
		String r="";
		for(int i=m, j=n; i>0&&j>0;){
			debug(i, j);
			if(v[j][i]>0)
				i--;
			else if(v[j][i]<0)
				j--;
			else{
				r=s.charAt(i-1)+r;
				i--;
				j--;
			}
		}
		return r;
	}

}

Compiler output:
a.cc:2:7: error: expected ':' before 'static'
    2 | public static void main(String[] args){
      |       ^~~~~~~
      |       :
a.cc:2:25: error: 'String' has not been declared
    2 | public static void main(String[] args){
      |                         ^~~~~~
a.cc:2:34: error: expected ',' or '...' before 'args'
    2 | public static void main(String[] args){
      |                                  ^~~~
a.cc:11:16: error: 'String' does not name a type
   11 |         static String lcs(String s, String t){
      |                ^~~~~~
a.cc:45:2: error: expected ';' after class definition
   45 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:3:1: error: 'Scanner' was not declared in this scope
    3 | Scanner sc=new Scanner(System.in);
      | ^~~~~~~
a.cc:4:6: error: 'sc' was not declared in this scope
    4 | for(;sc.hasNext();){
      |      ^~
a.cc:5:1: error: 'String' was not declared in this scope
    5 | String s=sc.next();
      | ^~~~~~
a.cc:6:8: error: expected ';' before 't'
    6 | String t=sc.next();
      |        ^
a.cc:7:1: error: 'System' was not declared in this scope
    7 | System.out.println(lcs(s,t).length());
      | ^~~~~~
a.cc:7:24: error: 's' was not declared in this scope
    7 | System.out.println(lcs(s,t).length());
      |                        ^
a.cc:7:26: error: 't' was not declared in this scope
    7 | System.out.println(lcs(s,t).length());
      |                          ^
a.cc:7:20: error: 'lcs' was not declared in this scope
    7 | System.out.println(lcs(s,t).length());
      |                    ^~~
Language: C++

import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

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

public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
for(;sc.hasNext();){
String s=sc.next();
String t=sc.next();
System.out.println(lcs(s,t).length());
}
}

	static String lcs(String s, String t){
		int m=s.length(), n=t.length();
		int[][] d=new int[n+1][m+1];
		int[][] v=new int[n+1][m+1];
		for(int j=1; j<=n; j++){
			for(int i=1; i<=m; i++){
				if(s.charAt(i-1)==t.charAt(j-1)){
					d[j][i]=d[j-1][i-1]+1;
					v[j][i]=0;
				}else if(d[j][i-1]>d[j-1][i]){
					d[j][i]=d[j][i-1];
					v[j][i]=+1;
				}else{
					d[j][i]=d[j-1][i];
					v[j][i]=-1;
				}
			}
		}
		String r="";
		for(int i=m, j=n; i>0&&j>0;){
			debug(i, j);
			if(v[j][i]>0)
				i--;
			else if(v[j][i]<0)
				j--;
			else{
				r=s.charAt(i-1)+r;
				i--;
				j--;
			}
		}
		return r;
	}

}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.lang.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.math.*;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.io.*;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
    6 | import static java.lang.Math.*;
      | ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
    7 | import static java.util.Arrays.*;
      | ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:9:1: error: expected unqualified-id before 'public'
    9 | public class Main{
      | ^~~~~~
Language: C++

import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

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

public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
for(;sc.hasNext();){
String s=sc.next();
String t=sc.next();
System.out.println(lcs(s,t).length());
}
}

	static String lcs(String s, String t){
		int m=s.length(), n=t.length();
		int[][] d=new int[n+1][m+1];
		int[][] v=new int[n+1][m+1];
		for(int j=1; j<=n; j++){
			for(int i=1; i<=m; i++){
				if(s.charAt(i-1)==t.charAt(j-1)){
					d[j][i]=d[j-1][i-1]+1;
					v[j][i]=0;
				}else if(d[j][i-1]>d[j-1][i]){
					d[j][i]=d[j][i-1];
					v[j][i]=+1;
				}else{
					d[j][i]=d[j-1][i];
					v[j][i]=-1;
				}
			}
		}
		String r="";
		for(int i=m, j=n; i>0&&j>0;){
			if(v[j][i]>0)
				i--;
			else if(v[j][i]<0)
				j--;
			else{
				r=s.charAt(i-1)+r;
				i--;
				j--;
			}
		}
		return r;
	}

}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.lang.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.math.*;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.io.*;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
    6 | import static java.lang.Math.*;
      | ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
    7 | import static java.util.Arrays.*;
      | ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:9:1: error: expected unqualified-id before 'public'
    9 | public class Main{
      | ^~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>

using namespace std;

int check(string, string);

int main()
{
  //ifstream ifs("data.txt");
  string str1, str2;
  while( cin >> str1 >> str2 ){

    int res = 0;

    for(int i = 0; i < max(str1.size(), str2.size()); i++){
      if(str1.size() > str2.size())
	rotate(str1.begin(), str1.begin() + 1, str1.end());
      else
	rotate(str2.begin(), str2.begin() + 1, str2.end());

      res = max(res, check(str1, str2));
    }

    cout << res << endl;
  }
  ifs.close();
}

int check(string str1, string str2)
{
  int sn = 0, res = 0;
  for(int i = 0; i < min(str1.size(), str2.size()); i++){
    if(str1[i] == str2[i])
      sn++;
      res = max(res, sn);
    else{
      sn = 0;
    }
  }
  return res;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:3: error: 'ifs' was not declared in this scope
   29 |   ifs.close();
      |   ^~~
a.cc: In function 'int check(std::string, std::string)':
a.cc:39:5: error: 'else' without a previous 'if'
   39 |     else{
      |     ^~~~
Language: C++

char s[4005],t[4005];u[4005],m,i,j,c,d;main(n){for(;d=~scanf("%s%s",s,t);i=m=!printf("%d\n",m))for(n=strlen(s);d;d=t[i++])for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;}

Compiler output:
a.cc:1:22: error: 'u' does not name a type
    1 | char s[4005],t[4005];u[4005],m,i,j,c,d;main(n){for(;d=~scanf("%s%s",s,t);i=m=!printf("%d\n",m))for(n=strlen(s);d;d=t[i++])for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;}
      |                      ^
a.cc:1:44: error: expected constructor, destructor, or type conversion before '(' token
    1 | char s[4005],t[4005];u[4005],m,i,j,c,d;main(n){for(;d=~scanf("%s%s",s,t);i=m=!printf("%d\n",m))for(n=strlen(s);d;d=t[i++])for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;}
      |                                            ^
Language: C++

#include<iostream>
#include<cstring>
#include<string>

using namespace std;

int main(void){
	int a,b;
	while(1){
		memset(len,0,sizeof(len));
		string str;
		string str2;
		int ans=0;
		cin >> str;
		if(str=="EOF")break;
		cin >> str2;
		for(a=0;a<str.size();a++){
			int res=0;
			string tmp= str.substr(a, str.length()-a);
			for(b=0;b<min(tmp.size(),str2.size());b++){
				if(tmp[b]==str2[b])res++;
				else ans=max(res,ans),res=0;
				if(min(tmp.size(),str2.size())-1==b)ans=max(res,ans);
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:24: error: 'len' was not declared in this scope; did you mean 'mblen'?
   10 |                 memset(len,0,sizeof(len));
      |                        ^~~
      |                        mblen
Language: C++

#include<iostream>
#include<cstring>
#include<string>

using namespace std;

int main(void){
	int a,b;
	while(1){
		memset(len,0,sizeof(len));
		string str;
		string str2;
		int ans=0;
		cin >> str;
		if(str=="EOF")break;
		cin >> str2;
		for(a=0;a<str.size();a++){
			int res=0;
			string tmp= str.substr(a, str.size()-a);
			for(b=0;b<min(tmp.size(),str2.size());b++){
				if(tmp[b]==str2[b])res++;
				else ans=max(res,ans),res=0;
				if(min(tmp.size(),str2.size())-1==b)ans=max(res,ans);
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:24: error: 'len' was not declared in this scope; did you mean 'mblen'?
   10 |                 memset(len,0,sizeof(len));
      |                        ^~~
      |                        mblen
Language: C++

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#include<math.h>
int main(void){
	char s[4001],t[4001];
	while(scanf("%s",s)!=EOF){
		scanf("%s",t);
		int sl = strlen(s),tl = strlen(t);
		int ans = 0;
		for(int i=0;i+ans<sl;i++){
			for(int j=0;j+ans<tl;j++){
				if(s[i]==t[j]){
					for(int k=1;j+k<tl && i+k<sl;k++){
						ans = max(ans,k);
						if(s[i+k]!=t[j+k])break;
					}
				}
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:55: error: 'max' was not declared in this scope; did you mean 'std::max'?
   16 |                                                 ans = max(ans,k);
      |                                                       ^~~
      |                                                       std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#include<math>
int main(void){
	char s[4001],t[4001];
	while(scanf("%s",s)!=EOF){
		scanf("%s",t);
		int sl = strlen(s),tl = strlen(t);
		int ans = 0;
		for(int i=0;i+ans<sl;i++){
			for(int j=0;j+ans<tl;j++){
				if(s[i]==t[j]){
					for(int k=1;j+k<tl && i+k<sl;k++){
						ans = max(ans,k);
						if(s[i+k]!=t[j+k])break;
					}
				}
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

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

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int dp[4001][4001]={};
char str1[4005],str2[4005];
int ans=0;
int main(){while(
  scanf("%s%s",str1,str2)!=-1){
  for(int i=0;i<strlen(str1);i++){
    for(int j=0;j<strlen(str2);j++){
      if(str1[i]==str2[j]){
         if(i==0 || j==0){ dp[i][j]=1;ans=max(ans,1);}
         else{ dp[i][j]=1+dp[i-1][j-1];ans=max(ans,dp[i][j])}
      }}}printf("%d\n",ans); }return 0;}
   

Compiler output:
a.cc: In function 'int main()':
a.cc:14:61: error: expected ';' before '}' token
   14 |          else{ dp[i][j]=1+dp[i-1][j-1];ans=max(ans,dp[i][j])}
      |                                                             ^
      |                                                             ;
Language: C++

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
short dp[4001][4001]={};
char str1[4005],str2[4005];
int ans=0;
int main(){while(scanf("%s%s",str1,str2)!=-1){
  for(int i=0;i<strlen(str1);i++){
    for(int j=0;j<strlen(str2);j++){
      if(str1[i]==str2[j]){
         if(i==0 || j==0){ dp[i][j]=1;ans=max(ans,1);}
         else{ dp[i][j]=1+dp[i-1][j-1];ans=max(ans,dp[i][j]);}
      }}}printf("%d\n",ans); }return 0;}
   

Compiler output:
a.cc: In function 'int main()':
a.cc:13:47: error: no matching function for call to 'max(int&, short int&)'
   13 |          else{ dp[i][j]=1+dp[i-1][j-1];ans=max(ans,dp[i][j]);}
      |                                            ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:13:47: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
   13 |          else{ dp[i][j]=1+dp[i-1][j-1];ans=max(ans,dp[i][j]);}
      |                                            ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:13:47: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   13 |          else{ dp[i][j]=1+dp[i-1][j-1];ans=max(ans,dp[i][j]);}
      |                                            ~~~^~~~~~~~~~~~~~
Language: C++

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
short dp[4001][4001]={};
char str1[4005],str2[4005];
short ans=0;
int main(){
	while(scanf("%s",str1)!=EOF){
		scanf("%s",str2);
}
  printf("%d\n",ans); }return 0;}
   

Compiler output:
a.cc:12:24: error: expected unqualified-id before 'return'
   12 |   printf("%d\n",ans); }return 0;}
      |                        ^~~~~~
a.cc:12:33: error: expected declaration before '}' token
   12 |   printf("%d\n",ans); }return 0;}
      |                                 ^
Language: C++

import java.util.*;

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

    while(sc.hasNext()){
      char[] s1 = sc.next().toCharArray();
      char[] s2 = sc.next().toCharArray();
      int len1 = s1.length;
      int len2 = s2.length;

      //intテ・ツ楪凝」ツ?ァ, 4000*4000テ」ツつ津ァツ「ツコテ、ツソツ敕」ツ?凖」ツつ?-> MLE
      //shortテ・ツ楪凝」ツ?繰avaテ」ツ?ァテ、ツスツ陛」ツδ静」ツつ、テ」ツδ暗」ツ?凝、ツクツ催ヲツ伉偲」ツ??」ツ?古ィツゥツヲテ」ツ??-> MLE
      //テ、ツサツ陛ヲツ鳴ケテ」ツ?古」ツ?ェテ」ツ??」ツ?ョテ」ツ?ァテ」ツ??ゥツ?催・ツ按療ッツシツ妥ィツ。ツ古」ツつ津、ツスツソテ」ツ??・ツ崢榲」ツ?凖・ツスツ「テ」ツ?ォ
      short[][] dp = new short[2][len2 + 1];
      short maxLen = 0;

      for(int idx1 = 0; idx1 < len1; idx1++){
        int i = idx1 % 2;
        int ni = (i + 1) % 2;

        Arrays.fill(dp[ni], (short)0);

        for(int idx2 = 0; idx2 < len2; idx2++){
          if(s1[idx1] == s2[idx2]){
            dp[ni][idx2 + 1] = (short)(dp[i][idx2] + 1);
            maxLen = (short)Math.max(maxLen, dp[ni][idx2 + 1]);
          }
        }
      }

      System.out.println(maxLen);
    }
  }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main{
      | ^~~~~~
Language: C++

#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

template<class T> inline void chmax(T& a, T b) { if(b > a) a = b; }

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

	for(string a, b; cin >> a;) {
		cin >> b;

		vector<vector<int> > dp(a.size() + 1, vector<int>(b.size() + 1, 0));
		for(int i = 0; i < a.size(); ++i)
			for(int j = 0; j < b.size(); ++j)
				if(a[i] == b[j])
					chmax(dp[i + 1][j + 1], dp[i][j] + 1);

		int ans = 0;
		for(int i = 0; i < dp.size(); ++i)
			chmax(ans, *max_element(dp[i].begin(), dp[i].end()));

		cout << ans << endl;
	}

	return EXIT_SUCCESS;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:37: error: 'max_element' was not declared in this scope
   24 |                         chmax(ans, *max_element(dp[i].begin(), dp[i].end()));
      |                                     ^~~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <cstring>
 
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define MP make_pair
#define X first
#define Y second
 
using namespace std;
 
typedef vector<int> vi;
typedef pair<int, int> P;

const int INF = 1<<29;

int common(string &a, string &b){
	int size = min(a.size(), b.size());
	int res = 0, cnt = 0;
	rep(i, size){
		if(a[i]==b[i]) cnt++;
		else{
			res = max(res, cnt);
			cnt = 0;
		}
	}
	return max(res, cnt);
}

int check(string &a, string &b){
	int res = 0;
	rep(i, a.size()){
		res = max(res, common(a.substr(i),b));
	}
	return res;
}

int main(){
	string a, b;
	while(cin >> a >> b){
		cout << max(check(a, b), check(b, a)) << endl;
	}


    return 0;
}

Compiler output:
a.cc: In function 'int check(std::string&, std::string&)':
a.cc:39:47: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
   39 |                 res = max(res, common(a.substr(i),b));
      |                                       ~~~~~~~~^~~
a.cc:23:20: note:   initializing argument 1 of 'int common(std::string&, std::string&)'
   23 | int common(string &a, string &b){
      |            ~~~~~~~~^
Language: C++

#include <iostream>
#include <string>
#include <cstring>
short dp[4001][4001];
using namespace std;
int main(){
  string s,str;
  int ans = 0;
  while(cin >> s >> str){
    memset(dp,0,sizeof(dp));
    for(int i=0,l=s.size();i<l;i++){
      for(int j=0,ll=str.size();j<ll;j++){
        if(s[i] == str[j]){
          dp[i+1][j+1] = dp[i][j]+1;
          ans = max(ans,dp[i+1][j+1]);
        }else dp[i+1][j+1] = 0;
      }
    }
    cout << ans << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:20: error: no matching function for call to 'max(int&, short int&)'
   15 |           ans = max(ans,dp[i+1][j+1]);
      |                 ~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:15:20: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
   15 |           ans = max(ans,dp[i+1][j+1]);
      |                 ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class Main1{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			if(n == 0 && m == 0)break;
			
			int[] p = new int[n];
			for(int i=0;i<n;i++) {
				p[i] = sc.nextInt();
			}
			
			int[] q = new int[((n+2)*(n+1))/2];	//!!!!
			int r = 0;
			for(int i = 0;i<=n;i++) {
				for(int j=i;j<=n;j++) {
					q[r++] = p[i]+p[j];
				}
			}
			Arrays.sort(q);
			
			long s = 0;
			for(int i=0;i<q.length;i++) {
				if(m-q[i] < 0)continue;
				if(r >= 0)s = Math.max(s,q[i]+q[r]);
			}
			System.out.println(s);
			
		}
	}
}



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

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
long p2[501501],c,all;
void add(long);
void put(long num,long place);
long search(long,long,long,long);
int cmp(const void*,const void*);
int main(){
	long p[1001],m,j,max,num,call,;
	int n,i;
	while(1){
		scanf("%d %ld",&n,&m);
		if(n==0) break;
		p2[0]=0;
		all=1;
		p[0]=0;
		for(i=1;i<=n;i++){
			scanf("%ld",&cp);
			p[i]=cp;
			qsort(p,i+1,sizeof(long),cmp);
			c=0;
			call=all;
			for(j=0;j<i;j++){
				if(p[j]+cp>m) break;
				add(p[j]+cp);
			}
		}
		max=0;
		for(j=1;j<all;j++){
			num=search(p2[j],m,0,all-1);
			max=(num>max)?num:max;
		}
		printf("%ld\n",max);
	}
	return 0;
}

void add(long p){
	for(;c<all;c++){
		if(p2[c]>p){
			put(p,c);
			all++;
			return;
		}else if(p2[c]==p){
			return;
		}
	}
	put(p,all);
	all++;
}

void put(long num,long place){
	long i;
	for(i=all;i>place;i--){
		p2[i]=p2[i-1];
	}
	p2[place]=num;
	for(i=0;i<=all;i++){
	}
}

long search(long num,long max,long start,long end){
	if(start==end) return num+p2[start];
	if(p2[(end-start+1)/2+start]>max-num){
		return search(num,max,start,(end-start+1)/2+start-1);
	}else{
		return search(num,max,(end-start+1)/2+start,end);
	}
}

int cmp(const void* a,const void* b){
	return *(long*)a-*(long*)b;
}

Compiler output:
main.c: In function 'main':
main.c:10:39: error: expected identifier or '(' before ';' token
   10 |         long p[1001],m,j,max,num,call,;
      |                                       ^
main.c:19:38: error: 'cp' undeclared (first use in this function); did you mean 'p'?
   19 |                         scanf("%ld",&cp);
      |                                      ^~
      |                                      p
main.c:19:38: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

long sum[1002001];
long sumnum;

int cmp(const void *a, const void *b);
long search(long,long,long,long);

int main(){
	int n,i,j;
	long m,p[1000],k,max,score;
	while(1){
		scanf("%d %ld",&n,&m);
		if(n==0) break;
		sum[0]=0;
		sumnum=1;
		for(i=0;i<n;i++){
			scanf("%ld",&p[i]);
			sum[sumnum]=p[i];
			sumnum++;
			for(j=0;j<=i;j++){
				if(p[i]+p[j]>m) continue;
				sum[sumnum]=p[i]+p[j];
				sumnum++;
			}
		}
		qsort(sum,sumnum,sizeof(long),cmp);
		max=0;
		for(k=0;k<sumnum/2+1;k++){
			score=search(sum[k],m,0,sumnum-1);
			max=(score>max)?score:max;
		}
		printf("%ld\n",max);
	}
	return 0;
}


long search(long num,long max,long s,long e){
	if(s==e) return num+sum[e];
	if(max-num>sum[(e-s)/2+s+1]){
		return search(num,max,(e-s)/2+s+1,e);
	}
	return search(num,max,s,(e-s)/2+s);
}

long search(long num,long max,long s,long e){
	if(s==e) return num+sum[e];
	if(max-num>sum[(e-s)/2+s+1]){
		return search(num,max,(e-s)/2+s+1,e);
	}
	return search(num,max,s,(e-s)/2+s);
}

int cmp(const void *a, const void* b){
	return *(long *)a-*(long*)b;
}

Compiler output:
main.c:48:6: error: redefinition of 'search'
   48 | long search(long num,long max,long s,long e){
      |      ^~~~~~
main.c:40:6: note: previous definition of 'search' with type 'long int(long int,  long int,  long int,  long int)'
   40 | long search(long num,long max,long s,long e){
      |      ^~~~~~
Language: C

#include "stdafx.h"
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main()
{
	int ans[4];
	int temp;
	double energy,energy_min,energy_now;
	int M, N;
	int* p;
	int i, j;
	double T=100;
	int ret;
	while (1) {
		scanf_s("%d%d", &N, &M);
		p = (int*)malloc((N+1) * sizeof(int));
		for (i = 0; i < N; i++) {
			scanf_s("%d", &p[i]);
		}
		p[N] = 0;
		if (N == M && N == 0) {
			break;
		}
		energy_min = pow(10, 300);
		for (j = 0; j < 4; j++) {
			ans[j] = p[(int)((double)(rand() + 1) / (RAND_MAX + 2)*(N+1))];
		}
		
		for (T = 100000; T > 100; T--) {
			for (j = 0; j < 4; j++) {
				temp = p[(int)((double)(rand() + 1) / (RAND_MAX + 2)*(N+1))];
				for (j = 0; j < 4; j++) {
					ret = ans[0] + ans[1] + ans[2] + ans[3];
					ret += temp - ans[j];
					energy = M - ret;
					if (M < ret)energy += 100000000;

					if (energy < energy_min) {
						energy_min = energy;
						ans[j] = temp;
					}
					else if ((double)(rand() + 1) / (RAND_MAX + 2) < exp((energy_min - energy) / T*1000)) {
						energy_min = energy;
						ans[j] = temp;
					}
				}

			}
		}
		ret=ans[0]+ +ans[1] + ans[2] + ans[3];
		printf("%d\n", ret);
	}
    return 0;
}

Compiler output:
main.c:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define mem(x,y)		(x*)malloc(sizeof(x)*(y))

int int_sort(const void* a,const void* b)
{
	if(*(int *)a < *(int *)b)
	{
		return -1;
	}
	else if(*(int *)a == *(int *)b)
	{
		return 0;
	}
	return 1;
}

int* search(int point,int* list,int len,int max)
{
	double i = len/2.0;
	double size = len/2.0;
	int maxp = 0;
	int* data = mem(int,2);
	while(1)
	{
		const int pt = point+list[(int)i];
		if(pt > max)
		{
			if(size < 0.5)
			{
				break;
			}
			else
			{
				size/=2.0;
				i-=size;
			}
		}
		else
		{
			if(maxp < pt)
				maxp = pt;
			if(size < 0.5)
			{
				break;
			}
			else
			{
				size/=2.0;
				i+=size;
			}
		}
	}
	data[0] = maxp;
	data[1] = (int)i;
	return data;
}

int main()
{
	int n,m;
	int* data;
	int* list;
	int i,j,k;
	while(scanf("%d %d",&n,&m),n,m)
	{
		int list_len = (n+1)*(n+1);
		data = mem(int,n+1);
		list = mem(int,list_len);
		data[0] = 0;
		for(i = 1;i <= n;i++)
		{
			scanf("%d",&data[i]);
		}
		for(k = i = 0;i <= n;i++)
		{
			for(j = 0;j <= i;j++,k++)
			{
				list[k] = data[i]+data[j];
			}
		}
		list_len = k+1;
		qsort(list,list_len,sizeof(int),int_sort);
		int max = 0;
		for(i = 0;i<ll_tmp;i++)
		{
			int* val = search(list[i],list,list_len,m);
			if(val[0] > max)
			{
				max = val[0];
			}
			list_len = val[1]+1;
		}
		printf("%d\n",max);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:86:29: error: 'll_tmp' undeclared (first use in this function)
   86 |                 for(i = 0;i<ll_tmp;i++)
      |                             ^~~~~~
main.c:86:29: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

int main( void )
{
	int n, m, input[1001];
	while(cin >> n >> m, n | m) {
		for(int i=0; i < n; ++i) cin >> input[i];
		sort(input, input+n, greater<int>());
		//for(int i=0; i < n; ++i) cout << input[i] << ' ';
		//cout << endl;
		input[n++] = 0;
		int Max = 0;
		for(int i=0; i < n; ++i)
			for(int j=i; j < n; ++j)
				for(int k=j; k < n; ++k)
					for(int l=k; l < n; ++l) {
						int sum = input[i] + input[j] + input[k] + input[l];
						if(sum <= m && Max < sum) Max = sum;
					}
		cout << Max << endl;
	}
	return 0;
}

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

#include<cstdio>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
int N,M,R,P[1005]={0},X[1000005];
int bs(int r,int l,int k)
{
	int m;
	while(l-r>1)
	{
		m=(r+l)/2;
		if(X[m]==k)
			return m;
		if(X[m]<=k)
			r=m+1;
		else
			l=m-1;
	}
	return l;
}

int main()
{
	for(;scanf("%d%d",&N,&M),N;)
	{
		for(int i=0,t;i<N;i++)
			scanf("%d",&P[i+1]);
		int p=0;
		for(int i=0;i<=N;i++)
			for(int j=i;j<=N;j++)
				X[p++]=P[i]+P[j];
		sort(X,X+p);
		for(int i=R=0;i<p;i++)
		{
			if(X[i]<=M)
			{
				int t=X[i]+X[bs(0,p-1,M-X[i])];
				R=max(R,t>M?0:t);
			}
		}
		printf("%d\n",R);
	}
	return 0;
}

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

import java.util.Arrays;
import java.util.Scanner;


public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int n = sc.nextInt();
			int m = sc.nextInt();
			
			if(n == 0 && m == 0){
				break;
			}
			int[] input = new int[n];
			
			for(int i = 0; i < n ; i++){
				input[i] = sc.nextInt();
			}
			
			System.out.println(solve(input, m));
		}
	}
	
	//半分全列挙で解きたい
	static long solve(int[] array, int limit){
		int n = array.length + 1;
		int[] copyArray = new int[n];
		//0を追加した配列を作る
		for(int i = 0 ; i < n - 1; i++){
			copyArray[i] = array[i];
		}
		
		//2回投げたときに有り得る得点
		long[] twoTimes = new long[n*n];
		
		int index = 0;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				twoTimes[index++] = copyArray[i] + copyArray[j];
			}
		}
		
		Arrays.sort(twoTimes);
		//debug
//		for(int i = 0; i < twoTimes.length; i++){
//			System.out.println(twoTimes[i]);
//		}
		
		long result = 0;
		
		for(int i = 0; i < twoTimes.length ; i++){
			//そもそも2回だけで済む場合
			if(twoTimes[i] == limit){
				System.out.println("JUST");
				return twoTimes[i];
			}
			
			//既にオーバーしている場合も論外
			else if (twoTimes[i] > limit){
//				System.out.println("OVER i = "+i+" "+twoTimes[i]);
				break;
			}
			
			//わざと少し下を狙う
			int tmpIndex = Arrays.binarySearch(twoTimes, limit - twoTimes[i] - 1);
			
			if(tmpIndex < 0){
				tmpIndex++;
				tmpIndex *= -1;
				tmpIndex--;
			}
			
			if(tmpIndex >= twoTimes.length){
				tmpIndex = twoTimes.length - 1;
			}
			
			
			for(int j = Math.max(tmpIndex, 0); j < twoTimes.length; j++){
//				if(twoTimes[i] + twoTimes[j] > limit){
//					break;
//				}
//				System.out.println("j = "+j+" "+twoTimes[i] + " "+twoTimes[j]);
				if(twoTimes[i] + twoTimes[j] > limit){
					break;
				}
				result = Math.max(result, twoTimes[i] + twoTimes[j]);
			}
		}
		return result;
	}

}



Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Arrays;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Scanner;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: expected unqualified-id before 'public'
    5 | public class Main {
      | ^~~~~~
Language: C++

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

int m, n, p[1000], pp[1000*1000];

int main(){
    while( true ){
        cin >> n >> m;
        if( m == 0 && n == 0 ) break;
        for(int i = 0; i < n; i++){
            cin >> p[i];
        }
        sort(p, p+n);
        for(int i = 0; i < n*n; i++){
            pp[i] = p[i/n] + p[i%n];
        }
        sort(pp, pp + n*n);
        int c = n/p[n-1];
        if( c >= 4 ){
            cout << p[n-1]*4;
            continue;
        }
        int cand = 0;
        if( c <= 3 ){
            int j = n*n-1;
            for(int i = 0; i <= n*n/2 &&; i++){
                while( pp[i] + pp[j] > m && j > 0 ) j--;
                cand = max(cand, pp[i] + pp[j]);
            }
        }
        if( c <= 2 ){
            int j = n*n-1;
            for(int i = 0; i <= n/2; i++){
                while( p[i] + pp[j] > m && j > 0 ) j--;
                cand = max(cand, p[i] + pp[j]);
            }
        }
        if( c <= 1 ){
            int j = n-1;
            for(int i = 0; i <= n/2; i++){
                while( p[i] + p[j] > m && j > 0 ) j--;
                cand = max(cand, p[i] + p[j]);
            }
        }
        int k;
        for(k = n-1; p[k] > m && k > 0; k--);
        cand = max(cand, p[k]);
        cout << cand << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:41: error: expected primary-expression before ';' token
   27 |             for(int i = 0; i <= n*n/2 &&; i++){
      |                                         ^
Language: C++

#include <cstdio>
#include <fstream>
#include <algorithm>
using namespace std;

#define MAX_N 1000
int P[MAX_N + 1];
int N, M;
int table[5][MAX_N + 1];

int dfs(int a, int b, int c){
	if(c > M) return P[b] * -1;
	if(a == 0) return P[b];
	if(table[a][b] >= 0) return table[a][b];
	
	int cho = b;
	while(cho <= N){
		int d = dfs(a - 1, cho, c + P[b]) + P[b];
		table[a][b] = max(table[a][b], (d > M)? 0 : d);
		cho++;
	}
	
	return table[a][b];
}

int main(){
	ifstream ifs("input.txt");
	
	for(int i = 0; i < 5; i++){
		for(int j = 0; j <= MAX_N; j++){
			table[i][j] = -1;
		}
	}
	
	ifs >> N >> M;
	
	p[0] = 0;
	for(int i = 1; i <= N; i++) ifs >> P[i];
	
	printf("%d\n", dfs(4, 0, 0));
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:9: error: 'p' was not declared in this scope
   37 |         p[0] = 0;
      |         ^