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

#include <bits/stdc++.h>
using LL = long long;
using namespace std;
int main(){
    while(1){
        int N;cin >> N;
        if(N != 0){
            vector<int> vec;
            for(int a = 0;a < N;a++){
                int b;cin >> b;
                vec.push_back(b);
            }
            int dp[N+1][N+1];
            for(int a = 0;a <= N;a++){
                for(int b = 0;b <= N;b++){
                    dp[a][b] = -1;
                }
            }
            std::function<int(int,int)> calc = [&](int l, int r){
                if(dp[l][r] != -1)return dp[l][r];

                if(abs(l - r) <= 1)return 0;

                int ins = 0;

                if(abs(vec.at(l) - vec.at(r-1)) <= 1 && calc(l+1,r-1) == r - l -2){
                    ins = r - 1;
                }
                for(int mid = l + 1 ;mid <= r -1 ;mid++){
                    ins = max(ins, calc(l,mid) + calc(mid, r));
                }
                return dp[l][r] = ins;
            };
            calc(0,N);
            cout<<dp[0][N]<<endl;
        }else{
            return 0;
        }
    }
}



Compiler output:
a.cc: In lambda function:
a.cc:20:20: sorry, unimplemented: capture of variably-modified type 'int [(N + 1)][(N + 1)]' that is not an N3639 array of runtime bound
   20 |                 if(dp[l][r] != -1)return dp[l][r];
      |                    ^~
a.cc:20:20: note: because the array element type 'int [(N + 1)]' has variable size
a.cc:20:42: sorry, unimplemented: capture of variably-modified type 'int [(N + 1)][(N + 1)]' that is not an N3639 array of runtime bound
   20 |                 if(dp[l][r] != -1)return dp[l][r];
      |                                          ^~
a.cc:20:42: note: because the array element type 'int [(N + 1)]' has variable size
a.cc:32:24: sorry, unimplemented: capture of variably-modified type 'int [(N + 1)][(N + 1)]' that is not an N3639 array of runtime bound
   32 |                 return dp[l][r] = ins;
      |                        ^~
a.cc:32:24: note: because the array element type 'int [(N + 1)]' has variable size
Language: C++

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

//#define MAX 300
int n;
int* w;
vector<pair<int*,int>> wmap;

int* pop(int* w,int a) { //w???a????????¨a+1?????????????????????
	int *t;
	t = new int[n];
	for (int i = 0; i < n; i++) {
		if(i < a) t[i] = w[i];
		else t[i] = w[i + 2];
	}
	t[n - 2] = -1;
	t[n - 1] = -1;
	return t;
}


int daruma(int* w) {
	for (int i = 0; i < wmap.size(); i++) {
		if (memcmp(w, wmap[i].first, sizeof(w)) == 0) {
			return wmap[i].second;
		}
	}

	int max = 0;
	for (int i = 0; i < n - 1; i++) {
		if (w[i] != -1 && w[i + 1] != -1 && abs(w[i]-w[i+1])<=1) {
			int tmp = daruma(pop(w, i))+2;
			if (tmp > max) max = tmp;
		}
	}

	wmap.push_back(make_pair(w,max));
	return max;
}


int main() {
	cin >> n;
	while (n) {
		w = new int[n]();
		for (int i = 0; i < n; i++) {
			cin >> w[i];
		}
		cout << daruma(w) << endl;


		cin >> n;
	}


	return 0;
}

