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

import java.util.Scanner;

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		//素数のメモ作成
		int size = 1000001;
		boolean[] prime = new boolean[size];
		for(int i=2; i<size; i++){
			prime[i] = true;
		}
		for(int i=2; i*i<size; i++){
			if(prime[i]){
				for(int j=i*i; j<size; j+=i){
					prime[j] = false;
				}
			}
		}
		
		while(true){
			int set = sc.nextInt();//料理の種類
			limit = sc.nextInt();//予算上限
			if((set | limit)==0) break;
			
			int[] food = new int[set];//料理の値段
			for(int i=0; i<set; i++){
				food[i] = sc.nextInt();
			}
			//公約数チェック
			int yaku = food[0];
			for(int i=1; i<set; i++){
				yaku = ch(food[i], yaku);
				if(yaku==1){
					break;
				}
			}//2以上の公約数を持つ場合、素数を作れない
			if(yaku>1){
				System.out.println("NA");
				continue;
			}
			
			//組み合わせで選ぶことのできる価格をtrue
			memo = new boolean[limit+1];
			memo[0] = true;
			for(int i=0; i<set; i++){
				fx(food[i]);
			}
			//素数の最大金額を選択
			int ans =0;
			for(int i=limit; 0<i; i--){
				if(prime[i] && memo[i]){
					ans = i;
					break;
				}
			}
			System.out.println((ans>0)?ans:"NA");
		}
	}
	static int limit;
	static boolean[] memo;
	//公約数を求める式
	static int ch(int x, int y){
		
		x %= y;
		if(x>0) return ch(y,x);
		else return y;
	}
	//料理の組み合わせで選べる金額をtrue
	static void fx(int x){
		
		for(int j=0; j+x<=limit; j++){
			if(memo[j]==true){
				memo[j+x] = true;
			}
		}
	}

