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

#include<iostream>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  int t[n];
  for(int i=0;i<n;i++){
    cin>>t[i];
  }
  int ans=0;
  int max=0;
  sort(t,t+n);
  for(int i=n-1;i>=0;){
    if(ans+t[i]>=m){
      i--;
      continue;
    }
    ans+=t[i];
    //cout<<"ans "<<ans<<endl;
  }
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |   sort(t,t+n);
      |   ^~~~
      |   short
Language: C++

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

int main() {
	
	while(cin >> N >> M, N + M > 0) {
	
		int N, M;
		int P[1111];
		vector<int> PP;
		
		for(int i= 0; i < N; i++) {
			cin >> P[i];
		}
		
		P[N++] = 0;
		
		for(int i = 0; i < N; i++) {
			for(int j = 0; j < N; j++) {
				PP.push_back(P[i] + P[j]);
			}
		}
		
		sort(PP.begin(), PP.end());
		
		int ans = 0;;
		
		for(int i = 0, m; i < PP.size(); i++) {
			m = M - PP[i];
			if(m < 0) continue;
			int it = *(upper_bound(PP.begin(), PP.end(), m) - 1);
			ans = max(ans, PP[i] + it );
			//cout << PP[i] << " " << it << endl;
		}
		
		cout << ans << endl;
	}

	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:22: error: 'N' was not declared in this scope
    8 |         while(cin >> N >> M, N + M > 0) {
      |                      ^
a.cc:8:27: error: 'M' was not declared in this scope
    8 |         while(cin >> N >> M, N + M > 0) {
      |                           ^
Language: C++

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

int binary(vector<int> &a, int tar){
  int begin = 0, end = a.size() - 1, mid = (begin + end)/2;
  while(begin < mid){
    if(a[mid] < tar){
      begin = mid;
    }else{
      end = mid;
    }
    mid = (begin + end)/2;
  }
  return a[mid];
}


int main(int argc, char *argv[]){
  int n, m;
  while(scanf("%d %d\n", &n, &m)){
    if(n == 0 && m == 0)break;
    int point[n + 1];
    point[0] = 0;
    vector<int> a;
    for (int i = 1; i <= n; i++) {
      scanf("%d\n", &point[i]);
    }
    for (int i = 0; i <= n; i++) {
      for (int j = 0; j <= n; j++) {
        a.push_back(point[i] + point[j]);
      }
    }
    sort(a.begin(), a.end());
    int ans = 0;
    for (int i: a){
      int tmp = binary(a, m - i);
      if(i + tmp <= m)
        ans = max(ans, i + tmp);
    }
    std::cout << ans << std::endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:35:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   35 |     sort(a.begin(), a.end());
      |     ^~~~
      |     short
Language: C++

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

long long kazu[1002001];//1001^2
long long n,m,Max = 0,data[1001];

int main(){
	while(std::cin>>n>>m, n * m){
		if(n==0&&m==0)break;

		memset(kazu, 0, sizeof(kazu));
		memset(data, 0, sizeof(data));

		for(int i=0;i<n;i++){
			std::cin >> data[i+1];
		}
		for(int c=0;c<n+1;c++){
			for(int d=0;d<n+1;d++){
				kazu[c*n+d]=data[c]+data[d];
			}
		}
		std::sort(kazu,kazu+(n+1)*(n+1));

		long long* ptr;
		for(int i = 0; i < (n + 1) * (n + 1);++i){
			if(kazu[i] < m){
				ptr = std::upper_bound(kazu, kazu + (n + 1) * (n + 1), m - kazu[i]) - 1;
				Max = std::max(Max, *ptr + kazu[i]);
			}
		}


		std::cout << Max << std::endl;
		Max = 0;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: 'memset' was not declared in this scope
   13 |                 memset(kazu, 0, sizeof(kazu));
      |                 ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<functional>
  +++ |+#include <cstring>
    5 | 
a.cc:38:2: error: expected '}' at end of input
   38 | }
      |  ^
a.cc:9:11: note: to match this '{'
    9 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <queue>
using namespace std;
const int MAX_M = 100000000;
int n, m, p[1000], save;
bool  dp[MAX_M];
queue <int> que;
int main() {#include <iostream>
#include <queue>
using namespace std;
const int MAX_M = 100000000;
int n, m, p[1000], save;
bool  dp[MAX_M+1];
queue <int> que;
int main() {
	while (cin >> n >> m){
		for (int i = 0; i<n; i++){
			cin >> p[i];
		}
		for(int i=0;i<m;i++){
			dp[i]=0;
		}
		dp[0] = 1;
		que.push(0);
		for (int i = 0; i<n; i++){
			dp[p[i]] = 1;
			que.push(p[i]);
		}
		for (int i = 1; i<4; i++){
			save=que.size();
			for (int k=0;k<save;k++){
				for (int j = 0; j < n; j++){
					if (que.front() + p[j] < m){
						dp[que.front() + p[j]] = 1;
						que.push(que.front() + p[j]);
					}
				}
				que.pop();
			}
		}
		for (int i = m - 1; i >= 0; i--){
			if (dp[i] != 0){
				cout << i << endl;
				break;
			}
		}
	}
	return 0;
}
	while (cin >> n >> m){
		for (int i = 0; i<n; i++){
			cin >> p[i];
		}
		for(int i=0;i<m;i++){
			dp[i]=0;
		}
		dp[0] = 1;
		que.push(0);
		for (int i = 0; i<n; i++){
			dp[p[i]] = 1;
			que.push(p[i]);
		}
		for (int i = 1; i<4; i++){
			save=que.size();
			for (int k=0;k<save;k++){
				for (int j = 0; j < n; j++){
					if (que.front() + p[j] < m){
						dp[que.front() + p[j]] = 1;
						que.push(que.front() + p[j]);
					}
				}
				que.pop();
			}
		}
		for (int i = m - 1; i >= 0; i--){
			if (dp[i] != 0){
				cout << i << endl;
				break;
			}
		}
	}
	return 0;
}

Compiler output:
a.cc:8:13: error: stray '#' in program
    8 | int main() {#include <iostream>
      |             ^
a.cc: In function 'int main()':
a.cc:8:14: error: 'include' was not declared in this scope
    8 | int main() {#include <iostream>
      |              ^~~~~~~
a.cc:8:31: error: expected primary-expression before '>' token
    8 | int main() {#include <iostream>
      |                               ^
a.cc:10:1: error: expected primary-expression before 'using'
   10 | using namespace std;
      | ^~~~~
a.cc:15:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   15 | int main() {
      |         ^~
a.cc:15:9: note: remove parentheses to default-initialize a variable
   15 | int main() {
      |         ^~
      |         --
a.cc:15:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:15:12: error: a function-definition is not allowed here before '{' token
   15 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
	int n;
	long long int m;
	while (cin >> n >> m) {
		if (n == 0 && m == 0) {
			break;
		}
		vector<long long int> data;
		long long int b;
		for (int i = 0; i < n; i++) {
			cin >> b;
			if (b <= m) {
				data.push_back(m);
			}
		}
		sort(data.begin(), data.end());
		vector<long long int> data2;
		for (int i = 0; i < data.size(); i++) {
			for (int j = i; j < data.size(); j++) {
				if (data[i]+data[j] <= m) {
					data2.push_back(data[i]+data[j]);
				} else {
					break;
				}
			}
		}
		sort(data2.begin(), data2.end());
		data.clear();
		for (int i = 0; i < data2.size(); i++) {
			for (int j = i; j < data2.size(); j++) {
				if (data2[i]+data2[j] <= m) {
					data.push_back(data2[i]+data2[j]);
				} else {
					break;
				}
			}
		}
		data2.clear();
		sort(data.begin(), data.end());
		vector<long long int> data2;
		for (int i = 0; i < data.size(); i++) {
			for (int j = i; j < data.size(); j++) {
				if (data[i]+data[j] <= m) {
					data2.push_back(data[i]+data[j]);
				} else {
					break;
				}
			}
		}
		sort(data2.begin(), data2.end());
		long long int sz = data2.size();
		cout << data2[sz-1] << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:39: error: redeclaration of 'std::vector<long long int> data2'
   47 |                 vector<long long int> data2;
      |                                       ^~~~~
a.cc:24:39: note: 'std::vector<long long int> data2' previously declared here
   24 |                 vector<long long int> data2;
      |                                       ^~~~~
Language: C++

#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()
 
#define REP(i,s,e)	for(int i=(s); i<(e); i++)
#define rep(i,n)	REP(i,0,n)
#define REPE(i,s,e)	for(int i=s; i>e; i--)
#define repe(i,n)	REPE(i,n,-1)


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<vi> vvi;
 
const int IMAX=((1<<30)-1)*2+1;
const int INF=100000000;
const double EPS=1e-10;
//int mod=1000000007



const int MAX_N = 1000;
const int MAX_W = 200000000;

int dp[MAX_N + 1][MAX_W + 1][5];
int v[MAX_N], w[MAX_N];
int N,W;


int solve() {
	for(int i = 0; i < N; i++) {
		for(int j = 0; j <= W; j++){
			for(int k = 0; k < 5; k++){
				if(j < w[i] || k <1) {
					dp[i + 1][j][k] = dp[i][j][k];
				}
				else{
					dp[i + 1][j][k] = max(max(dp[i][j][k],dp[i][j-w[i]][k-1] + v[i]), dp[i + 1][j - w[i]][k-1] + v[i]);
				}
			}
		}
	}
	return dp[N][W][4];
}

int main(){
	int n, m;
	while(cin>>n>>m){
		N = n;
		W = m;
		for(int i = 0; i < n; i++){
			cin >> v[i];
			w[i] = v[i];
		}
		cout<<solve()<<endl;
	}
}

Compiler output:
/tmp/ccazbeA6.o: in function `solve()':
a.cc:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccazbeA6.o
a.cc:(.text+0xe1): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccazbeA6.o
a.cc:(.text+0x135): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccazbeA6.o
a.cc:(.text+0x151): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccazbeA6.o
a.cc:(.text+0x1a7): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccazbeA6.o
a.cc:(.text+0x262): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccazbeA6.o
a.cc:(.text+0x275): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccazbeA6.o
a.cc:(.text+0x284): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccazbeA6.o
a.cc:(.text+0x28a): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccazbeA6.o
/tmp/ccazbeA6.o: in function `main':
a.cc:(.text+0x2ce): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccazbeA6.o
a.cc:(.text+0x2d7): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()
 
#define REP(i,s,e)	for(int i=(s); i<(e); i++)
#define rep(i,n)	REP(i,0,n)
#define REPE(i,s,e)	for(int i=s; i>e; i--)
#define repe(i,n)	REPE(i,n,-1)


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<vi> vvi;
 
const int IMAX=((1<<30)-1)*2+1;
const int INF=100000000;
const double EPS=1e-10;
//int mod=1000000007



const int MAX_N = 1000;
const int MAX_W = 200000000;

int dp[MAX_N + 1][MAX_W + 1][5];
int v[MAX_N], w[MAX_N];
int N,W;


int solve() {
	for(int i = 0; i < N; i++) {
		for(int j = 0; j <= W; j++){
			for(int k = 0; k < 5; k++){
				if(j < w[i] || k <1) {
					dp[i + 1][j][k] = dp[i][j][k];
				}
				else{
					dp[i + 1][j][k] = max(max(dp[i][j][k],dp[i][j-w[i]][k-1] + v[i]), dp[i + 1][j - w[i]][k-1] + v[i]);
				}
			}
		}
	}
	return dp[N][W][4];
}

int main(){
	int n, m;
	while(cin>>n>>m){
		N = n;
		W = m;
		for(int i = 0; i < n; i++){
			cin >> v[i];
			w[i] = v[i];
		}
		cout<<solve()<<endl;
	}
}

Compiler output:
/tmp/ccc57zMh.o: in function `solve()':
a.cc:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccc57zMh.o
a.cc:(.text+0xe1): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccc57zMh.o
a.cc:(.text+0x135): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccc57zMh.o
a.cc:(.text+0x151): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccc57zMh.o
a.cc:(.text+0x1a7): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccc57zMh.o
a.cc:(.text+0x262): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccc57zMh.o
a.cc:(.text+0x275): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccc57zMh.o
a.cc:(.text+0x284): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccc57zMh.o
a.cc:(.text+0x28a): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccc57zMh.o
/tmp/ccc57zMh.o: in function `main':
a.cc:(.text+0x2ce): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccc57zMh.o
a.cc:(.text+0x2d7): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()
 
#define REP(i,s,e)	for(int i=(s); i<(e); i++)
#define rep(i,n)	REP(i,0,n)
#define REPE(i,s,e)	for(int i=s; i>e; i--)
#define repe(i,n)	REPE(i,n,-1)


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<vi> vvi;
 
const int IMAX=((1<<30)-1)*2+1;
const int INF=100000000;
const double EPS=1e-10;
//int mod=1000000007



const int MAX_N = 1000;
const int MAX_W = 200000000;

int dp[MAX_N + 1][MAX_W + 1][5];
int v[MAX_N], w[MAX_N];
int N,W;


int solve() {
	for(int i = 0; i < N; i++) {
		for(int j = 0; j <= W; j++){
			for(int k = 0; k < 5; k++){
				if(j < w[i] || k <1) {
					dp[i + 1][j][k] = dp[i][j][k];
				}
				else{
					dp[i + 1][j][k] = max(/*max(*/dp[i][j][k]/*,dp[i][j-w[i]][k-1] + v[i])*/, dp[i + 1][j - w[i]][k-1] + v[i]);
				}
			}
		}
	}
	return dp[N][W][4];
}

int main(){
	int n, m;
	while(cin>>n>>m){
		N = n;
		W = m;
		for(int i = 0; i < n; i++){
			cin >> v[i];
			w[i] = v[i];
		}
		cout<<solve()<<endl;
	}
}

Compiler output:
/tmp/cc59VyHz.o: in function `solve()':
a.cc:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cc59VyHz.o
a.cc:(.text+0xe1): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cc59VyHz.o
a.cc:(.text+0x135): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc59VyHz.o
a.cc:(.text+0x1de): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/cc59VyHz.o
a.cc:(.text+0x1f1): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cc59VyHz.o
a.cc:(.text+0x200): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cc59VyHz.o
a.cc:(.text+0x206): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/cc59VyHz.o
/tmp/cc59VyHz.o: in function `main':
a.cc:(.text+0x24a): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cc59VyHz.o
a.cc:(.text+0x253): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/cc59VyHz.o
a.cc:(.text+0x270): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc59VyHz.o
a.cc:(.text+0x299): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

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

int n, m, point1[1001], sum, ans;
vector<int> point2;

int solve(int start, int end, int border){
    int mid;
    while(1){
        if((end + start) % 2){
            mid = (end + start) / 2 + 1;
        } else{
            mid = (end + start) / 2;
        }

        if(point2[mid] > border){
            end = mid;
        } else{
            start = mid;
        }

        if(end - start == 1){
            if(point2[end] < border){
                return point2[end];
            } else{
                return point2[start];
            }
        }
    }
}

int main(){
    while(cin >> n >> m && n && m){
        for(int i = 0; i < n; i++){
            cin >> point1[i];
        }
        for(int i = 0; i < n + 1; i++){
            for(int j = 0; j < n + 1; j++){
                point2.push_back(point1[i] + point1[j]);
            }
        }

        sort(point1, point1 + n + 1);
        sort(point2.begin(), point2.end());

        for(int i = 0; i < n + 1; i++){
            if(point2[i] > m){
                continue;
            }
            ans = max(ans, points2[i] + solve(0, point2.size() - 1, m - point2[i]));
        }

        cout << ans << endl;

        memset(point1, 0, sizeof(point1));
        point2.clear();
        ans = 0;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:28: error: 'points2' was not declared in this scope; did you mean 'point2'?
   53 |             ans = max(ans, points2[i] + solve(0, point2.size() - 1, m - point2[i]));
      |                            ^~~~~~~
      |                            point2
Language: C++

#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define mp(x,y) make_pair(x,y)
#define ZERO(a) memset(a,0,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define pii pair<int,int>
#define INF 1<<29
#define MAX 1010
using namespace std;

int p[MAX];

void solve(){
 int n,m,ind;
 for(;;){
  cin>>n>>m;
  if(!n) break;
  int ma=0;
  vector<int> v;
  FOR(i,n){
   cin>>p[i];
   v.pb(p[i]);
  }
  FOR(i,n){
   FORR(j,i,n){
    v.pb(a[i]+a[j]);
   }
  }
  sort(v.begin(),v.end());
  erase(unique(v.begin(),v.end()),v.end());
  ind=upper_bound(v.begin(),v.end(),m)-1;
  if(ind>=0) ma=v[ind];
  FOR(i,v.size()){
   ind=upper_bound(v.begin(),v.end(),m-v[i])-1;
   if(ind>=0) ma=max(ma,v[i]+v[ind]);
  }
  cout<<ma<<endl;
 }
}

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

Compiler output:
a.cc: In function 'void solve()':
a.cc:29:10: error: 'a' was not declared in this scope
   29 |     v.pb(a[i]+a[j]);
      |          ^
a.cc:4:25: note: in definition of macro 'pb'
    4 | #define pb(a) push_back(a)
      |                         ^
a.cc:33:3: error: 'erase' was not declared in this scope
   33 |   erase(unique(v.begin(),v.end()),v.end());
      |   ^~~~~
a.cc:34:39: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int' in assignment
   34 |   ind=upper_bound(v.begin(),v.end(),m)-1;
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
      |                                       |
      |                                       __gnu_cxx::__normal_iterator<int*, std::vector<int> >
a.cc:37:45: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int' in assignment
   37 |    ind=upper_bound(v.begin(),v.end(),m-v[i])-1;
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
      |                                             |
      |                                             __gnu_cxx::__normal_iterator<int*, std::vector<int> >
Language: C++

#include <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

vector<vector<ll>> dp;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;
  while(cin >> n >> m && n && m){
    vary(ll,s,n,0);
    dp = dp(n+2,vector<ll>(m+2,inf));
    rep(i,n){
      cin >> s[i];
    }
    sort(all(s));
    rep(i,m+1){
      dp[0][i] = 0;
    }
    rep(i,n+1){
      dp[i][0] = 0;
    }
    REP(i,0,n){
      for(ll j = 0; j < m+1 + s[i]; j += s[i]){
        if(j - s[i] >= 0){
          dp[i+1][j] = min(dp[i+1][j],dp[i][j-s[i]]+1);
        }
      }
      if(i > 0){
        rep(j,m+1){
          dp[i+1][j] = min(dp[i][j],dp[i+1][j]);
        }
      }
    }
    ll ans = 0;
    for(ll j = n; j >= 0; --j){
      for(ll i = m; i >= 0; --i){
        if(dp[j][i] != inf && dp[j][i] != 0 && dp[j][i] <= m){
          ans = i;
          j = -1;
          break;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:12: error: no match for call to '(std::vector<std::vector<long long int> >) (ll, std::vector<long long int>)'
   66 |     dp = dp(n+2,vector<ll>(m+2,inf));
      |          ~~^~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;
int p[1001],s[1000000];
int main(){
	int n,m;
	cin>>n>>m;
	int top=1;
	p[0]=0,s[0]=0;
	for(int i=1;i<=n;i++){
		cin>>p[i];
		for(int j=0;j<i;j++){
			if(p[i]+p[j]<=m){s[top]=p[i]+p[j]top++;}
		}
	}
	int ans=0;
	for(int i=0;i<top;i++){
		int left=0,right=top,mid;
		while(true){
			if(left>=right-1)break;
			mid=(left+right)/2;
			if(s[mid]+s[i]<=m){ans=max(ans,s[mid]+s[i]),left=mid;}
			else right=mid;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:58: error: expected ';' before 'top'
   12 |                         if(p[i]+p[j]<=m){s[top]=p[i]+p[j]top++;}
      |                                                          ^~~
      |                                                          ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define INF 100000005
#define MAX 1002

long long p[MAX], dp[MAX];
int main(){
	long long n, m, ans;
	while(cin >> n >> m, n){
		fill(dp, dp+MAX, 0);
		for(int i = 0;i < n;i++)cin >> p[i];
		ans = 0;
		
		for(int i = 0;i < 3;i++){
			dp[0] = 5;
			for(int j = p[i];j <= m;j++){
				dp[j] = max(dp[j], dp[j-p[i]]-1);
				if(dp[j])ans = max(ans, j);
			}
		}
		//for(int i = 1;i <= 50;i++)cout << dp[i] << endl;
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:51: error: no matching function for call to 'max(long long int&, int&)'
   18 |                                 if(dp[j])ans = max(ans, 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:18:51: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   18 |                                 if(dp[j])ans = max(ans, 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:18:51: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   18 |                                 if(dp[j])ans = max(ans, j);
      |                                                ~~~^~~~~~~~
Language: C++

//http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2676345#1
//http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2676345#1
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
#include<fstream>
#include<cstring>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define P pair<int,int>
#define ll __int64

ll n,m;
ll t[10000];
const int MA=1000000;
ll s1[MA],s2[MA];


int main(){

while(cin>>n>>m,n||m){
rep(i,MA)s1[i]=s2[i]=0;
rep(i,10000)t[i]=0;

for(int i=1;i<=n;i++)cin>>t[i];
int g=0;

for(int i=0;i<=n;i++){
	for(int j=0;j<=n;j++){
		s1[i*(n+1)+j]=t[i]+t[j];
		g++;
	}
}


sort(s1,s1+g);
rep(i,g)s2[i]=s1[i];

int ans=0;

for(int i=0;i<g;i++){
	int now=s1[i];

	int l=0;
	int r=g-1;
	int mid=(l+r)/2;
	int x=s2[mid];

	for(int i=0;i<70;i++){
		if(x+now==m)break;
		if(l>r)break;
		if(x+now>m){
			r=mid;
			mid=(r+l)/2;
			x=s2[mid];
		}
		else{
			l=mid;
			mid=(r+l)/2;
			x=s2[mid];
		}
	}

	//cout<<" "<<x<<" "<<now<<" "<<x+now<<endl;
	if(x+now<=m)
	ans=max(ans,x+now);
}
cout<<ans<<endl;
}
	return 0;
}



Compiler output:
a.cc:19:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   19 | #define ll __int64
      |            ^~~~~~~
a.cc:21:1: note: in expansion of macro 'll'
   21 | ll n,m;
      | ^~
a.cc:19:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   19 | #define ll __int64
      |            ^~~~~~~
a.cc:22:1: note: in expansion of macro 'll'
   22 | ll t[10000];
      | ^~
a.cc:19:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   19 | #define ll __int64
      |            ^~~~~~~
a.cc:24:1: note: in expansion of macro 'll'
   24 | ll s1[MA],s2[MA];
      | ^~
a.cc: In function 'int main()':
a.cc:29:12: error: 'n' was not declared in this scope
   29 | while(cin>>n>>m,n||m){
      |            ^
a.cc:29:15: error: 'm' was not declared in this scope; did you mean 'tm'?
   29 | while(cin>>n>>m,n||m){
      |               ^
      |               tm
a.cc:30:10: error: 's1' was not declared in this scope
   30 | rep(i,MA)s1[i]=s2[i]=0;
      |          ^~
a.cc:30:16: error: 's2' was not declared in this scope
   30 | rep(i,MA)s1[i]=s2[i]=0;
      |                ^~
a.cc:31:13: error: 't' was not declared in this scope
   31 | rep(i,10000)t[i]=0;
      |             ^
a.cc:33:27: error: 't' was not declared in this scope
   33 | for(int i=1;i<=n;i++)cin>>t[i];
      |                           ^
a.cc:38:17: error: 's1' was not declared in this scope
   38 |                 s1[i*(n+1)+j]=t[i]+t[j];
      |                 ^~
a.cc:38:31: error: 't' was not declared in this scope
   38 |                 s1[i*(n+1)+j]=t[i]+t[j];
      |                               ^
a.cc:44:6: error: 's1' was not declared in this scope
   44 | sort(s1,s1+g);
      |      ^~
a.cc:45:9: error: 's2' was not declared in this scope
   45 | rep(i,g)s2[i]=s1[i];
      |         ^~
a.cc:55:15: error: 's2' was not declared in this scope
   55 |         int x=s2[mid];
      |               ^~
Language: C++

#include<stdio.h>
#include<iostream>
int main(){
int i,j,n,m,s=0,o;
static int ,p[1001],v[1001*1001]={0};
scanf("%d%d",&n,&m);
if(n==0&&m==0)return 0;
o=n+1;
for(i=1;i<=n;i++){
scanf("%d",&p[i]);
v[i]=p[i];
}
for(i=0;i<=n;i++){
for(j=i;j<=n;j++){
v[o]=p[i]+p[j];
o++;
}
}
for(i=0;i<o;i++){
for(j=i;j<o;j++){
if(v[i]+v[j]>s&&v[i]+v[j]<=m)s=v[i]+v[j];
}
}
printf("%d\n",s);
}
return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:5:12: error: expected unqualified-id before ',' token
    5 | static int ,p[1001],v[1001*1001]={0};
      |            ^
a.cc: At global scope:
a.cc:26:1: error: expected unqualified-id before 'return'
   26 | return 0;
      | ^~~~~~
a.cc:27:1: error: expected declaration before '}' token
   27 | }
      | ^
Language: C++

#include<stdio.h>
#include<iostream>
int main(){
while(1){
int i,j,n,m,s=0,o;
static int ,p[1001],v[1001*1001]={0};
scanf("%d%d",&n,&m);
if(n==0&&m==0)return 0;
o=n+1;
for(i=1;i<=n;i++){
scanf("%d",&p[i]);
v[i]=p[i];
}
for(i=0;i<=n;i++){
for(j=i;j<=n;j++){
v[o]=p[i]+p[j];
o++;
}
}
for(i=0;i<o;i++){
for(j=i;j<o;j++){
if(v[i]+v[j]>s&&v[i]+v[j]<=m)s=v[i]+v[j];
}
}
printf("%d\n",s);
}
return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:6:12: error: expected unqualified-id before ',' token
    6 | static int ,p[1001],v[1001*1001]={0};
      |            ^
Language: C++

#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	while(1){
		int i,j,n,m,s=0,o=1d=0;
		static int p[1001]={0},up[1001*1001]={0};
		scanf("%d%d",&n,&m);
		if(n==0&&m==0)return 0;
		up[0]=0;
		for(i=1;i<=n;i++){
			scanf("%d",&p[i]);
			for(j=i;j>=0;j--){
				up[o]=p[i]+p[j];
				o++;
			}
		}
		sort(up,up+o);
		for(i=0;i<o;i++){
			for(j=i;up[i]+up[j]<m&&j<o;j++);
			if(up[i]+up[j-1]<=m)s=max(s,up[i]+up[j-1]);
		}
		printf("%d\n",s);
	}
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:7:35: error: unable to find numeric literal operator 'operator""d'
    7 |                 int i,j,n,m,s=0,o=1d=0;
      |                                   ^~
Language: C++

#include<algorithm>
#include<vector>

#define MAX_N 1001

using namespace std;

int main(void){
	while( 1 ){
		int n, m;
		int V[MAX_N] = {0,};
		int D[MAX_N][4] = {0,{0,}};
		int Max = 0;

		cin >> n >> m;

		if( n == 0 && m == 0 ){
			break;
		}

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

		sort(V, V + n);
		reverse(V, V + n);

		for(int i = 0; i < n; i++){
			for(int j = 0; j < 4; j++){
				D[i][j] = V[i];
				if( j > 0 ){
					int thisMax = 0;
					for(int k = 0; k <= i; k++){
						int tmp = D[i][j] + D[k][j - 1];
						thisMax = max(thisMax, tmp > m ? 0 : tmp);
					}
					if( thisMax > D[i][j] ){
						D[i][j] = thisMax;
					}
				}
			}
		}

		for(int i = 0; i < n; i++){
			for(int j = 0; j < 4; j++){
				//cout << D[i][j] << ' ';
				if( D[i][j] <= m ){
					if( Max < D[i][j] ){
						Max = D[i][j];
					}
				}
			}
			//cout << '\n';
		}

		cout << Max << '\n';
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: 'cin' was not declared in this scope
   15 |                 cin >> n >> m;
      |                 ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<vector>
  +++ |+#include <iostream>
    3 | 
a.cc:58:17: error: 'cout' was not declared in this scope
   58 |                 cout << Max << '\n';
      |                 ^~~~
a.cc:58:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include<set>
#include<vector>
using namespace std;
typedef unsigned int uint;
uint maxv;
void solve(uint now,uint m,uint *a,int n){
  int r=n-1,l=0,mid;
  while(l <=r){
    mid = (l+r)/2;
    if ( a[mid]+now>m)r=mid-1;
    else if ( a[mid]+now <m)l=mid+1;
    else break;

  }
  if ( now+a[mid]>maxv&& now+a[mid]<m)maxv=now+a[mid];
}


main(){
  int n;
  uint m;
  while(scanf("%d%d",&n,&m) && n){
    set<uint> S;    
    uint one[n];
    uint two[n*n];
    int p=0;
    for(int i=0;i<n;i++)scanf("%d",&one[i]);
    for(int i=0;i<n;i++){
      for(int j=i;j<n;j++){
	if ( S.find(i+j) == S.end())S.insert(i+j),two[p++]=one[i]+one[j];
      }
    }
    sort(one,one+n);
    sort(two,two+p);
    maxv=0;
    for(int i=0;i<p;i++){
      if ( two[i]+one[0]>m)break;
      if ( two[i]+two[0]<=m)solve(two[i],m,two,p);
      if ( two[i]+one[0]<=m)solve(two[i],m,one,n);
    }
    printf("%d\n",maxv);
  }
  return false;
}

Compiler output:
a.cc:19:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   19 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:22:9: error: 'scanf' was not declared in this scope
   22 |   while(scanf("%d%d",&n,&m) && n){
      |         ^~~~~
a.cc:33:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   33 |     sort(one,one+n);
      |     ^~~~
      |     short
a.cc:41:5: error: 'printf' was not declared in this scope
   41 |     printf("%d\n",maxv);
      |     ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 | #include<vector>
  +++ |+#include <cstdio>
    3 | using namespace std;
Language: C++

#include<cstdio>
#include<algorithm>
#include<iostream>
#include<vector>
#include<set>
#include<queue>

using namespace std;

#define rep(i,n) for(int i=0;i<int(n);i++)
#define reps(i,n) for(int i=1;i<=int(n);i++)

#define f first
#define s second

int main(){
	while(1){
		int n,m;
		cin>>n>>m;
		
		if(n==0)break;
		
		vector<int> ya;
		ya.push_back(0);
		
		rep(i,n){
			int a;
			cin>>a;
			ya.push_back(a);
		}
		
		vector<int> y2;
		rep(i,ya.size()){
			rep(j,ya.size()){
				y2.push_back(ya[i]+ya[j]);
			}
		}
		
		sort(y2.begin(),y2.end());
		
		
		int maxi=0;
		
		rep(i,y2.size()){
			int *a = (lower_bound(y2.begin(),y2.end(),(m-y2[i]+1))-1);
			maxi= max(maxi,y2[i]+*a);
		}
		printf("%d\n",maxi);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:79: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int*' in initialization
   45 |                         int *a = (lower_bound(y2.begin(),y2.end(),(m-y2[i]+1))-1);
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
      |                                                                               |
      |                                                                               __gnu_cxx::__normal_iterator<int*, std::vector<int> >
Language: C++

#include<cstdio>
#include<algorithm>
#include<iostream>
#include<vector>
#include<set>
#include<queue>

using namespace std;

#define rep(i,n) for(int i=0;i<int(n);i++)
#define reps(i,n) for(int i=1;i<=int(n);i++)

#define f first
#define s second

int main(){
	while(1){
		int n,m;
		cin>>n>>m;
		
		if(n==0)break;
		
		vector<int> ya;
		ya.push_back(0);
		
		rep(i,n){
			int a;
			cin>>a;
			ya.push_back(a);
		}
		
		vector<int> y2;
		rep(i,ya.size()){
			rep(j,ya.size()){
				y2.push_back(ya[i]+ya[j]);
			}
		}
		
		sort(y2.begin(),y2.end());
		
		
		int maxi=0;
		
		rep(i,y2.size()){
			vector<int>::iterator = (lower_bound(y2.begin(),y2.end(),(m-y2[i]+1))-1);
			maxi= max(maxi,y2[i]+*a);
		}
		printf("%d\n",maxi);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:47: error: expected unqualified-id before '=' token
   45 |                         vector<int>::iterator = (lower_bound(y2.begin(),y2.end(),(m-y2[i]+1))-1);
      |                                               ^
a.cc:46:47: error: 'a' was not declared in this scope
   46 |                         maxi= max(maxi,y2[i]+*a);
      |                                               ^
Language: C++

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>

using namespace std;

#define sz			size()
#define lgt			length()
#define rep(i,n)	for (int i = 0; i < n; i++)
#define ALL(X)		(X).begin(),(X).end()
#define RALL(X)		(X).rbegin(),(X).rend()
#define pb			push_back
#define SORT(a)		sort(ALL(a));
#define RSORT(a)	sort(RALL(a));
#define mp			make_pair
#define dump(x)		cerr<<#x<<" = "<<(x)<<endl;
#define fir			first
#define sec			second

typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<string> vs;

int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
vs form(string a,char s){vs v;string b;rep(i,a.lgt){if(a[i]==s){v.pb(b);b="";}else b+=a[i];}v.pb(b);return v;}
vi formint(string a,char s){vi v;string b;rep(i,a.lgt){if(a[i]==s){v.pb(toInt(b));b="";}else b+=a[i];}v.pb(toInt(b));return v;}

const double EPS=1e-10,PI=acos(-1.0);
const int INF=2100000000;

int main(void)
{
	int n, m, tmp;
	while (cin >> n >> m, n && m){
		int res = 0;
		vi v, v1;
		
		v.pb(0);
		for (int i = 0; i < n; i++){
			cin >> tmp;
			v.pb(tmp);
		}
		for (int i = 0; i < v.sz; i++){
			for (int j = 0; j < v.sz; j++){
				v1.pb(v[i] + v[j]);
				v2.pb(v[i] + v[j]);
			}
		}
		SORT(v1);
		
		for (int i = 0, j = v1.sz - 1; i < v1.sz && 0 <= j;){
			if (m < v1[i] + v1[j]) j--;
			else {
				res = max(res, v1[i] + v1[j]);
				i++;
			}
		}
		
		cout << res << endl;
		v.clear();
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:33: error: 'v2' was not declared in this scope; did you mean 'v1'?
   61 |                                 v2.pb(v[i] + v[j]);
      |                                 ^~
      |                                 v1
Language: C++

#include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
	int a,b,mato[1000];
	vector<int> nums;
	while(scanf("%d%d",&a,&b),a,b){
		int res=0;
		nums.clear();
		for(int i=0;i<a;i++)scanf("%d",mato+i);
		for(int i=0;i<=a;i++)
			for(int j=0;j<=a;j++)
				nums.push_back(mato[i]*!!(i-a)+mato[j]!!(j-a));
				
		sort(nums.begin(),nums.end());
		vector<int>::iterator it=nums.begin();
		while(it!=nums.end() && b>=*it){
			vector<int>::iterator itt=upper_bound(nums.begin(),nums.end(),b-*it);
			res=max(res,*it+++*--itt);
		}
		printf("%d\n",res);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:71: error: expected ')' before '!' token
   14 |                                 nums.push_back(mato[i]*!!(i-a)+mato[j]!!(j-a));
      |                                               ~                       ^
      |                                                                       )
Language: C++

#include<iostream>
#include<cstring>
#include<queue>
using namespace std;

vector<long long int> p;
vector<long long int> p2;

int main(void){
	int a,b,n,m;
	while(1){
		long long int ans=0;
		scanf("%d%d",&n,&m);
		if(n==0 && m==0)break;
		p.clear();
		p2.clear();
		for(a=0;a<n;a++){
			int num;
			scanf("%d",&num);
			p.push_back(num);
		}
		sort(p.begin(),p.end());
		p2.push_back(0);
		for(a=0;a<n;a++){
			p2.push_back(p[a]);
			for(b=0;b<n;b++){
				p2.push_back(p[a]+p[b]);
			}
		}
		p2.push_back(0);
		sort(p2.begin(),p2.end());
		for(a=0;a<p2.size();a++){
			long long int res=m-p2[a];
			if(m-p2[a]<0)continue;
			long long int pp=*(lower_bound(p2.begin(),p2.end(),res)-1);
			if(ans<pp+p2[a])ans=pp+p2[a];
			//cout << pp+p2[a] << endl;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:17: error: 'sort' was not declared in this scope; did you mean 'short'?
   22 |                 sort(p.begin(),p.end());
      |                 ^~~~
      |                 short
Language: C++

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

int main(){
  int n, m;
  while(1){
    scanf("%d%d", &n, &m);
    if(n == 0 && m == 0)return 0;
    int res = 0, tmp;
    vector<int> points, points2;
    for(int i = 0;i < n;i++){
      scanf("%d", &tmp);
      points.push_back(tmp);
    }
    set<int>::iterator it1,it2;
    for(it1 = points.begin();it1 != points.end();it1++){
      for(it2 = points.begin();it2 != points.end();it2++){
	points2.push_back(*it1 + *it2);
      }
    }
    sort(points2.begin(),points2.end());
    for(it1 = points2.begin();it1 != points2.end();it1++){
      it2 = upper_bound(points2.begin(), points2.end(), m - *it1);
      if(it2 == points2.begin())continue;
      it2--;
      res = max(res, *it1 + *it2);
    }
    printf("%d\n",res);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: 'set' was not declared in this scope
   17 |     set<int>::iterator it1,it2;
      |     ^~~
a.cc:4:1: note: 'std::set' is defined in header '<set>'; this is probably fixable by adding '#include <set>'
    3 | #include<algorithm>
  +++ |+#include <set>
    4 | using namespace std;
a.cc:17:9: error: expected primary-expression before 'int'
   17 |     set<int>::iterator it1,it2;
      |         ^~~
a.cc:18:9: error: 'it1' was not declared in this scope
   18 |     for(it1 = points.begin();it1 != points.end();it1++){
      |         ^~~
a.cc:19:11: error: 'it2' was not declared in this scope
   19 |       for(it2 = points.begin();it2 != points.end();it2++){
      |           ^~~
a.cc:24:9: error: 'it1' was not declared in this scope
   24 |     for(it1 = points2.begin();it1 != points2.end();it1++){
      |         ^~~
a.cc:25:7: error: 'it2' was not declared in this scope
   25 |       it2 = upper_bound(points2.begin(), points2.end(), m - *it1);
      |       ^~~
Language: C++

#include <cstdio>

int main()
{
while(true) {
int n, m;
vector<int> x, xxx;
scanf("%d%d", &n, &m);
if(n == 0)
break;
x.resize(i);
for(int i = 0; i < n; ++i)
scanf("%d", &x[i]);
for(int i = 0; i < n; ++i) {
for(int j = 0; j < n; ++j)
xxx.push_back(x[i] + x[j]);
}
xxx.push_back(0);
sort(xxx.begin(), xxx.end());
int ans = 0;
for(int i = 0; i < xxx.size(); ++i) {
int r = m - xxx[i];
if(r < 0)
continue;
int idx = upper_bound(xxx.begin(), xxx.end(), r) - xxx.begin() - 1;
if(idx < 0)
continue;
ans = max(ans, r + xxx[idx]);
}
printf("%d\n", ans);
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:1: error: 'vector' was not declared in this scope
    7 | vector<int> x, xxx;
      | ^~~~~~
a.cc:7:8: error: expected primary-expression before 'int'
    7 | vector<int> x, xxx;
      |        ^~~
a.cc:11:1: error: 'x' was not declared in this scope
   11 | x.resize(i);
      | ^
a.cc:11:10: error: 'i' was not declared in this scope
   11 | x.resize(i);
      |          ^
a.cc:16:1: error: 'xxx' was not declared in this scope
   16 | xxx.push_back(x[i] + x[j]);
      | ^~~
a.cc:18:1: error: 'xxx' was not declared in this scope
   18 | xxx.push_back(0);
      | ^~~
a.cc:19:1: error: 'sort' was not declared in this scope; did you mean 'short'?
   19 | sort(xxx.begin(), xxx.end());
      | ^~~~
      | short
a.cc:25:11: error: 'upper_bound' was not declared in this scope
   25 | int idx = upper_bound(xxx.begin(), xxx.end(), r) - xxx.begin() - 1;
      |           ^~~~~~~~~~~
a.cc:28:7: error: 'max' was not declared in this scope
   28 | ans = max(ans, r + xxx[idx]);
      |       ^~~
Language: C++

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

int main()
{
while(true) {
int n, m;
vector<int> x, xxx;
scanf("%d%d", &n, &m);
if(n == 0)
break;
x.resize(i);
for(int i = 0; i < n; ++i)
scanf("%d", &x[i]);
for(int i = 0; i < n; ++i) {
for(int j = 0; j < n; ++j)
xxx.push_back(x[i] + x[j]);
}
xxx.push_back(0);
sort(xxx.begin(), xxx.end());
int ans = 0;
for(int i = 0; i < xxx.size(); ++i) {
int r = m - xxx[i];
if(r < 0)
continue;
int idx = upper_bound(xxx.begin(), xxx.end(), r) - xxx.begin() - 1;
if(idx < 0)
continue;
ans = max(ans, r + xxx[idx]);
}
printf("%d\n", ans);
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:10: error: 'i' was not declared in this scope
   14 | x.resize(i);
      |          ^
Language: C++

#include<cstdio>
#include<iostream>
#include<queue>
#include<vector>

using namespace std;

int main(void)
{
   vector<int>a;
   priority_queue<int>ans;

   int n,m;
   int input;

   while(scanf("%d%d",&n,&m),n+m)
   {
      a.clear();
      ans.clear();

      a.push_back(0);
      for(int i = 0;i < n;i++)
      {
         scanf("%d",&input);
         a.push_back(input);
      }

      int s = a.size();
      int one,two;
      for(int i = 0;i < s;i++)
         for(int j = 0;j < s;j++)
         {
            one = a[i],two = a[j];
            if(one + two <= m) a.push_back(one + two);
         }

      s = a.size();
      for(int i = 0;i < s;i++)
         for(int j = 0;j < s;j++)
         {
            one = a[i],two = a[j];
            if(one+two <= m) ans.push(one+two);
         }
      cout<<ans.top()<<endl;
   }
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:11: error: 'class std::priority_queue<int>' has no member named 'clear'
   19 |       ans.clear();
      |           ^~~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
	while(1){
	int n,m,p,q=0,r=0,l=0,s=0,e=0,ans=0;
	cin>>n>>m;
		if(n==0 && m==0)
			break;
	vector<int> a,x;
	a.push_back(0);
	for(int i=0;i<n;i++){
		cin>>p;
		a.push_back(p);
	}
	q=n+1;
	//cout<<q<<endl;
	for(int i=0;i<q;i++){
		for(int j=0;j<q;j++){
			x.push_back(a[i]+a[j]);
		}
	}
	sort(x.begin(),x.end());
	//for(int i=0;i<q*q;i++)
	//cout<<x[i]<<' ';
	//cout<<endl;
	for(int i=0;i<x.size();i++){
		r=m-x[i];
		//cout<<r<<"を探します"<<endl;
		if(r>=0){
			s=0;
			e=q*q;
			l=(s+e)/2;
			while(s<e){
				//cout<<"l="<<l<<endl;
				l=(s+e)/2;
				if(x[l]==r)break;
				if(x[l]>r){
					e=l-1;
				}else{
					s=l+1;
				}
			}
			while(x[l]>r&&p>0)
			p--;
			while(1){
				if(l+1==q*q)break;
				if(x[l+1]<=r){l++;
				else break;
				}
			}
		}
		ans=max(ans,x[i]+x[l]);
	}
		cout<<ans<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:33: error: expected '}' before 'else'
   50 |                                 else break;
      |                                 ^~~~
a.cc:49:46: note: to match this '{'
   49 |                                 if(x[l+1]<=r){l++;
      |                                              ^
a.cc:54:31: error: 'i' was not declared in this scope
   54 |                 ans=max(ans,x[i]+x[l]);
      |                               ^
a.cc:56:23: error: 'ans' was not declared in this scope; did you mean 'abs'?
   56 |                 cout<<ans<<endl;
      |                       ^~~
      |                       abs
a.cc: At global scope:
a.cc:58:9: error: expected unqualified-id before 'return'
   58 |         return 0;
      |         ^~~~~~
a.cc:59:1: error: expected declaration before '}' token
   59 | }
      | ^