Compiler output:
a.cc: In function 'int daruma(int*)':
a.cc:28:21: error: 'memcmp' was not declared in this scope
   28 |                 if (memcmp(w, wmap[i].first, sizeof(w)) == 0) {
      |                     ^~~~~~
a.cc:6:1: note: 'memcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include<algorithm>
  +++ |+#include <cstring>
    6 | using namespace std;
Language: C++

#include<iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include<math.h>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;

//#define MAX 300
short n;
short* w;
vector<pair<short*,short> > wmap;

short* pop(short* w,short a) { //w???a????????¨a+1?????????????????????
	short *t;
	t = new short[n];
	for (short i = 0; i < n; i++) {
		if(i < a) t[i] = w[i];
		else t[i] = w[i + 2];
	}
	t[n - 2] = -1;
	t[n - 1] = -1;
	return t;
}

short daruma(short* w) {
	for (short i = 0; i < wmap.size(); i++) {
		if (memcmp(w, wmap[i].first, sizeof(w)) == 0) {
			return wmap[i].second;
		}
	}

	short max = 0;
	for (short i = 0; i < n - 1; i++) {
		if (w[i] != -1 && w[i + 1] != -1 && abs(w[i]-w[i+1])<=1) {
			short tmp = daruma(pop(w, i))+2;
			if (tmp > max) max = tmp;
		}
	}

	wmap.push_back(make_pair(w,max));
	return max;
}

short main() {
	cin >> n;
	while (n) {
		wmap.clear();
		w = new short[n]();
		for (short i = 0; i < n; i++) {
			cin >> w[i];
		}
		cout << daruma(w) << endl;
		cin >> n;
	}
	return 0;
}

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

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

vector<int>as;
bool ok(int a,int b){
  return abs(as[a]-as[b])<=1;
}

int main() {
  while(1){
    
    int N;cin>>N;
    if(!N)break;
    as.resize(N);
    vector<vector<int>>dp(N+1,vector<int>(N+1,-100000));
    for(int i=0;i<N;++i){
      int a;cin>>a;as[i]=a;
    }
    for(int i=0;i<=N;++i){
      dp[i][i]=0;
    }
    for(int t=2;t<=N;++t){
      for(int l=0;l<=N-t;++l){
	const int r=l+t;
	dp[l][r]=max(dp[l+1][r],dp[l][r-1]);
	if(ok(l,l+1))dp[l][r]=max(dp[l+2][r]+2,dp[l][r]);
	if(ok(r-2,r-1))dp[l][r]=max(dp[l][r-2]+2,dp[l][r]);
	if(ok(l,r-1)){
	  if(dp[l+1][r-1]==(r-l-2)){
	    dp[l][r]=max(dp[l+1][r-1]+2,dp[l][r]);
	  }
	}
      } 
    }

    int ans=dp[0][N];
    ans=max(0,ans)
    cout<<ans<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:19: error: expected ';' before 'cout'
   37 |     ans=max(0,ans)
      |                   ^
      |                   ;
   38 |     cout<<ans<<endl;
      |     ~~~~
Language: C++

#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)


int xcomp(vector<LL>& a, vector<LL>& b) {
	return a[0] < b[0];
}

#define XSORT(c) sort((c).begin(),(c).end(),xcomp)

#define ALL(x) (x).begin(),(x).end()
LL mod = 1000000007;

bool hantei(LL a, LL b) {
	if (a + 1 == b) {
		return true;
	}
	else
		if (a == b) {
			return true;
		}
		else
			if (a == b + 1) {
				return true;
			}
			else {
				return false;
			}
}

int main() {
	while (true)
	{
		LL  n;
		cin >> n;
		if (n == 0) {
			break;
		}

		vector<LL> num(n, 0);
		vector<LL> v(n, -9999);

		REP(i, n) {
			cin >> v[i];
		}
		REP(i, n - 1) {
			if (hantei(v[i], v[i + 1])) {
				num[i] = 2;
			}
		}

		bool flag = true;

		while (flag) {
			flag = false;

			REP(i, n) {
				LL hoge = num[i];
				if (i + num[i]<n) {
					if (hoge < num[i] + num[i + num[i]]) {
						hoge = num[i] + num[i + num[i]];
					}
				}
				if (i + 1<n) {
					if (i + num[i + 1] + 1<n) {
						if (hantei(v[i], v[i + num[i + 1] + 1])) {
							if (hoge < num[i + 1] + 2) {
								hoge = num[i + 1] + 2;
							}
						}a
					}
				}
				if (hoge != num[i]) {
					flag = true;
					num[i] = hoge;
				}
			}
		}


		vector<LL> fuga(n * 3, 0);

		for (int i = n - 1; i >= 0; --i) {
			fuga[i] = max(fuga[i + 1], num[i] + fuga[i + num[i]]);
		}

		cout << fuga[0] << endl;
	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:107:50: error: 'a' was not declared in this scope
  107 |                                                 }a
      |                                                  ^
Language: C++

# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <numeric>
# include <tuple>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
#define ALL(x)    (x).begin(),(x).end()
#define UNIQ(c)   (c).erase(unique(ALL((c))), end((c)))
#define mp        make_pair
#define eb        emplace_back
typedef pair<LL, LL> P;
typedef pair<P, P> PP;

int N;
int W[333];

bool dp[333][333];
int dp2[333];
void solve() {
	for (int i = 0; i < N; i++)cin >> W[i];
	memset(dp, 0, sizeof(dp));
	for (int i = 0; i < N; i++)dp[i][i] = true;

	for (int len = 2; len <= N; len++) {
		for (int i = 0; i + len <= N; i++) {
			int j = i + len;
			if (abs(W[i] - W[j - 1]) <= 1)dp[i][j] |= dp[i + 1][j - 1];
			for (int k = i + 1; k < j; k++)dp[i][j] |= dp[i][k] & dp[k][j];
		}
	}
	memset(dp2, 0, sizeof(dp2));
	for (int i = 0; i < N; i++) {
		dp2[i + 1] = max(dp2[i + 1], dp2[i]);
		for (int j = i + 1; j <= N; j++)if (dp[i][j])dp2[j] = max(dp2[j], dp2[i] + j - i);
	}
	cout << dp2[N] << endl;
}
int main() {
	while (cin >> N, N)solve();
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:42:9: error: 'memset' was not declared in this scope
   42 |         memset(dp, 0, sizeof(dp));
      |         ^~~~~~
a.cc:17:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   16 | # include <numeric>
  +++ |+#include <cstring>
   17 | # include <tuple>
Language: C++

#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stacq>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<deque>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

using namespace std;

#define DBG cerr << '!' << endl;
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_bacq
#define MP maqe_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int dp[310][310];

int main()
{
	int n;
	
	while(cin >> n,n)
	{
		REP(i,310)REP(j,310)dp[i][j] = 0;
		
		vector<int> v(n);
		REP(i,n)cin >> v[i];
		
		REP(i,n-1)if(abs(v[i]-v[i+1]) < 2)dp[i][i+1] = 2;
		
		for(int q = 2;q < n;q++)
		{
			for(int i = 0;i+q < n;i++)
			{
				int j = i+q;
				for(int k = 0;k < j-i;k++)
				{
					dp[i][j] = max(dp[i][j],dp[i][i+k]+dp[i+k+1][j]);
				}
				if(dp[i+1][j-1] == j-i-1)
				{
					int tmp = 0;
					if(abs(v[i]-v[j])<2)tmp = 2;
					dp[i][j] = max(dp[i][j],j-i-1+tmp);
				}
			}
		}
		
		cout << dp[0][n-1] << endl;
		
	}
	
	
	return 0;
}


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

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <string.h>
#include <cmath>
#include <functional>

using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;

int n;

//[l,r)
		function<int(int,int)> rec = [&](int l,int r){
			if(dp[l][r] != -1) return dp[l][r];

			if(abs(l - r) <= 1) return 0;

			int res = 0;
			//l [able] r ?
			if(abs(w[l] - w[r - 1]) <= 1 && rec(l + 1,r - 1) == r - l - 2)
			{
				res = r - l;
			}

			//[l any] [any r]
			for(int mid = l + 1;mid <= r - 1;mid++)
			{
				res = max(res , rec(l,mid) + rec(mid,r));
			}
			return dp[l][r] = res;
		};

int main()
{
	while(cin >> n , n)
	{
		vector<int> w(n,0);
		for(int i = 0;i < n;i++) cin >> w[i];

		vector<vector<int>> dp(n + 1,vector<int>(n + 1,-1));

		

		cout << rec(0,n) << endl;
	}
}
				


			




Compiler output:
a.cc:20:47: error: non-local lambda expression cannot have a capture-default
   20 |                 function<int(int,int)> rec = [&](int l,int r){
      |                                               ^
a.cc: In lambda function:
a.cc:21:28: error: 'dp' was not declared in this scope
   21 |                         if(dp[l][r] != -1) return dp[l][r];
      |                            ^~
a.cc:27:32: error: 'w' was not declared in this scope
   27 |                         if(abs(w[l] - w[r - 1]) <= 1 && rec(l + 1,r - 1) == r - l - 2)
      |                                ^
a.cc:37:32: error: 'dp' was not declared in this scope
   37 |                         return dp[l][r] = res;
      |                                ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define INF 1e9

int main(){

    int n, a, b; cin >> a >> b;
    n = abs(a - b);
    cout << n << endl;
    return 0;
}bool take[310][310];
int dp[310][310];

signed main() {
    int n;
    while(cin >> n, n) {
        int w[310];
        rep(i,0,n) cin >> w[i];
        memset(take, false, sizeof(take));
        memset(dp, 0, sizeof(dp));

        rep(i,0,n) {
            rep(j,0,n-i) {
                int len = i+1;
                int s = j, t = j+i;
                rep(k,s,t) {
                    if(take[s][k] && take[k+1][t]) take[s][t] = true;
                }
                if(len == 2) {
                    if(abs(w[s] - w[t]) < 2) {
                        take[s][t] = true;
                    }
                }
                if(take[s][t]) {
                    int x = s-1, y = t+1;
                    while(1) {
                        if(x < 0 || x >= n || y < 0 || y >= n) break;
                        if(abs(w[x] - w[y]) >= 2) break;
                        take[x][y] = true;
                        x--; y++;
                    }
                }
            }
        }

        rep(i,0,n) rep(j,i+1,n) {
            if(take[i][j]) dp[i][j] = j-i+1;
        }

        rep(i,0,n) rep(j,i,n) rep(k,i,j) {
            dp[i][j] = max(dp[i][j], dp[i][k] + dp[k+1][j]);
        }
        cout << dp[0][n-1] << endl;
    }
    return 0;
}


Compiler output:
a.cc:14:8: error: redefinition of 'int main()'
   14 | signed main() {
      |        ^~~~
a.cc:5:5: note: 'int main()' previously defined here
    5 | int main(){
      |     ^~~~
a.cc: In function 'int main()':
a.cc:18:13: error: 'i' was not declared in this scope
   18 |         rep(i,0,n) cin >> w[i];
      |             ^
a.cc:18:9: error: 'rep' was not declared in this scope
   18 |         rep(i,0,n) cin >> w[i];
      |         ^~~
Language: C++

#include <stdio.h>
#include <math.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
using namespace std;




int main(){
    int n,a[500]={};
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    bool j[500][500]={};
    for(int i=2;i<=n;i+=2){
        for(int t=0;t<=n-i;t++){
            if(abs(a[t]-a[t+i-1])<=1 && (j[t+1][t+i-2] || i==2)){j[t][t+i-1]=true; continue;}
            for(int h=t+1;h<t+i-1;h++){
                if(j[t][h] && j[h+1][t+i-1]){j[t][t+i-1]=true; break;}
            }
        }
    }
    int dp[500];
    fill(dp,dp+500,INT_MAX/2);
    dp[0]=0;
    for(int i=0;i<n;i++){
        if(i!=0){dp[i]=min(dp[i],dp[i-1]+1);}
        for(int t=i;t<n;t++){
            if(j[i][t]){dp[t+1]=min(dp[t+1],dp[i]);}
        }
    }
    
    /*
    for(int i=0;i<n;i++){
        for(int t=0;t<n;t++){
            cout<<(j[i][t]?"1":"0")<<" ";
        }
        cout<<endl;
    }
    */

        cout<<n-dp[n-1]-1<<endl;

    
    
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:20: error: 'INT_MAX' was not declared in this scope
   34 |     fill(dp,dp+500,INT_MAX/2);
      |                    ^~~~~~~
a.cc:13:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   12 | #include<numeric>
  +++ |+#include <climits>
   13 | using namespace std;
Language: C++

#include <stdio.h>
#include <math.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
using namespace std;




int main(){
    while(1){
        
        
        
        
    
    int n,a[500]={};
    cin>>n;
        if(n==0){break;}
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    bool j[500][500]={};
    for(int i=2;i<=n;i+=2){
        for(int t=0;t<=n-i;t++){
            if(abs(a[t]-a[t+i-1])<=1 && (j[t+1][t+i-2] || i==2)){j[t][t+i-1]=true; continue;}
            for(int h=t+1;h<t+i-1;h++){
                if(j[t][h] && j[h+1][t+i-1]){j[t][t+i-1]=true; break;}
            }
        }
    }
    int dp[500];
    fill(dp,dp+500,INT_MAX/2);
    dp[0]=1;
    for(int i=0;i<n;i++){
        if(j[0][i]){dp[i]=0;}
    }
    for(int i=1;i<n;i++){
        dp[i]=min(dp[i],dp[i-1]+1);
        for(int t=i;t<n;t++){
            if(j[i][t]){dp[t]=min(dp[t],dp[i-1]);}
        }
    }
    
    /*
    for(int i=0;i<n;i++){
        for(int t=0;t<n;t++){
            cout<<(j[i][t]?"1":"0")<<" ";
        }
        cout<<endl;
    }
     */
    
    //for(int i=0;i<n;i++){
        cout<<n-dp[n-1]<<endl;
    //}
    
    
        
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:20: error: 'INT_MAX' was not declared in this scope
   41 |     fill(dp,dp+500,INT_MAX/2);
      |                    ^~~~~~~
a.cc:13:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   12 | #include<numeric>
  +++ |+#include <climits>
   13 | using namespace std;
Language: C++

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

int main(){
  int n;
  while(cin >> n, n){
    vector<int> w(n); rep(i,n) cin >> w[i];
    vector<vector<int>> dp(n+1,vector<int>(n+1));

    // 区間DP
    FOR(j,2,n+1){ // 区間長
      for(int i = 0; i+j <= n; ++i;){ // 区間左端 dp[i][i+j]を決定する
	//printf("[%d,%d)\n",i,i+j);
	FOR(k,2,j-1) // dp[i][i+k],dp[i+k][i+j]を元に計算
	  dp[i][i+j] = max(dp[i][i+j], dp[i][i+k]+dp[i+k][i+j]);
	
	if(abs(w[i] - w[i+j-1]) <= 1)
	  dp[i][i+j] = max(dp[i][i+j], dp[i+1][i+j-1] + 2);
      }
    }

    cout << dp[0][n] << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:35: error: expected ')' before ';' token
   14 |       for(int i = 0; i+j <= n; ++i;){ // 区間左端 dp[i][i+j]を決定する
      |          ~                        ^
      |                                   )
a.cc:14:36: error: expected primary-expression before ')' token
   14 |       for(int i = 0; i+j <= n; ++i;){ // 区間左端 dp[i][i+j]を決定する
      |                                    ^
Language: C++

      if(f&&vi.size()==k){
        for(j=0;j<k;j++) t+=c[vi[j]][vi[(j+1)%k]];
        ans=max(ans,t);
      }else{
        for(j=0;j<k-1;j++) t+=c[vi[j]][vi[j+1]];
        ans=max(ans,t);
        for(j=0;j<vi.size()-k;j++){
          t+=c[vi[k-1+j]][vi[k+j]]-c[vi[j]][vi[j+1]];
          ans=max(ans,t);
        } 
      }
    }
    if(~ans) cout << s*s*6*k-ans << endl;
    else cout << -1 << endl;
  }
  return 0;
}

Compiler output:
a.cc:1:7: error: expected unqualified-id before 'if'
    1 |       if(f&&vi.size()==k){
      |       ^~
a.cc:4:8: error: expected unqualified-id before 'else'
    4 |       }else{
      |        ^~~~
a.cc:12:5: error: expected declaration before '}' token
   12 |     }
      |     ^
a.cc:13:5: error: expected unqualified-id before 'if'
   13 |     if(~ans) cout << s*s*6*k-ans << endl;
      |     ^~
a.cc:14:5: error: expected unqualified-id before 'else'
   14 |     else cout << -1 << endl;
      |     ^~~~
a.cc:15:3: error: expected declaration before '}' token
   15 |   }
      |   ^
a.cc:16:3: error: expected unqualified-id before 'return'
   16 |   return 0;
      |   ^~~~~~
a.cc:17:1: error: expected declaration before '}' token
   17 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <queue>
using namespace std;
typedef long long ll;

int H, W;

vector<int> dxw = { 1, 0, -1, 0 };
vector<int> dyw = { 0, 1, 0, -1 };
vector<int> dxb = { 1, 0, -1, 0, 1, 1, -1, -1 };
vector<int> dyb = { 0, 1, 0, -1, 1, -1, 1, -1 };

struct P {
	int x, y;
};

bool in(int x, int y) {
	return 0 <= x && x < W && 0 <= y && y < H;
}

pair<vector<vector<int>>, vector<vector<P>>> color(const vector<string>& b) {
	vector<vector<int>> C(H, vector<int>(W, -1));
	vector<vector<P>> pos;

	int n = 0;
	for(int y = 0; y < H; y++) {
		for(int x = 0; x < W; x++) {
			if(C[y][x] != -1) continue;
			vector<P> ps;
			queue<P> q;
			q.push({ x, y });
			ps.push_back({ x, y });
			C[y][x] = n;
			while(q.size()) {
				int cx = q.front().x, cy = q.front().y;
				q.pop();
				vector<int> dx, dy;
				if(b[y][x] == '.') dx = dxw, dy = dyw;
				else dx = dxb, dy = dyb;
				for(int k = 0; k < dx.size(); k++) {
					int nx = cx + dx[k], ny = cy + dy[k];
					if(!in(nx, ny)) continue;
					if(b[ny][nx] != b[y][x]) continue;
					if(C[ny][nx] != -1) continue;
					q.push({ nx, ny });
					ps.push_back({ nx, ny });
					C[ny][nx] = n;
				}
			}
			pos.push_back(ps);
			n++;
		}
	}
	return{ C, pos };
}

vector<vector<int>> build(const vector<string>& b) {
	auto res = color(b);
	auto C = res.first;
	auto pos = res.second;
	int n = pos.size();

	vector<vector<int>> G(n);
	vector<vector<int>> check(H, vector<int>(W));
	vector<int> checkV(n);
	queue<int> q;
	q.push(0);
	checkV[0] = 1;
	while(q.size()) {
		int v = q.front();
		q.pop();
		for(auto p : pos[v]) {
			check[p.y][p.x] = 1;
		}

		for(auto p : pos[v]) {
			vector<int> dx = dxw, dy = dyw;
			for(int k = 0; k < dx.size(); k++) {
				int nx = p.x + dx[k], ny = p.y + dy[k];
				if(!in(nx, ny)) continue;
				if(check[ny][nx]) continue;
				if(b[p.y][p.x] == b[ny][nx]) continue;
				int u = C[ny][nx];
				if(checkV[u]) continue;
				checkV[u] = 1;
				q.push(u);
				G[v].push_back(u);
			}
		}
	}

	return G;
}

string f(int v, int p, const vector<vector<int>>& G) {
	vector<string> s;
	for(auto c : G[v]) {
		if(c == p) continue;
		s.push_back(f(c, v, G));
	}

	sort(s.begin(), s.end());
	string ret;
	for(auto ss : s) {
		ret += ss;
	}
	ret = "(" + ret + ")";
	return ret;
}

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

	while(cin >> H >> W, H) {
		string tree[2];
		for(int i = 0; i < 2; i++) {
			if(i == 1) {
				cin >> H >> W;
			}
			H += 2, W += 2;
			vector<string> b;
			b.push_back(string(W, '.'));
			for(int j = 0; j < H - 2; j++) {
				string p;
				cin >> p;
				b.push_back("." + p + ".");
			}
			b.push_back(string(W, '.'));

			auto G = build(b);
			tree[i] = f(0, -1, G);
		}

		if(tree[0] == tree[1]) cout << "yes" << endl;
		else cout << "no" << endl;

	}
}

Compiler output:
a.cc: In function 'std::string f(int, int, const std::vector<std::vector<int> >&)':
a.cc:104:9: error: 'sort' was not declared in this scope; did you mean 'short'?
  104 |         sort(s.begin(), s.end());
      |         ^~~~
      |         short
Language: C++

#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

struct edge{
	int to,cap,rev;
	edge(){}
	edge(int tt,int cc,int rr){
		to=tt;
		cap=cc;
		rev=rr;
	}
};

int n,m;
vector<edge> G[105];
int cnt[105];


void add_edge(int from,int to,int cap){
	G[from].push_back(edge(to,cap,G[to].size()));
	G[to].push_back(edge(from,0,G[from].size()-1));
}

bool used[105];

int dfs(int v,int t,int f){
	used[v]=true;
	for(int i=0;i<G[v].size();i++){
		edge &e=G[v][i];
		if(!used[e.to] && e.cap>0){
			int d=dfs(e.to,t,min(f,e.cap));
			if(d>0){
				e.cap-=d;
				G[e.to][e.rev].cap+=d;
				return d;
			}
		}
	}
	return 0;
}

void solve(){
	for(int i=0;i<n;i++){
		G[i].clear();
	}
	memset(cnt,0,sizeof(cnt));
	for(int i=0;i<m;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		u--;
		v--;
		add_edge(u,v,1);
		cnt[u]++;
	}
	bool update=true;
	while(update){
		update=false;
		int p_min=0,p_max=0;
		for(int i=1;i<n;i++){
			if(cnt[p_min]>cnt[i]){
				p_min=i;
			}
			if(cnt[p_max]<cnt[i]){
				p_max=i;
			}
		}
		for(int i=0;i<n;i++){
			if(!update && cnt[p_min]+1<cnt[i] && used2[i]){
				memset(used,false,sizeof(used));
				int val=dfs(i,p_min,1);
				if(val>0){
					update=true;
					cnt[i]--;
					cnt[p_min]++;
					break;
				}
							
			}
		}
		for(int i=0;i<n;i++){
			if(!update && cnt[i]+1<cnt[p_max] && used2[i]){
				memset(used,false,sizeof(used));
				int val=dfs(p_max,i,1);
				if(val>0){
					update=true;
					cnt[p_max]--;
					cnt[i]++;
					break;
				}
				
			}
		}
		if(!update){
			printf("%d %d\n",cnt[p_min],cnt[p_max]);
			return;
		}
	}
}

int main(void){
	while(1){
		scanf("%d%d",&n,&m);
		if(n==0 && m==0)break;
		solve();
	}
	return 0;
} 


Compiler output:
a.cc: In function 'void solve()':
a.cc:71:62: error: 'used2' was not declared in this scope; did you mean 'used'?
   71 |                         if(!update && cnt[p_min]+1<cnt[i] && used2[i]){
      |                                                              ^~~~~
      |                                                              used
a.cc:84:62: error: 'used2' was not declared in this scope; did you mean 'used'?
   84 |                         if(!update && cnt[i]+1<cnt[p_max] && used2[i]){
      |                                                              ^~~~~
      |                                                              used
Language: Java

// 1616

import java.util.Scanner;

public class test2 {

	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 a[] = new int[n];
			int an = 0;
			int answer = 0;
			int a_min = 1000001;
			int a_second_min = 1000001;
			for (int i = 0; i < n; i++) {
				an = sc.nextInt();
				a[i] = an;
				if (an < a_min) {
					a_second_min = a_min;
					a_min = an;
				} else if (a_min < an && an < a_second_min) {
					a_second_min = an;
				}
				
				for (int j = 0; j < i; j++) {
					if ((a[j] + an) > answer && (a[j] + an) <= m) {
						answer = a[j] + an;
					}
				}
			}
			
//			System.out.println(a_min);
//			System.out.println(a_second_min);
//			
			if ((a_min + a_second_min) > m) {
				System.out.println("NONE");
			} else {
				System.out.println(answer);
			}
			
			
		}
	}
}

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

// 1616

import java.util.Scanner;

public class main {

	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 a[] = new int[n];
			int an = 0;
			int answer = 0;
			int a_min = 1000001;
			int a_second_min = 1000001;
			for (int i = 0; i < n; i++) {
				an = sc.nextInt();
				a[i] = an;
				if (an < a_min) {
					a_second_min = a_min;
					a_min = an;
				} else if (a_min < an && an < a_second_min) {
					a_second_min = an;
				}
				
				for (int j = 0; j < i; j++) {
					if ((a[j] + an) > answer && (a[j] + an) <= m) {
						answer = a[j] + an;
					}
				}
			}
			
//			System.out.println(a_min);
//			System.out.println(a_second_min);
//			
			if ((a_min + a_second_min) > m) {
				System.out.println("NONE");
			} else {
				System.out.println(answer);
			}
			
			
		}
	}
}

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

import java.util.*;
public class Taro_shopping{
    public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
	int n;
	int m;
	int[] cost;
	int max;
	int tmp;
	while(hasNextLine()){
	    n=sc.nextInt();    //品物の個数
	    m=sc.nextInt();    //最大の金額
	    if(n!=0 && m!=0){
		cost=new int[n];
		max=0;
		tmp=0;
		for(int i=0;i<n;i++){
		    cost[i]=sc.nextInt();
		}
		for(int i=0;i<n-1;i++){
		    for(int j=i+1;j<n;j++){
			tmp=cost[i]+cost[j];
			if(tmp>max && tmp<=m){
			    max=tmp;
			}
		    }
		}
		System.out.println(max);
	    }
	}
    }
}


Compiler output:
Main.java:2: error: class Taro_shopping is public, should be declared in a file named Taro_shopping.java
public class Taro_shopping{
       ^
Main.java:10: error: cannot find symbol
	while(hasNextLine()){
	      ^
  symbol:   method hasNextLine()
  location: class Taro_shopping
2 errors
Language: Java

import java.util.*;
public class Taro_shopping{
    public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
	int n;
	int m;
	int[] cost;
	int max;
	int tmp;
	while(sc.hasNextLine()){
	    n=sc.nextInt();    //品物の個数
	    m=sc.nextInt();    //最大の金額
	    if(n!=0 && m!=0){
		cost=new int[n];
		max=0;
		tmp=0;
		for(int i=0;i<n;i++){
		    cost[i]=sc.nextInt();
		}
		for(int i=0;i<n-1;i++){
		    for(int j=i+1;j<n;j++){
			tmp=cost[i]+cost[j];
			if(tmp>max && tmp<=m){
			    max=tmp;
			}
		    }
		}
		System.out.println(max);
	    }else{
		break;
	    }
	}
    }
}


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

import java.util.*;
public class Taro_shopping{
    public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
	int n;
	int m;
	int[] cost;
	String[] max=new String[10000];
	int tmp;
	int cnt=0;
	while(sc.hasNextLine()){
	    n=sc.nextInt();    //品物の個数
	    m=sc.nextInt();    //最大の金額
	    if(n!=0 && m!=0){
		cost=new int[n];
		max[cnt]="0";
		tmp=0;
		for(int i=0;i<n;i++){
		    cost[i]=sc.nextInt();
		}
		for(int i=0;i<n-1;i++){
		    for(int j=i+1;j<n;j++){
			tmp=cost[i]+cost[j];
			if(tmp>Integer.parseInt(max[cnt]) && tmp<=m){
			    max[cnt]=String.valueOf(tmp);
			}
		    }
		}
		if(max[cnt].equals("0")){
		    max[cnt]="NONE";
		}
	    }else{
		break;
	    }
	    cnt+=1;
	}
	for(int i=0;i<cnt;i++){
	    System.out.println(max[i]);
	}
    }
}


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

import java.util.*;
public class Taro_shopping{
    public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
	int n;
	int m;
	int[] cost;
	String[] max=new String[10000];
	int tmp;
	int cnt=0;
	while(sc.hasNextLine()){
	    n=sc.nextInt();    //品物の個数
	    m=sc.nextInt();    //最大の金額
	    if(n!=0 && m!=0){
		cost=new int[n];
		max[cnt]="0";
		tmp=0;
		for(int i=0;i<n;i++){
		    cost[i]=sc.nextInt();
		}
		for(int i=0;i<n-1;i++){
		    for(int j=i+1;j<n;j++){
			tmp=cost[i]+cost[j];
			if(tmp>Integer.parseInt(max[cnt]) && tmp<=m){
			    max[cnt]=String.valueOf(tmp);
			}
		    }
		}
		if(max[cnt].equals("0")){
		    max[cnt]="NONE";
		}
	    }else{
		break;
	    }
	    cnt+=1;
	}
	for(int i=0;i<cnt;i++){
	    System.out.println(Integer.parseInt(max[i]));
	}
    }
}


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

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

public class a{
    public static void solution(int[] array,int n,int m){
        int i,j,max,temp;
        max = 0;
        for (i=0;i<n;i++){
            for (j=i+1;j<n;j++){
                temp = array[i] + array[j];
                //System.out.print(temp+" ");
            if (temp > max && temp <= m) max = temp;
            }
        }
        if (max == 0){
            System.out.println("NONE");
        }else{
            System.out.println(max);
        }
    }
    public static void main(String[] args){
        //final String FILENAME = "atest.txt";
        BufferedReader br = null;
            br = new BufferedReader(new InputStreamReader(System.in));
            String curr;
            while(!(curr = br.readLine()).equals("0 0")){
                String[] nm = curr.split(" ");
                int n = Integer.parseInt(nm[0]);
                int m = Integer.parseInt(nm[1]);
                curr = br.readLine();
                String[] a = curr.split(" ");
                int[] array = new int[1024];
                //System.out.println("ARRAY");
                for (int i = 0; i < n ; i++){
                    array[i] = Integer.parseInt(a[i]);
                    //System.out.print(array[i]+" ");
                }
                //System.out.println();
                solution(array,n,m);
            }
    }
}


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

import java.io.BufferedReader;
import java.io.*;

public class a{
    public static void solution(int[] array,int n,int m){
        int i,j,max,temp;
        max = 0;
        for (i=0;i<n;i++){
            for (j=i+1;j<n;j++){
                temp = array[i] + array[j];
                //System.out.print(temp+" ");
            if (temp > max && temp <= m) max = temp;
            }
        }
        if (max == 0){
            System.out.println("NONE");
        }else{
            System.out.println(max);
        }
    }
    public static void main(String[] args){
        //final String FILENAME = "atest.txt";
        BufferedReader br = null;

        try{
            br = new BufferedReader(new InputStreamReader(System.in));
            String curr;
            while(!(curr = br.readLine()).equals("0 0")){
                String[] nm = curr.split(" ");
                int n = Integer.parseInt(nm[0]);
                int m = Integer.parseInt(nm[1]);
                curr = br.readLine();
                String[] a = curr.split(" ");
                int[] array = new int[1024];
                //System.out.println("ARRAY");
                for (int i = 0; i < n ; i++){
                    array[i] = Integer.parseInt(a[i]);
                    //System.out.print(array[i]+" ");
                }
                //System.out.println();
                solution(array,n,m);
            }
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}


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

import java.util.*;
public class Main {
    public static void main(String[] args) {
        while (true) {
            int n = Integer.parseInt(sc.next());
            int m = Integer.parseInt(sc.next());
            if (n == 0) break;
            int[] a = new int[n];
            for (int i - 0; i < n; i++)
                a[i] = Integer.parseInt(sc.next());
            int max = 0;
            for (int i = 0; i < n; i++)
                for (int j = i + 1; j < n; j++)
                    max = Math.max(max, (a[i] + a[j] <= m)? a[i] + a[j] : 0);
            System.out.println((max == 0)? "NONE" : max);
        }
    }
}


Compiler output:
Main.java:9: error: ';' expected
            for (int i - 0; i < n; i++)
                      ^
Main.java:9: error: not a statement
            for (int i - 0; i < n; i++)
                              ^
Main.java:9: error: ')' expected
            for (int i - 0; i < n; i++)
                                 ^
Main.java:9: error: ';' expected
            for (int i - 0; i < n; i++)
                                      ^
4 errors
Language: Java

import java.util.*;
public class Main {
    public static void main(String[] args) {
        while (true) {
            int n = Integer.parseInt(sc.next());
            int m = Integer.parseInt(sc.next());
            if (n == 0) break;
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = Integer.parseInt(sc.next());
            int max = 0;
            for (int i = 0; i < n; i++)
                for (int j = i + 1; j < n; j++)
                    max = Math.max(max, (a[i] + a[j] <= m)? a[i] + a[j] : 0);
            System.out.println((max == 0)? "NONE" : max);
        }
    }
}


Compiler output:
Main.java:5: error: cannot find symbol
            int n = Integer.parseInt(sc.next());
                                     ^
  symbol:   variable sc
  location: class Main
Main.java:6: error: cannot find symbol
            int m = Integer.parseInt(sc.next());
                                     ^
  symbol:   variable sc
  location: class Main
Main.java:10: error: cannot find symbol
                a[i] = Integer.parseInt(sc.next());
                                        ^
  symbol:   variable sc
  location: class Main
3 errors
Language: C

#include<stdio.h>
#include<stdlib.h>
int main(){
	int n, m;
	int first, second;
	int max;
	int work;
	int i;
	int* list;
	
	while( 1 ){
		scanf( "%d %d", &n, &m );
		if(( n == 0) && ( m == 0 )){
			break;
		}
		list = ( int* )malloc( sizeof( int ) * n );
		for( i = 0; i < n; i++ ){
			scanf( "%d",  (list + i ));
		}
		
		max = 0;
		for( i = 0; i < n; i++ ){
			if( max < *( list + i ) && (( m / 2 ) >= *( list + i ))){
				work = *( list + i );
				*( list + i ) = max;
				max = work;
			}
		}
		first = max;

		max = 0;
		for( i = 0; i < n; i++ ){
			if( max < *( list + i ) && (( m / 2 ) >= *( list + i ))){
				work = *( list + i );
				*( list + i ) = max;
				max = work;
			}
		}
		second = max;

		if(( first == 0 ) || ( second == 0 )){
			printf( "NONE\n" );
		}
		else{
			printf( "%d", first + second )
		}
		free( list );
	}
	return 0;
}



Compiler output:
main.c: In function 'main':
main.c:45:55: error: expected ';' before '}' token
   45 |                         printf( "%d", first + second )
      |                                                       ^
      |                                                       ;
   46 |                 }
      |                 ~
Language: C

#include <stdio.h>

int main(void)
{
	int n, m;	/* n:??????????????°, m:?????§????????? */
	int max = 0;
	int price[1000];
	int i = 0;

	while (1) {
		scanf_s("%d %d", &n, &m);
		if (n == 0 && m == 0)
			break;
		else {
			for (i = 0; i < n; i++) {
				scanf_s("%d", &price[i]);
			}
			/* printf("n = %d, m = %d\n", n, m);
			for (i = 0; i < n; i++)
				printf("price[%d] = %d\n", i, price[i]);
			*/

			for (i = 0; i < n - 1; i++) {
				for (int j = i + 1; j < n; j++) {
					if (max < (price[i] + price[j]) && m >= (price[i] + price[j])) {
						max = (price[i] + price[j]);
					}
					/*printf("i = %d, j = %d, max = %d, price+ = %d\n", i, j, max, price[i] + price[j]);*/
				}
			}
			if (max == 0)
				printf("NONE\n");
			else
				printf("%d\n", max);
		}
		max = 0;

	}

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:17: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   11 |                 scanf_s("%d %d", &n, &m);
      |                 ^~~~~~~
      |                 scanf
Language: C

#include <stdio.h>

int main(void)
{
	int n, m;	/* n:??????????????°, m:?????§????????? */
	int max = 0;
	int price[1000];
	int i = 0, j;

	while (1) {
		scanf_s("%d %d", &n, &m);
		if (n == 0 && m == 0)
			break;
		else {
			for (i = 0; i < n; i++) {
				scanf_s("%d", &price[i]);
			}
			/* printf("n = %d, m = %d\n", n, m);
			for (i = 0; i < n; i++)
				printf("price[%d] = %d\n", i, price[i]);
			*/

			for (i = 0; i < n - 1; i++) {
				for (j = i + 1; j < n; j++) {
					if (max < (price[i] + price[j]) && m >= (price[i] + price[j])) {
						max = (price[i] + price[j]);
					}
					/*printf("i = %d, j = %d, max = %d, price+ = %d\n", i, j, max, price[i] + price[j]);*/
				}
			}
			if (max == 0)
				printf("NONE\n");
			else
				printf("%d\n", max);
		}
		max = 0;

	}

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:17: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   11 |                 scanf_s("%d %d", &n, &m);
      |                 ^~~~~~~
      |                 scanf
Language: C

#include <stdio.h>
int main(){
	int n, m, i, j, k, tmp;
	int result = 0;
	scanf("%d%d\n", &n, &m);
	int a[n];
	for (i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	for(int i = 0; i < n; i++){
	    printf("%d ", a[i]);
	    for (j = i + 1; j < n; j++){
	        tmp = a[i] + a[j];
	        if(tmp <= m){
	            result = max(result, tmp);
	        }
	    }
	}
	printf("Result:%d\n", result);
	return 0;	
}
int max(int a, int b){
    if(a > b)
    return a;
    else
    return b;
}

Compiler output:
main.c: In function 'main':
main.c:15:30: error: implicit declaration of function 'max' [-Wimplicit-function-declaration]
   15 |                     result = max(result, tmp);
      |                              ^~~
Language: C

#include <stdio.h>
using namespace std;
int is[10000];

int main(int argc, char *argv[])
{
    for(;;) {
        int n, m;
        scanf("%d %d", &n, &m);
        if(n == 0 && m == 0) break;
        for(int i = 0; i < n; i++) {
            int c;
            scanf("%d", &c)
            is[i] = c;
        }
        int best = -1;
        for(int i = 0; i < n; i++) {
            for(int j = i+1; j < n; j++) {
                int k = is[i] + is[j];
                if( k <= m && k > best) best = k;
            }
        }
        if(best < 0) printf("NONE\n");
        else printf("%d\n", best);
    }
    return 0;
}


Compiler output:
main.c:2:1: error: unknown type name 'using'
    2 | using namespace std;
      | ^~~~~
main.c:2:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
    2 | using namespace std;
      |                 ^~~
main.c: In function 'main':
main.c:13:28: error: expected ';' before 'is'
   13 |             scanf("%d", &c)
      |                            ^
      |                            ;
   14 |             is[i] = c;
      |             ~~
Language: C

#include <stdio.h>
int is[10000];
int main(int argc, char *argv[])
{
    for(;;) {
        int n, m;
        scanf("%d %d", &n, &m);
        if(n == 0 && m == 0) break;
        for(int i = 0; i < n; i++) {
            int c;
            scanf("%d", &c)
            is[i] = c;
        }
        int best = -1;
        for(int i = 0; i < n; i++) {
            for(int j = i+1; j < n; j++) {
                int k = is[i] + is[j];
                if( k <= m && k > best) best = k;
            }
        }
        if(best < 0) printf("NONE\n");
        else printf("%d\n", best);
    }
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:11:28: error: expected ';' before 'is'
   11 |             scanf("%d", &c)
      |                            ^
      |                            ;
   12 |             is[i] = c;
      |             ~~
Language: C

#include<Stdio.h>
int main(void){
    int n,m,i,j,total,max,x,s[100];
    while(1){
        scanf("%d",&n);
        scanf("%d",&m);
        if(n==0){
            break;
        }
        for(i=0;i<n;i++){
            scanf("%d",&s[i]);
        }
        for(i=0;i<n;i++){
            total=s[i];
            if(i==0){
                max=total;
            }
            for(j=i;j<n;j++){
                if(max<total+s[j]){
                    max=total+s[j];
                }
            }
        }
        if(max=<m){
            printf("%d\n");
        }else{
            printf("NONE\n");
        }
    }
    
}


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

#include<stdio.h>
int main(void){
    int n,m,i,j,total,max,x,s[100];
    while(1){
        scanf("%d",&n);
        scanf("%d",&m);
        if(n==0){
            break;
        }
        for(i=0;i<n;i++){
            scanf("%d",&s[i]);
        }
        for(i=0;i<n;i++){
            total=s[i];
            if(i==0){
                max=total;
            }
            for(j=i;j<n;j++){
                if(max<total+s[j]){
                    max=total+s[j];
                }
            }
        }
        if(max=<m){
            printf("%d\n");
        }else{
            printf("NONE\n");
        }
    }
    
}


Compiler output:
main.c: In function 'main':
main.c:24:16: error: expected expression before '<' token
   24 |         if(max=<m){
      |                ^
Language: C

#include<stdio.h>

int main(void){
    int i,j,n,m,a[1000],s,s1;
    
    scanf("%d",&n);
    scanf("%d",&m);
    if(n==0&&m==0){
        break;
    }
    for(i=0;i<=n-1;i++){
    scanf("%d",&a[i]);
    }
    s1=0;
    for(i=0;i<=n-1;i++){
        for(j=i+1;j=n-1;i++){
            s=a[i]+a[j];
            if(s<=m&&s1<s){
                s1=s;
            }
        }
    }
    if(s1==0){
        printf("NONE\n");
    }else{
        printf("%d\n",s1);
         }
    
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:9:9: error: break statement not within loop or switch
    9 |         break;
      |         ^~~~~
Language: C

#include<stdio.h>
int main(void)
{
	int n,m,a[1000],i,t,sum,max;
	
	scanf("%d %d",&n&,m);
	
	for(i=0;i<=n;i++)
	{
    	scanf("%d",&a[i]);
			
     	if(a[i]==0 && a[i-1]==0)
		{
			break;
		}
	}
		
	max = 0;
		
	for(i=0;i<=n;i++)
	{
		for(t=0;t<=n;t++)
		{
			sum = a[i]+a[t];
			
			if(sum>max && sum<m)
			{
				max = sum;
			}
		}
	}
	
	if(max==0)
	{
		printf("NONE\n");
	}
	else
	{
		printf("%d\n",max);
	}
	
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:6:26: error: expected expression before ',' token
    6 |         scanf("%d %d",&n&,m);
      |                          ^
Language: C

#include<studio.h>

    int main(){

    int n,m;
    int a[1000];
    int i,j,sum,max;

    while(scanf("%d,%d," &n,&m)){
	if(n==0&m==0)
	    break;

	for(i=0;i<n;i++){
	    scanf("%d", &a[i]);
	}
	max=0;
	for(i=0; i<n; i++){
	    for(j=i+1;j<n;j++){

		sum=a[i]+a[j];
		if(sum>max&&sum<=m)
		    max=sum;
	    }
	}
	if(max==0)
	    printf("NONE\n");
	else
	    printf("%d\n",max);
    }
    return 0;
}
	



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

include <stdio.h>

int main()
{
	int goods_num_n, max_cost_m;
	int goods_cost_a[1000];
	int n_sum = 0;
	int counter_i, counter_j;
	int buying_goods = 0, buying_max = 0;
	
	for(n_sum = 0 ; n_sum <= 50000 ; n_sum += goods_num_n)
	{
		scanf("%d %d", &goods_num_n, &max_cost_m);
		if(goods_num_n == 0 && max_cost_m == 0)
			break;

		for(counter_i = 0 ; counter_i < goods_num_n ; counter_i++)
		{
			scanf("%d", &goods_cost_a[counter_i]);
		}
		
		for(counter_i = 0 ; counter_i < goods_num_n ; counter_i++)
		{
			if(goods_cost_a[counter_i] >= max_cost_m)
				continue;
			
			for(counter_j = counter_i + 1 ; counter_j < goods_num_n ; counter_j++)
			{
				if(goods_cost_a[counter_j] >= max_cost_m)
					continue;
				
				buying_goods = goods_cost_a[counter_i] + goods_cost_a[counter_j];
				if(buying_goods <= max_cost_m && buying_goods >= buying_max)
					buying_max = buying_goods;
			}
		}
		if(buying_max == 0)
			printf("NONE\n");
		else
			printf("%d\n", buying_max);

		buying_max = 0;
	}
	return 0;
}



Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
Language: C

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

int a[1010];
int n, m;
int main(){
  while(true){
    cin >> n >> m;
    if(n == 0 && m == 0) break;
    for(int i = 0; i < n; i++) cin >> a[i];

    int ans = 0;
    int tmp = 0;
    for(int i = 0; i < n; i++){
      for (int j = i + 1; j < n; j++){
        tmp = a[i] + a[j];
        if(tmp <= m){
          ans = max(ans, tmp);
        }
      }
    }
    if(ans == 0){
      cout << "NONE" << endl;
    } else {
      cout << ans << endl;
    }
  }
}



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