Compiler output:
Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
	public static void main(String[] args) {
	              ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: C

#include <stdio.h>
#include <math.h>
#include <string.h>
??
int is_prime(int a)
{
????????int last = sqrt(a) + 1;
????????int i;
??
????????for (i = 2; i <= last; i++){
????????????????if (a % i == 0){
????????????????????????if (a == i) return (1);
????????????????????????return (0);
????????????????}
????????}
????????return (1);
}
??
int main(void)
{
????????static char dp[10000001];
????????int n, x;
????????int i, j;
??
????????while (scanf("%d %d", &n, &x), n){
????????????????memset(dp, 0, sizeof(dp));
????????????????*dp = 1;
????????????????for (i = 0; i < n; i++){
????????????????????????int cost;
????????????????????????scanf("%d", &cost);
??
????????????????????????for (j = 0; j + cost <= x; j++){
????????????????????????????????if (dp[j]) dp[j + cost] = 1;
????????????????????????}
????????????????}
????????????????for (i = x; i > 0; i--){
????????????????????????if (dp[i] && is_prime(i)){
????????????????????????????????printf("%d\n", i);
????????????????????????????????break;
????????????????????????}
????????????????}
????????????????if (!i) puts("NA");
????????}
????????return (0);
}

Compiler output:
main.c:4:1: error: expected identifier or '(' before '?' token
    4 | ??
      | ^
main.c:18:1: error: expected identifier or '(' before '?' token
   18 | ??
      | ^
Language: C++

#include<iostream>
#include<cstring>
#include<algorithm>

const int Max = 1000001;

int dishes[31];
bool dish[Max];
bool isPrime[Max];

int main(){

	for (int i = 2; i < Max; i++)isPrime[i] = true;
	for (int i = 2; i < std::sqrt(Max); i++){
		if (isPrime[i]){
			for (int j = i * 2; j < Max; j += i)isPrime[j] = false;
		}
	}

	int n, x;
	while (std::cin >> n, n){

		std::cin >> x;
		memset(dish, 0, sizeof(dish));

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

		dish[0] = true;
		for (int i = 0; i < x; i++){
			if (dish[i]){
				for (int j = 0; j < n; j++){
					dish[i + dishes[j]] = true;
				}
			}
		}

		for (int i = x; i >= 0; i--){
			if (dish[i] && isPrime[i]){
				std::cout << i << std::endl;
				break;
			}
			if (i == 0)std::cout << "NA" << std::endl;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:34: error: 'sqrt' is not a member of 'std'; did you mean 'sort'?
   14 |         for (int i = 2; i < std::sqrt(Max); i++){
      |                                  ^~~~
      |                                  sort
Language: C++

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

int main()
{
    int n, m;
    while(cin >> n >> m && (n || m)) {
        int cnt=0;vector<int> primes; bool num[m];
        memset(num, false, sizeof(num));
        num[0] = true;

        for(int i=0;i < n;++i) {int hoge; cin>>hoge; if(!(hoge%2)){++cnt;}}
        if (cnt == n) {puts("NA"); continue;}

        for(int i=2,len=m/2;i<=len;++i) {
            if (num[i-1]) continue;
            for(int j=i+i;j <= m;j+=i) {
                num[j-1] = true;
            }
        }

        for(int i=0;i < m;++i) {
            if (!num[i]) {
                primes.push_back(i+1);
            }
        }

        cout << primes.back() << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'memset' was not declared in this scope
   11 |         memset(num, false, sizeof(num));
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <vector>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
const int XMAX = 1000000;
constexpr int SQRTXMAX = sqrt(XMAX);

bool is_prime[XMAX + 1];
bool dp[XMAX + 1];
int cost[30];

int main() {
  // prime
  memset(is_prime, true, sizeof(is_prime));
  is_prime[0] = is_prime[1] = false
  for (int i = 2; i <= SQRTXMAX) {
    if (is_prime[i]) {
      int current = i * i;
      for (int j = i * i; j <= XMAX; j += i) {
        is_prime[j] = false;
      }
    }
  }

  int n, x;
  while (cin >> n >> x, n) {
    for (int i = 0; i < n; i++) cin >> cost[i];

    // dp
    r = 0;
    dp[0] = true;
    for (int i = 1; i <= x; i++) {
      for (int j = 0; j < n; j++) {
        int k = i - cost[j];
        if (k >= 0 && dp[k]) {
          dp[i] = true;
          if (is_prime[i]) r = i;
          break;
        }
      }
    }

    if (r == 0) {
      cout << "NA" << endl;
    } else {
      cout << r << endl;
    }
  }
  return 0;
}

Compiler output:
a.cc:6:26: error: 'sqrt' was not declared in this scope
    6 | constexpr int SQRTXMAX = sqrt(XMAX);
      |                          ^~~~
a.cc: In function 'int main()':
a.cc:15:36: error: expected ';' before 'for'
   15 |   is_prime[0] = is_prime[1] = false
      |                                    ^
      |                                    ;
   16 |   for (int i = 2; i <= SQRTXMAX) {
      |   ~~~                               
a.cc:16:19: error: 'i' was not declared in this scope
   16 |   for (int i = 2; i <= SQRTXMAX) {
      |                   ^
a.cc:30:5: error: 'r' was not declared in this scope
   30 |     r = 0;
      |     ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
const int XMAX = 1000000;
constexpr int SQRTXMAX = (int)sqrt(XMAX);

bool is_prime[XMAX + 1];
bool dp[XMAX + 1];
int cost[30];

int main() {
  // prime
  memset(is_prime, true, sizeof(is_prime));
  is_prime[0] = is_prime[1] = false
  for (int i = 2; i <= SQRTXMAX) {
    if (is_prime[i]) {
      int current = i * i;
      for (int j = i * i; j <= XMAX; j += i) {
        is_prime[j] = false;
      }
    }
  }

  int n, x;
  while (cin >> n >> x, n) {
    for (int i = 0; i < n; i++) cin >> cost[i];

    // dp
    r = 0;
    dp[0] = true;
    for (int i = 1; i <= x; i++) {
      for (int j = 0; j < n; j++) {
        int k = i - cost[j];
        if (k >= 0 && dp[k]) {
          dp[i] = true;
          if (is_prime[i]) r = i;
          break;
        }
      }
    }

    if (r == 0) {
      cout << "NA" << endl;
    } else {
      cout << r << endl;
    }
  }
  return 0;
}

Compiler output:
a.cc:6:31: error: 'sqrt' was not declared in this scope
    6 | constexpr int SQRTXMAX = (int)sqrt(XMAX);
      |                               ^~~~
a.cc: In function 'int main()':
a.cc:15:36: error: expected ';' before 'for'
   15 |   is_prime[0] = is_prime[1] = false
      |                                    ^
      |                                    ;
   16 |   for (int i = 2; i <= SQRTXMAX) {
      |   ~~~                               
a.cc:16:19: error: 'i' was not declared in this scope
   16 |   for (int i = 2; i <= SQRTXMAX) {
      |                   ^
a.cc:30:5: error: 'r' was not declared in this scope
   30 |     r = 0;
      |     ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
const int XMAX = 1000000;
const int SQRTXMAX = sqrt(XMAX);

bool is_prime[XMAX + 1];
bool dp[XMAX + 1];
int cost[30];

int main() {
  // prime
  memset(is_prime, true, sizeof(is_prime));
  is_prime[0] = is_prime[1] = false
  for (int i = 2; i <= SQRTXMAX) {
    if (is_prime[i]) {
      int current = i * i;
      for (int j = i * i; j <= XMAX; j += i) {
        is_prime[j] = false;
      }
    }
  }

  int n, x;
  while (cin >> n >> x, n) {
    for (int i = 0; i < n; i++) cin >> cost[i];

    // dp
    r = 0;
    dp[0] = true;
    for (int i = 1; i <= x; i++) {
      for (int j = 0; j < n; j++) {
        int k = i - cost[j];
        if (k >= 0 && dp[k]) {
          dp[i] = true;
          if (is_prime[i]) r = i;
          break;
        }
      }
    }

    if (r == 0) {
      cout << "NA" << endl;
    } else {
      cout << r << endl;
    }
  }
  return 0;
}

Compiler output:
a.cc:6:22: error: 'sqrt' was not declared in this scope
    6 | const int SQRTXMAX = sqrt(XMAX);
      |                      ^~~~
a.cc: In function 'int main()':
a.cc:15:36: error: expected ';' before 'for'
   15 |   is_prime[0] = is_prime[1] = false
      |                                    ^
      |                                    ;
   16 |   for (int i = 2; i <= SQRTXMAX) {
      |   ~~~                               
a.cc:16:19: error: 'i' was not declared in this scope
   16 |   for (int i = 2; i <= SQRTXMAX) {
      |                   ^
a.cc:30:5: error: 'r' was not declared in this scope
   30 |     r = 0;
      |     ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
const int XMAX = 1000000;
constexpr int SQRTXMAX = sqrt(XMAX);

bool is_prime[XMAX + 1];
bool dp[XMAX + 1];
int cost[30];

int main() {
  // prime
  memset(is_prime, true, sizeof(is_prime));
  is_prime[0] = is_prime[1] = false;
  for (int i = 2; i <= SQRTXMAX; i++) {
    if (is_prime[i]) {
      int current = i * i;
      for (int j = i * i; j <= XMAX; j += i) {
        is_prime[j] = false;
      }
    }
  }

  int n, x;
  while (cin >> n >> x, n) {
    for (int i = 0; i < n; i++) cin >> cost[i];

    // dp
    int r = 0;
    dp[0] = true;
    for (int i = 1; i <= x; i++) {
      dp[i] = false;
      for (int j = 0; j < n; j++) {
        int k = i - cost[j];
        if (k >= 0 && dp[k]) {
          dp[i] = true;
          if (is_prime[i]) r = i;
          break;
        }
      }
    }

    if (r == 0) {
      cout << "NA" << endl;
    } else {
      cout << r << endl;
    }
  }
  return 0;
}

Compiler output:
a.cc:6:26: error: 'sqrt' was not declared in this scope
    6 | constexpr int SQRTXMAX = sqrt(XMAX);
      |                          ^~~~
Language: C++

#include <vector>
#include <iostream>

std::vector<bool> cul_prime(const int &n) {
	std::vector<bool> prime(n + 1, true);
	prime.at(0) = false;
	prime.at(1) = false;
	double root = sqrt(n) + 1;
	for (auto i = 2; i <= n >> 1; ++i) {
		prime.at(i << 1) = false;
	}
	for (auto i = 3; i < root; i += 2) {
		if (prime.at(i)) {
			for (auto j = 2; j <= n / i; ++j) {
				prime.at(i * j) = false;
			}
		}
	}
	return prime;
}
double sqrt(const int &n) {
	double a = n, b = 1;
	while ((a - b) * (a - b) < 0.1) {
		double min = (a + b) / 2;
		if (min * min > n) {
			a = min;
		}
		else {
			b = min;
		}
	}
	return a;
}
int main() {
	int n, x;
	std::cin >> n >> x;
	while (n != 0) {
		std::vector<bool> num(x + 1, false);
		std::vector<int> menu;
		for (auto i = 0; i < n; ++i) {
			int price;
			std::cin >> price;
			menu.push_back(price);
		}
		int max = 0;
		auto prime = cul_prime(x);
		num.at(0) = true;
		for (const auto &i : menu) {
			for (auto j = 0; j <= x - i; ++j) {
				if (num.at(j)) {
					if (j + i <= x) {
						num.at(j + i) = true;
						if (max < j + i && prime.at(j + i)) {
							max = j + i;
						}
					}
				}
			}
		}
		if (max == 0) {
			std::cout << "NA\n";
		}
		else {
			std::cout << max << "\n";
		}
		std::cin >> n >> x;
	}
	return 0;
}

Compiler output:
a.cc: In function 'std::vector<bool> cul_prime(const int&)':
a.cc:8:23: error: 'sqrt' was not declared in this scope
    8 |         double root = sqrt(n) + 1;
      |                       ^~~~
Language: C++

#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int n, x, a[30]; bool dp[1000001], prime[1000001]; vector<int> p;
int main() {
	for(int i = 2; i <= 1000000; i++) prime[i] = true;
	for(int i = 2; i <= 1000; i++) {
		if(!prime[i]) continue;
		for(int j = i * i; j <= 1000000; j += i) prime[j] = false;
	}
	p = {0};
	for(int i = 2; i <= 1000000; i++) {
		if(prime[i]) p.push_back(i);
	}
	while(scanf("%d%d", &n, &x), n) {
		for(int i = 0; i < n; i++) scanf("%d", &a[i]); sort(a, a + n);
		for(int i = 0; i < x; i++) dp[i + 1] = false; dp[0] = true;
		for(int i = 1; i <= x; i++) {
			for(int j = 0; j < n && i >= a[j]; j++) {
				if(dp[i - a[j]]) {
					dp[i] = true; break;
				}
			}
		}
		int pos = upper_bound(p.begin(), p.end(), x);
		for(int i = pos - 1; i >= 0; i--) {
			if(dp[p[i]]) {
				printf(i ? "%d\n" : "NA\n", p[i]); break;
			}
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:38: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int' in initialization
   26 |                 int pos = upper_bound(p.begin(), p.end(), x);
      |                           ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
      |                                      |
      |                                      __gnu_cxx::__normal_iterator<int*, std::vector<int> >
Language: C++

#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<climits>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<vector>
using namespace std;

#define M 1000001

int main() {
	static char gosei[M] = {};

	//????????°???1???
	for (int i = 2; i <= sqrt(M); i++)
		if (gosei[i] == 0) {
			for (int j = 2, k = 0; (k = i*j) <= M; j++)
				gosei[k] = 1;
		}

	static char dp[M];
	for (int n, x; cin >> n >> x&&n&&x;) {
		memset(dp, 0, sizeof(dp));
		dp[0] = 1;

		for (int i = 0; i < n; i++) {
			int b; cin >> b;
			for (int j = 0; j + b <= x; j++)
				if (dp[j]) dp[j + b] = 1;
		}

		bool NA = true;
		for (int i = x; i >= 1; i--) {
			if (dp[i] && !gosei[i]) {
				cout << i << endl;
				NA = false;
				break;
			}
		}
		if (NA)cout << "NA" << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:17: error: 'memset' was not declared in this scope
   34 |                 memset(dp, 0, sizeof(dp));
      |                 ^~~~~~
a.cc:15:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   14 | #include<stack>
  +++ |+#include <cstring>
   15 | #include<string>
Language: C++

#include <iostream>
#include <algorithm>
#include <cstring>

constexpr int MAX_N = 31, MAX_C = 1000001;
int n, max;
int cost[MAX_N];
bool dp[MAX_C];
bool prime_num[MAX_C];

int main() {
	while (1) {
		std::cin >> n >> max;
		if (n + max == 0)
			break;
		std::memset(prime_num, false, sizeof(prime_num));
		std::memset(dp, false, sizeof(dp));
		for (int i = 0; i < n; ++i)
			std::cin >> cost[i];
		for (int i = 2; i * i <= max; ++i) {
			if (!prime_num[i]) {
				for (int j = 2; i*j <= max; ++j)
					prime_num[i*j] = true;
			}
		}
		int ans = 0;
		for (int i = 0; i < n; ++i)
			dp[cost[i]] = true;

		for (int i = 1; i <= max; ++i) {
			for (int j = 0; j < n; ++j) {
				if (i + cost[j] <= max&&dp[i])
					dp[i + cost[j]] = true;
				else if(!d[i])
					goto a;
			}
		}
	a:;
		for (int i = max; i >= 0; --i) {
			if (dp[i] && !prime_num[i]) {
				ans = i; 
				break;
			}
		}
		if (!ans)
			std::cout << "NA" <<std::endl;
		else
			std::cout << ans << std::endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:42: error: 'd' was not declared in this scope
   34 |                                 else if(!d[i])
      |                                          ^
Language: C++

#include<iostream>
#include <cstdio>
#include<string>
using namespace std;
int ha(string);
int saga(int);
int q,m,n=1000000,List[1000];
bool  slist[1000001];
bool  klist[1000001];

int main()
{	
	int i,j,k,b=0,s,a=2,f=0,c=0;
	for( i = 0; i <n;i++ ){
		slist[i]=true;
		klist[i]=false;
	}

	i=0;
	while(i<sqrt((double)n)){
		for(i=a+a;i<n;i=i+a){
			slist[i]=false;
		}
		for(i=a+1;i<sqrt((double)n);i++){
			if(slist[i]==true){
				a=i;
				break;
			}
		}
	}
	cin>>m>>n;
	while(m!=0||n!=0){
	for( i = 0; i <n;i++ ){
		klist[i]=false;
	}
	for(i=0;i<m;i++){
		cin>>List[i];
		klist[List[i]]=true;
	}
		for(i=0;i<n;i++){
			if(klist[i]){
			for(j=0;j<m;j++){				
				klist[i+List[j]]=true;
			}
		}
	}
		for(i=n;i>0;i--){
			if(klist[i]&&slist[i]){
			break;
		}
	}
		if(i==0){
			printf("NA\n");
		}
		else{
		printf("%d\n",i);
		}
		cin>>m>>n;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: 'sqrt' was not declared in this scope
   20 |         while(i<sqrt((double)n)){
      |                 ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <stack>
#include <list>

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,b,n) for(int i=b;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

const float PI = 3.1415926;
static const int INFTY = (1<<30);

using namespace std;

typedef long long ll;
typedef long double ld;


int n;
ll V[31], x;
ll dp[32][1LL<<32];
ll maxn;

bool sosu(ll t){
  if(t == 1) return false;
  if(t == 2) return true;
  if(t%2 == 0) return false;

  for(ll i=3; i*i<=t; i+=2){
    if(t%i == 0) return false;
  }

  return true;
}

void solve(ll now) {
  if(now > x) return;
  if(sosu(now) && now > maxn)
    maxn = now;
  rep(i, n) {
    solve(now + V[i]);
  }
  return;
}

int main() {
  while(cin >> n >> x, n) {
    maxn = 0;
    rep(i, n) {
      cin >> V[i];
    }
    solve(0);
    if(maxn == 0) {
      cout << "NA" << endl;
    } else {
      cout << maxn << endl;
    }
  }

  return 0;
}

Compiler output:
/tmp/ccFLgUB9.o: in function `solve(long long)':
a.cc:(.text+0xa0): relocation truncated to fit: R_X86_64_PC32 against symbol `maxn' defined in .bss section in /tmp/ccFLgUB9.o
a.cc:(.text+0xc1): relocation truncated to fit: R_X86_64_PC32 against symbol `maxn' defined in .bss section in /tmp/ccFLgUB9.o
/tmp/ccFLgUB9.o: in function `main':
a.cc:(.text+0x119): relocation truncated to fit: R_X86_64_PC32 against symbol `maxn' defined in .bss section in /tmp/ccFLgUB9.o
a.cc:(.text+0x16f): relocation truncated to fit: R_X86_64_PC32 against symbol `maxn' defined in .bss section in /tmp/ccFLgUB9.o
a.cc:(.text+0x1a8): relocation truncated to fit: R_X86_64_PC32 against symbol `maxn' defined in .bss section in /tmp/ccFLgUB9.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <stack>
#include <list>

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,b,n) for(int i=b;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

const float PI = 3.1415926;
static const int INFTY = (1<<30);

using namespace std;

typedef long long ll;
typedef long double ld;


int n;
ll V[31], x;
ll dp[32][1LL<<32];
ll maxn;

bool sosu(ll t){
  if(t == 1) return false;
  if(t == 2) return true;
  if(t%2 == 0) return false;

  for(ll i=3; i*i<=t; i+=2){
    if(t%i == 0) return false;
  }

  return true;
}

void solve(ll now) {
  if(now > x) return;
  if(sosu(now) && now > maxn)
    maxn = now;
  rep(i, n) {
    solve(now + V[i]);
  }
  return;
}

int main() {
  while(cin >> n >> x, n) {
    maxn = 0;
    rep(i, n) {
      cin >> V[i];
    }
    solve(0);
    if(maxn == 0) {
      cout << "NA" << endl;
    } else {
      cout << maxn << endl;
    }
  }

  return 0;
}

Compiler output:
/tmp/cc4zClI3.o: in function `solve(long long)':
a.cc:(.text+0xa0): relocation truncated to fit: R_X86_64_PC32 against symbol `maxn' defined in .bss section in /tmp/cc4zClI3.o
a.cc:(.text+0xc1): relocation truncated to fit: R_X86_64_PC32 against symbol `maxn' defined in .bss section in /tmp/cc4zClI3.o
/tmp/cc4zClI3.o: in function `main':
a.cc:(.text+0x119): relocation truncated to fit: R_X86_64_PC32 against symbol `maxn' defined in .bss section in /tmp/cc4zClI3.o
a.cc:(.text+0x16f): relocation truncated to fit: R_X86_64_PC32 against symbol `maxn' defined in .bss section in /tmp/cc4zClI3.o
a.cc:(.text+0x1a8): relocation truncated to fit: R_X86_64_PC32 against symbol `maxn' defined in .bss section in /tmp/cc4zClI3.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <stack>
#include <list>

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,b,n) for(int i=b;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

const float PI = 3.1415926;
static const int INFTY = (1<<30);

using namespace std;

typedef long long ll;
typedef long double ld;


int n;
ll V[31], x;
ll dp[32][1LL<<32];
ll maxn;

bool sosu(ll t){
  if(t == 1) return false;
  if(t == 2) return true;
  if(t%2 == 0) return false;

  for(ll i=3; i*i<=t; i+=2){
    if(t%i == 0) return false;
  }

  return true;
}

void solve(ll now) {
  if(now > x) return;
  if(sosu(now) && now > maxn)
    maxn = now;
  rep(i, n) {
    solve(now + V[i]);
  }
  return;
}

int main() {
  while(cin >> n >> x, n) {
    maxn = 0;
    rep(i, n) {
      cin >> V[i];
    }
    solve(0);
    if(maxn == 0) {
      cout << "NA" << endl;
    } else {
      cout << maxn << endl;
    }
  }

  return 0;
}

Compiler output:
/tmp/ccraDUYE.o: in function `solve(long long)':
a.cc:(.text+0xa0): relocation truncated to fit: R_X86_64_PC32 against symbol `maxn' defined in .bss section in /tmp/ccraDUYE.o
a.cc:(.text+0xc1): relocation truncated to fit: R_X86_64_PC32 against symbol `maxn' defined in .bss section in /tmp/ccraDUYE.o
/tmp/ccraDUYE.o: in function `main':
a.cc:(.text+0x119): relocation truncated to fit: R_X86_64_PC32 against symbol `maxn' defined in .bss section in /tmp/ccraDUYE.o
a.cc:(.text+0x16f): relocation truncated to fit: R_X86_64_PC32 against symbol `maxn' defined in .bss section in /tmp/ccraDUYE.o
a.cc:(.text+0x1a8): relocation truncated to fit: R_X86_64_PC32 against symbol `maxn' defined in .bss section in /tmp/ccraDUYE.o
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
using namespace std ;
void ans( int cnt ,int dp[] )
{
	int a = cnt + 1 ;
	LOOK :
	a-- ;
	while( dp[ a ] != 1 )
	{
		a-- ;
		if( a < 2 )
		{
			END :
			cout << "NA" << endl ;
			return ;
		}
	}
	if( a < 2 )
	{
		goto END ;
	}
	if( a % 2 == 0 )
	{
		goto LOOK ;
	}
	if( a == 2 )
	{
		cout << a << endl ;
		return ;
	}
	for( int i = 3 ; i * i <= a ; i += 2 )
	{
		if( a % i == 0 )
		{
			goto LOOK ;
		}
	}
	cout << a << endl ;
	return ;
}
int main()
{
	int n ,m ;
	int dmon[ 30 ] ;
	int j ;
	while( cin >> n >> m )
	{
		if( n== 0 && m == 0 )
		{
			break ;
		}
		int cnt = m ;
		long long dp[ 1000000 + 1 ] = { 0 } ;
		for( int i = 0 ; i < n ; i++ )
		{
			cin >> dmon[ i ] ;
		}
		for( int i = 0 ; i + dmon[ 0 ] <= m ; )
		{
			for( j = 0 ; j < n && i + dmon[ j ] <= m ; j++ )
			{
				dp[ i + dmon[ j ] ] = 1 ;
			}
			i++ ;
			while( dp[ i ] != 1 )
			{
				i++ ;
			}
		}
		ans( cnt ,dp ) ; 
	}
	return 0 ;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:70:27: error: cannot convert 'long long int*' to 'int*'
   70 |                 ans( cnt ,dp ) ;
      |                           ^~
      |                           |
      |                           long long int*
a.cc:3:24: note:   initializing argument 2 of 'void ans(int, int*)'
    3 | void ans( int cnt ,int dp[] )
      |                    ~~~~^~~~
Language: C++

#include<stdio.h>
int isPrime(int x){
	int i;
	if(x<2) return 0;
	else if(x==2) return 1;
	if(x%2==0) return 0;
	for(i=3;i*i<=x;i+=2){
		if(x%i==0) return 0;
	}
	return 1;
}
int main()
{
	long x,cnt,cnt2,food;
	int n,d=0,g,kakaku[31],youso[1000001]={0};
	scanf("%d %d",&n,&x);
	while(n!=0&&x!=0){
		for(cnt=1;cnt<=n;cnt++){
			scanf("%ld",&food);
			youso[food]=1;
			kakaku[cnt]=food;
		}
		for(cnt=1;cnt<=x;cnt++){
			if(youso[cnt]==1){
				for(cnt2=1;cnt2<=n;cnt2++){
					youso[cnt+kakaku[cnt2]]=1;
					if(cnt+kakaku[cnt2]>x){
						break;
					}
				}
			}
		}
		for(cnt=x;cnt>0;cnt--){
			if(youso[cnt]==1){
				g=cnt;
				d=isPrime(g);
				if(d==1){
					d=cnt;
					flag=1;
					printf("%d\n",d);
					break;
				}
			}
		}
		if(flag==0){
			printf("NA\n");
		}
		flag=0;
		d=0;
		for(cnt=1;cnt<=x;cnt++){
			youso[cnt]=0;
		}
		scanf("%d %d",&n,&x);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:41: error: 'flag' was not declared in this scope
   39 |                                         flag=1;
      |                                         ^~~~
a.cc:45:20: error: 'flag' was not declared in this scope
   45 |                 if(flag==0){
      |                    ^~~~
a.cc:48:17: error: 'flag' was not declared in this scope
   48 |                 flag=0;
      |                 ^~~~
Language: C++

#include<stdio.h>
int isPrime(int x){
	int i;
	if(x<2) return 0;
	else if(x==2) return 1;
	if(x%2==0) return 0;
	for(i=3;i*i<=x;i+=2){
		if(x%i==0) return 0;
	}
	return 1;
}
int main()
{
	long x,cnt,cnt2,food;
	int n,d=0,g,kakaku[31],youso[1000001]={0};
	scanf("%d %d",&n,&lx);
	while(n!=0&&x!=0){
		for(cnt=1;cnt<=n;cnt++){
			scanf("%ld",&food);
			youso[food]=1;
			kakaku[cnt]=food;
		}
		for(cnt=1;cnt<=x;cnt++){
			if(youso[cnt]==1){
				for(cnt2=1;cnt2<=n;cnt2++){
					youso[cnt+kakaku[cnt2]]=1;
					if(cnt+kakaku[cnt2]>x){
						break;
					}
				}
			}
		}
		for(cnt=x;cnt>0;cnt--){
			if(youso[cnt]==1){
				g=cnt;
				d=isPrime(g);
				if(d==1){
					d=cnt;
					flag=1;
					printf("%d\n",d);
					break;
				}
			}
		}
		if(flag==0){
			printf("NA\n");
		}
		flag=0;
		d=0;
		for(cnt=1;cnt<=x;cnt++){
			youso[cnt]=0;
		}
		scanf("%d %d",&n,&lx);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:27: error: 'lx' was not declared in this scope; did you mean 'x'?
   16 |         scanf("%d %d",&n,&lx);
      |                           ^~
      |                           x
a.cc:39:41: error: 'flag' was not declared in this scope
   39 |                                         flag=1;
      |                                         ^~~~
a.cc:45:20: error: 'flag' was not declared in this scope
   45 |                 if(flag==0){
      |                    ^~~~
a.cc:48:17: error: 'flag' was not declared in this scope
   48 |                 flag=0;
      |                 ^~~~
Language: C++

#include<stdio.h>
int isPrime(int x){
	int i;
	if(x<2) return 0;
	else if(x==2) return 1;
	if(x%2==0) return 0;
	for(i=3;i*i<=x;i+=2){
		if(x%i==0) return 0;
	}
	return 1;
}
int main()
{
	long x,cnt,cnt2,food;
	int n,d=0,g,kakaku[31],youso[1000001]={0};
	scanf("%d %ld",&n,&x);
	while(n!=0&&x!=0){
		for(cnt=1;cnt<=n;cnt++){
			scanf("%ld",&food);
			youso[food]=1;
			kakaku[cnt]=food;
		}
		for(cnt=1;cnt<=x;cnt++){
			if(youso[cnt]==1){
				for(cnt2=1;cnt2<=n;cnt2++){
					youso[cnt+kakaku[cnt2]]=1;
					if(cnt+kakaku[cnt2]>x){
						break;
					}
				}
			}
		}
		for(cnt=x;cnt>0;cnt--){
			if(youso[cnt]==1){
				g=cnt;
				d=isPrime(g);
				if(d==1){
					d=cnt;
					flag=1;
					printf("%d\n",d);
					break;
				}
			}
		}
		if(flag==0){
			printf("NA\n");
		}
		flag=0;
		d=0;
		for(cnt=1;cnt<=x;cnt++){
			youso[cnt]=0;
		}
		scanf("%d %ld",&n,&x);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:41: error: 'flag' was not declared in this scope
   39 |                                         flag=1;
      |                                         ^~~~
a.cc:45:20: error: 'flag' was not declared in this scope
   45 |                 if(flag==0){
      |                    ^~~~
a.cc:48:17: error: 'flag' was not declared in this scope
   48 |                 flag=0;
      |                 ^~~~
Language: C++

#include<iostream>
#include<cstring>
using namespace std;
??
bool dp[1000010];
int n,x;
int cook[33];
int solve();
bool prime(int now);
??
int main(){
????????while(1){
????????????????cin >> n >> x;
????????????????if(n == 0 && x == 0) break;
????????????????memset(dp,false,x+2);
????????????????dp[0] = true;
????????????????for(int i=0;i<n;i++){
????????????????????????cin >> cook[i];
????????????????????????for(int k=cook[i];k<=x;k++){
????????????????????????????????if(dp[k-cook[i]]){
????????????????????????????????????????dp[k] = true;
????????????????????????????????}
????????????????????????}
????????????????}
????????????????int ans = solve();
????????????????if(ans) cout << ans << endl;
????????????????else cout << "NA" << endl;
????????}
}
??
int solve (){
????????int now = x;
????????while(1){
????????????????if(dp[now] && !(prime(now))) return now;
????????????????now--;
????????}
}
??
bool prime(int now) {
????????for(int i=2;i*i<=now;i++){
????????????????if(now%i == 0) return true;
????????}
????????return false;
}

Compiler output:
a.cc:4:1: error: expected unqualified-id before '?' token
    4 | ??
      | ^
a.cc:10:1: error: expected unqualified-id before '?' token
   10 | ??
      | ^
a.cc:30:1: error: expected unqualified-id before '?' token
   30 | ??
      | ^
a.cc:38:1: error: expected unqualified-id before '?' token
   38 | ??
      | ^
Language: C++

#include <stdio.h>
#include <math.h>
#include <string.h>
??
int is_prime(int a)
{
????????int last = sqrt(a) + 1;
????????int i;
??
????????for (i = 2; i <= last; i++){
????????????????if (a % i == 0){
????????????????????????if (a == i) return (1);
????????????????????????return (0);
????????????????}
????????}
????????return (1);
}
??
int main(void)
{
????????static char dp[10000001];
????????int n, x,i,j;
??
????????while (scanf("%d %d", &n, &x), n){
????????????????memset(dp, 0, sizeof(dp));
????????????????*dp = 1;
????????????????for (i = 0; i < n; i++){
????????????????????????int cost;
????????????????????????scanf("%d", &cost);
??
????????????????????????for (j = 0; j + cost <= x; j++){
????????????????????????????????if (dp[j]) dp[j + cost] = 1;
????????????????????????}
????????????????}
????????????????for (i = x; i > 0; i--){
????????????????????????if (dp[i] && is_prime(i)){
????????????????????????????????printf("%d\n", i);
????????????????????????????????break;
????????????????????????}
????????????????}
????????????????if (!i) puts("NA");
????????}
????????return (0);
}

Compiler output:
a.cc:4:1: error: expected unqualified-id before '?' token
    4 | ??
      | ^
a.cc:18:1: error: expected unqualified-id before '?' token
   18 | ??
      | ^
Language: C++

#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>

using namespace std;

bool prime[1000001],dp[1000001];

void make_prime(){
  for(int i=0;i<1000001;i++) prime[i]=true;
  prime[0]=prime[1]=false;
  for(int i=2;i<=1000000;i++){
    if(prime[i]){
      for(int j=i*2;j<1000001;j+=i){
          prime[j]=false;
        }
    }
  }
}

int n,x;
vector<int> price;

int main(){
  make_prime();

  while(1){
    cin>>n>>x;
    if(!n && !x)break;
    while(price.size())price.pop();
    for(int i=0;i<1000001;i++){
      dp[i]=false;
    }
    for(int i=0;i<n;i++){
      int tmp;
      cin>>tmp;
      price.push_back(tmp);
      dp[tmp]=true;
    }

    sort(price.begin(),price.end());

    for(int i=0;i<n;i++){
      for(int j=0;j+price[i]<=x;j++){
        if(dp[j]) dp[j+price[i]]=true;
      }
    }

    int ans=0;

    for(int i=x;i>=1;i--){
      if(dp[i] && prime[i]){
        ans=i; break;
      }
    }

    if(ans==0){
      cout<<"NA"<<endl;
    }else{
      cout<<ans<<endl;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:30: error: 'class std::vector<int>' has no member named 'pop'
   32 |     while(price.size())price.pop();
      |                              ^~~
Language: C++


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

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)
#define INF (1<<20)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

ll arr[1000010];

void Eratosthenes(int n) 
{
	rep(i, n+1)arr[i] = 1;
	for (int i = 2; i <= sqrt(n); i++) {
		if (arr[i]) {
			for (int j = 0; i*(j + 2) <= n; j++)
				arr[i*(j + 2)] = 0;
		}
	}
}

int dp[1000001];
int a[31], c[31];

int main()
{
	int n,x;
	cin >> n >> x;

	Eratosthenes(x);

	for (int i = 0; i < n; i++) {
		cin >> a[i];
		c[i] = 1000000 / a[i];
	}

	memset(dp,-1,sizeof(dp));
	dp[0] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= x; j++) {
			if (dp[j] >= 0) {
				dp[j] = c[i];
			}
			else if (j < a[i] || dp[j - a[i]] <= 0) {
				dp[j] = -1;
			}		  
			else {
				dp[j] = dp[j - a[i]] - 1;
			}
		}
	}
	
	for (int i = x; i >= 2; i--) {
		if (dp[i] >= 0) {
			if (arr[i]) {
				cout << i << endl;
				return 0;
			}
		}
	}
	cout << "NA" << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:9: error: 'memset' was not declared in this scope
   56 |         memset(dp,-1,sizeof(dp));
      |         ^~~~~~
a.cc:16:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   15 | #include<iterator>
  +++ |+#include <cstring>
   16 |
Language: C++

#include<iostream>
#define N 1000001
using namespace std;
int main(){
  int p[N]={0};
  for(int i=3;i<N;i+=2) p[i] = 1;
  p[2] = 1;
  for(int i=3;i<=1000;i+=2){
    if(p[i]==1){
      for(int j=2*i;j<N;j+=i) p[j] = 0;
    }
  }
  int n,x;
  while(cin >> n >> x){
    if(n==0&&x==0) break;
    int t[x+1];
    for(int i=0;i<=x;i++) t[i] = 0;
    for(int i=0;i<n;i++){
      int k;
      cin >> k;
      if(k<=x) t[k] = 1;
      for(int j=1;j<=x;j++){
    if(t[j]==1&&j+k<=x) t[j+k] = 1;
      }
    }
    bool ok = false;
    for(int i=x;i>=0;i--){
      if(t[i]==1&&p[i]==1){
    cout << i << endl;
    ok = true;
    break;
      }
    }
    if(!ok) cout << "NA" << endl;
  }
  return 0;
}

Compile Error Logs:

ステータス
Judge: 1/1	C++	CPU: 00:92 sec	Memory: 8976 KB	Length: 679 B	2014-01-07 17:45
テストケースの判定結果
Case #	Verdict	CPU Time	Memory	In	Out	Case Name
Case #1	: Accepted	00:92	8976	0	0	judge_data

< prev |		/		| next >	 		
 
Judge Input #  ( | )		Judge Output #  ( | )



Compiler output:
a.cc:44:6: error: stray '#' in program
   44 | Case #  Verdict CPU Time        Memory  In      Out     Case Name
      |      ^
a.cc:45:6: error: stray '#' in program
   45 | Case #1 : Accepted      00:92   8976    0       0       judge_data
      |      ^
a.cc:49:13: error: stray '#' in program
   49 | Judge Input #  ( | )            Judge Output #  ( | )
      |             ^
a.cc:49:46: error: stray '#' in program
   49 | Judge Input #  ( | )            Judge Output #  ( | )
      |                                              ^
a.cc:39:1: error: 'Compile' does not name a type
   39 | Compile Error Logs:
      | ^~~~~~~
Language: C++

#include<iostream>
using namespace std;
#define MAX_N 1000000

int prime[MAX_N+1];
bool is_prime[MAX_N+1];

int main(){
  int p = 0;
  for(int i=0;i<=MAX_N;i++) is_prime[i] = true;
  is_prime[0] = is_prime[1] = false;
  for(int i=2;i<=MAX_N;i++){
    if(is_prime[i]){
      prime[p++] = i;
      for(int j=2*i;j<=MAX_N;j+=i) is_prime[j] = false;
    }
  }

  int n,x;
  while(cin >> n >> x){
    if(n==0&&x==0) break;
    int v[n];
    bool dp[x+1];
    for(int i=0;i<=x;i++)
      dp[i] = false;

    for(int i=0;i<n;i++)
      cin >> v[i];
    dp[v[0]] = true;

    for(int i=0;i<n;i++){
      for(int 


Compiler output:
a.cc: In function 'int main()':
a.cc:32:14: error: expected unqualified-id at end of input
   32 |       for(int
      |              ^
a.cc:32:14: error: expected ';' at end of input
   32 |       for(int
      |              ^
      |              ;
a.cc:32:14: error: expected primary-expression at end of input
a.cc:32:14: error: expected ';' at end of input
   32 |       for(int
      |              ^
      |              ;
a.cc:32:14: error: expected primary-expression at end of input
a.cc:32:14: error: expected ')' at end of input
   32 |       for(int
      |          ~   ^
      |              )
a.cc:32:14: error: expected statement at end of input
a.cc:32:14: error: expected '}' at end of input
a.cc:31:25: note: to match this '{'
   31 |     for(int i=0;i<n;i++){
      |                         ^
a.cc:32:14: error: expected '}' at end of input
   32 |       for(int
      |              ^
a.cc:20:23: note: to match this '{'
   20 |   while(cin >> n >> x){
      |                       ^
a.cc:32:14: error: expected '}' at end of input
   32 |       for(int
      |              ^
a.cc:8:11: note: to match this '{'
    8 | int main(){
      |           ^
Language: C++

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

int main(){
  //ツ素ツ青板青カツ青ャ
  const int NUM = 1000000;
  bool prime[NUM];
  prime[0] = false;
  prime[1] = false;
  for(int i=2;i<NUM;i++)
    prime[i] = true;
  for(int i=2;i*i<NUM;i++)
    for(int k=2;i*k<NUM;k++)
      prime[i*k]=false;

  while(true){
    int n,x;
    cin>>n>>x;
    if(!n&&!x)break;
    int menu[n];
    for(int i=0;i<n;i++)cin>>menu[i];
    bool money[x+1];
    money[0] = true;#include<iostream>
#include<algorithm>
using namespace std;

int main(){
  //ツ素ツ青板青カツ青ャ
  const int NUM = 1000000;
  bool prime[NUM];
  prime[0] = false;
  prime[1] = false;
  for(int i=2;i<NUM;i++)
    prime[i] = true;
  for(int i=2;i*i<NUM;i++)
    for(int k=2;i*k<NUM;k++)
      prime[i*k]=false;

  while(true){
    int n,x;
    cin>>n>>x;
    if(!n&&!x)break;
    int menu[n];
    for(int i=0;i<n;i++)cin>>menu[i];
    bool money[x+1];
    money[0] = true;
    for(int i=1;i<x+1;i++){
      money[i] = false;
      for(int j=0;j<n;j++){
	if(i>=menu[j]&&money[i-menu[j]]){
	  money[i] = true;
	  break;
	}
      }
    }
    int p = -1;
    for(int i=x;i>0;i--){
      if(money[i]&&prime[i]){
	p=i;
	break;
      }
    }
    if(p==-1)cout<<"NA"<<endl;
    else cout<<p<<endl;
  }
  return 0;
}

    for(int i=1;i<x+1;i++){
      money[i] = false;
      for(int j=0;j<n;j++){
	if(i>=menu[j]&&money[i-menu[j]]){
	  money[i] = true;
	  break;
	}
      }
    }
    int p = -1;
    for(int i=x;i>0;i--){
      if(prime[i]&&money[i]){
	p=i;
	break;
      }
    }
    if(p==-1)cout<<"NA"<<endl;
    else cout<<p<<endl;
  }
  return 0;
}

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

#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>

using namespace std;

int main(){
	bool sosuu[1000011];
	bool dp[1000011];
	
		for(int i=0;i<=1000000;i++){
			sosu[i]=0;
		}
		for(int i=2;i<=500000;i++){
			if(sosuu[i]==0){
				for(int j=i;j<=1000000;j+=i){
					sosuu[j]=1;
				}
				sosuu[i]=0;
			}
		}
		sosuu[0]=1;
		sosuu[1]=1;
	while(1){
		for(int i=0;i<=1000000;i++){
			dp[i]=0;
		}
		
		int item[30];
		
		int n,m;
		scanf("%d%d",&n,&m);
		
		if(n==0 && m==0){
			break;
		}
		for(int i=0;i<n;i++){
			scanf("%d",&item[i]);
		}
		dp[0]=1;
		for(int i=0;i<=m;i++){
			for(int j=0;j<n;j++){
				if(i<item[j]){
					continue;
				}
				if(dp[i-item[j]]==1){
					dp[i]=1;
				}
			}
		}
		int num=0;
		for(int i=m;i>=0;i--){
			if(dp[i]==1&&sosuu[i]==0){
				num=i;
				break;
			}
		}
		if(num==0){
			puts("NA");
		}else{
			printf("%d\n",num);
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:25: error: 'sosu' was not declared in this scope; did you mean 'sosuu'?
   15 |                         sosu[i]=0;
      |                         ^~~~
      |                         sosuu
Language: C++

#include <stdio.h>
#include <windows.h>
int n,m[30];

bool prime[1000000];
bool c[1000000];

void saiki(int total){
	int i;
	if(total==0){
		return;
	}
	
	if(total<0){
		return;
	}
	
	for( i=0 ; i<n ; i++){
		total-=m[i];
		if(c[total]==1)continue;
		if(total>=0){
			c[total]=1;
		}
		saiki(total);
	}
}

int main(void)
{
	int i,j;
	//f
	prime[0]=1;
	prime[1]=1;
	for(i=3;i<1000000;i++){
		if(i%2==0){
			prime[i]=1;
		}
	}
	for(i=3;i<1000000;i++){
		if(prime[i]==0){
			for(j=(i+i);j<1000000;j+=i){
				prime[j]=1;
			}
		}
	}
	//
	while(1){
		int x;
		int flg=0;
		scanf("%d%d",&n,&x);
		if(n==0)break;
		
		for(i=0;i<n;i++){
			scanf("%d",&m[i]);
		}
		saiki(x);
		//
		for(i=0;i<x;i++){
			
			if(c[i]==1 && prime[x-i]==0){
				flg=1;
				break;
			}
		}
		if(flg==1){
			printf("%d\n",x-i);
		}
		else puts("NA");
		for(i=0;i<1000000;i++){
			c[i]=0;
		}
		//
	}
	
	
	return 0;
}

Compiler output:
a.cc:2:10: fatal error: windows.h: No such file or directory
    2 | #include <windows.h>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include <stdio.h>

int n,m[30];
/*
bool prime[1000000];
*/
bool c[1000000];

void saiki(int total){
	int i;
	if(total<=0){
		return;
	}
	
	for( i=0 ; i<n ; i++){
		total-=m[i];
		if(c[total]==1)continue;
		if(total>=0){
			c[total]=1;
		}
		saiki(total);
	}
}

int check(int prime){
	int flg=0,i;
	if(prime%2==0)return 0;
	for(i=3;i<prime;i+=2){
		if(prime%i==0){
			flg=1;
		}
	}
	if(flg==1)return 0;
	return 1;
}

int main(void)
{
	int i,j;
	//f
	/*
	prime[0]=1;
	prime[1]=1;
	for(i=3;i<1000000;i++){
		if(i%2==0){
			prime[i]=1;
		}
	}
	for(i=3;i<1000000;i++){
		if(prime[i]==0){
			for(j=(i+i);j<1000000;j+=i){
				prime[j]=1;
			}
		}
	}
	*/
	//
	while(1){
		for(;;)
		int x;
		int flg=0;
		scanf("%d%d",&n,&x);
		if(n==0)break;
		
		for(i=0;i<n;i++){
			scanf("%d",&m[i]);
		}
		saiki(x);
		//
		for(i=0;i<x;i++){
			
			if(c[i]==1 && check(x-i)){
				flg=1;
				break;
			}
		}
		if(flg==1){
			printf("%d\n",x-i);
		}
		else puts("NA");
		for(i=0;i<1000000;i++){
			c[i]=0;
		}
		//
	}
	
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:62:34: error: 'x' was not declared in this scope
   62 |                 scanf("%d%d",&n,&x);
      |                                  ^
Language: C++

#include <stdio.h>

int n,m[30];
/*
bool prime[1000000];
*/
bool c[1000000];

void saiki(int total){
	int i;
	if(total<=0){
		return;
	}
	
	for( i=0 ; i<n ; i++){
		total-=m[i];
		if(c[total]==1)continue;
		if(total>=0){
			c[total]=1;
		}
		saiki(total);
	}
}

int check(int prime){
	int flg=0,i;
	if(prime%2==0)return 0;
	for(i=3;i<prime;i+=2){
		if(prime%i==0){
			flg=1;
		}
	}
	if(flg==1)return 0;
	return 1;
}

int main(void)
{
	int i,j;
	//f
	/*
	prime[0]=1;
	prime[1]=1;
	for(i=3;i<1000000;i++){
		if(i%2==0){
			prime[i]=1;
		}
	}
	for(i=3;i<1000000;i++){
		if(prime[i]==0){
			for(j=(i+i);j<1000000;j+=i){
				prime[j]=1;
			}
		}
	}
	*/
	//
	while(1){
		for(int m;m<100;i++)
		int x;
		int flg=0;
		scanf("%d%d",&n,&x);
		if(n==0)break;
		
		for(i=0;i<n;i++){
			scanf("%d",&m[i]);
		}
		saiki(x);
		//
		for(i=0;i<x;i++){
			
			if(c[i]==1 && check(x-i)){
				flg=1;
				break;
			}
		}
		if(flg==1){
			printf("%d\n",x-i);
		}
		else puts("NA");
		for(i=0;i<1000000;i++){
			c[i]=0;
		}
		//
	}
	
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:62:34: error: 'x' was not declared in this scope
   62 |                 scanf("%d%d",&n,&x);
      |                                  ^
Language: C++

#include <iostream>
#include <stdlib.h>
#include <math.h>

using namespace std;

const int N = 1000000;

int prime[N+1];
int dish[30];
int n, x;
int max_val;

void setPrime()
{
	memset(&prime[0], 0, sizeof(int) * (N+1));
	prime[2] = 1;
	for(int i=2; i<=N; i++)
	{
		bool is_prime = true;
		int limit = sqrt(i);
		for(int k=2; k<=limit; k++)
		{
			if(i % k == 0)
			{
				is_prime = false;
				break;
			}	
		}
		
		if(is_prime)
		{
			prime[i] = 1;
		}
	}
}

void solve(int price, int depth)
{
	if(depth == n-1)
	{
		if(prime[price] == 1 && max_val < price)
		{
			max_val = price;
		}
		return;
	}
	
	while(price <= x)
	{
		solve(price, depth+1);
		price += dish[depth];
	}
}

int main()
{
	setPrime();
	
	while( 1 )
	{
		cin >> n >> x;
		if(n==0 && x==0)
		{
			break;
		}
		
		for(int i=0; i<n; i++)
		{
			cin >> dish[i];
		}
		
		max_val = 0;
		solve(0, 0);
		
		if(max_val != 0)
		{
			printf("%d\n", max_val);
		}
		else
		{
			printf("NA\n");
		}
	}
}	

Compiler output:
a.cc: In function 'void setPrime()':
a.cc:16:9: error: 'memset' was not declared in this scope
   16 |         memset(&prime[0], 0, sizeof(int) * (N+1));
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <math.h>
  +++ |+#include <cstring>
    4 |
Language: C++

#include<iostream>

using namespace std;

bool prime[1000001];
bool dp[1000001];
int menu[31];
void seive(int s){
	for(int i=0;i<=s;i++)prime[i]=true;
	prime[0]=prime[1]=false;
	for(int i=2;i<=s;i++){
		if(prime[2]==true){
			for(int j=i*2;j<=s;j+=i){
				prime[j]=false;
			}
		}
	}
}

int main(void){
	seive(1000000);
	int n,x;
	while(1){
		int max=0;
		memset(dp,false,sizeof(dp));
		scanf("%d%d",&n,&x);
		if(n==0 && x==0)break;
		for(int i=0;i<n;i++){
			scanf("%d",&menu[i]);
		}
		dp[0]=true;
		for(int i=0;i<n;i++){
			for(int j=menu[i];j<=x;j++){
				if(dp[j-menu[i]]==true)dp[j]=true;
			}
		}
		for(int i=0;i<=x;i++){
			if(dp[i]==true && prime[i]==true)max=i;
		}
		if(max>0)printf("%d\n",max);
		else printf("NA\n");
	}
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:17: error: 'memset' was not declared in this scope
   25 |                 memset(dp,false,sizeof(dp));
      |                 ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 |