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

#include <iostream>
#include <cstring>

using namespace std;

char dx[] = {-1,1,0,0};
char dy[] = {0,0,-1,1};
char dice[6][2] = {
	{4,2}, {3,5}, {5,0}, {1,4}, {0,3}, {2,1}
};

int board[9], goal[9];

void dfs(int x, int y, int px, int py, int step, int &res){
	if(step >= res) return;
	int space = 3*x+y;
	for(int i=0;i<4;i++){
		int nx = x + dx[i], ny = y + dy[i];
		if(nx<0||3<=nx||ny<0||3<=ny) continue;
		if(nx==px&&ny==py) continue;
		int mv = 3*nx+ny;
		int tmp = board[mv];
		board[space] = dice[board[mv]][i/2];
		board[mv] = 6;
		int dif = 0;
		for(int j=0;j<9;j++) dif += (goal[j]!=board[j]/2);
		if(dif==0) res = step;
		if(step+dif-1<res) dfs(nx, ny, x, y, step+1, ans);
		board[space] = 6;
		board[mv] = tmp;
	}
}

int main(){
	int x, y;
	while(cin >> y >> x, y){
		char c;
		for(int i=0;i<9;i++) {
			cin >> c;
			if(c=='W') goal[i] = 0;
			if(c=='B') goal[i] = 1;
			if(c=='R') goal[i] = 2;
			if(c=='E') goal[i] = 3;
		}
		memset(board,0,sizeof(board));
		board[3*(x-1)+y-1] = 6;
		int dif = 0;
		for(int i=0;i<9;i++) dif += (goal[i]!=board[i]/2);
		int res = dif ? 31 : 0;
		dfs(x-1,y-1,-1,-1,1,res);
		cout << (res==31?-1:res) << endl;
	}
}

Compiler output:
a.cc: In function 'void dfs(int, int, int, int, int, int&)':
a.cc:28:62: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |                 if(step+dif-1<res) dfs(nx, ny, x, y, step+1, ans);
      |                                                              ^~~
      |                                                              abs
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

vector<int> pn;
vector<bool> is_p;

void enum_prime()
{
  is_p.resize(1515, true);
  is_p[0] = is_p[1] = false;
  for(int i = 2; i <= 1515; i++) {
    if(!is_p[i]) continue;
    pn.push_back(i);
    for(int j = i+i; j <= 1515; j+=i) is_p[j] = false;
  }
}

int dp[1200][300][15];

int solve(int n, int p, int k)
{
  if(k == 0 && n == 0) return 1;
  if(k < 0 || n < 0 || p < 0) return 0;  
  
  int& ret = dp[n][p][k];
  if(~ret) return ret;

  int ret = solve(n, p - 1, k);
  if(n >= pn[p]) ret += solve(n - pn[p], p - 1, k - 1);

  return ret;
}

int main()
{
  enum_prime();
  int n, k;
  while(cin >> n >> k, n || k) {
    memset(dp, -1, sizeof(dp));
    int p = upper_bound(pn.begin(), pn.end(), n) - pn.begin() - 1;
    cout << solve(n, p, k) << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int solve(int, int, int)':
a.cc:31:7: error: conflicting declaration 'int ret'
   31 |   int ret = solve(n, p - 1, k);
      |       ^~~
a.cc:28:8: note: previous declaration as 'int& ret'
   28 |   int& ret = dp[n][p][k];
      |        ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[n];
  for(i=0;i<n;i++)cin>>a[i];
  for(i=0;i<n;i++){
    if(a[i]==0)
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:7: error: 'i' was not declared in this scope
    7 |   for(i=0;i<n;i++)cin>>a[i];
      |       ^
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   for(i=0;i<n;i++){
      |       ^
a.cc:10:3: error: expected primary-expression before '}' token
   10 |   }
      |   ^
Language: C++

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

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

bool isPrime(int n) {
  if( n < 2 ) return false;
  if( n == 2 ) return true;
  if( n % 2 == 0 ) return false;
  for(int d = 3; d * d <= n; d += 2 ) {
    if( n % d == 0 ) return false;
  }
  return true;
}

vector<int> primes;

int dp[1500][16];

int main() {
  for(int i = 0; i < 1120; i++)
    if( isPrime(i) )
      primes.push_back(i);

  int N = primes.size();

  memset(dp, 0, sizeof(dp));

  for(int i = 0; i < N; i++){
    for(int k = 14; k >= 0; k--) {
      for(int n = 1; n <= 1120; n++) {
        if( k == 1 && n - primes[i] == 0 ) {
          dp[n][k]++;
        }

        if( n - primes[i] > 0 ) {
          dp[n][k] += dp[n-primes[i]][k-1];
        }
      }
    }
  }

  for( int n, k; scanf("%d%d", &n, &k), (n || k); ) {
    printf("%d\n", dp[n][k]);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:3: error: 'memset' was not declared in this scope
   29 |   memset(dp, 0, sizeof(dp));
      |   ^~~~~~
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++

// 2006ツアツジツアツ地ツ凝ヲツ予ツ選D : Sum of Different Primes
#include <iostream>

using namespace std;

int main(){
  int prime[187];
  // [ツ債計ツ値][ツ催古」ツづ可使ツづつスツ素ツ青板づ景ndex][ツ使ツづつスツ素ツ青板づ個青脳
  static int memo[1121][187][15];
  memset(memo, 0, sizeof(memo));
  int size = 1;
  // 1120ツ暗按可コツづ個素ツ青板づーツ仰づ淞づつィツつュ
  prime[0] = 2;
  for(int i=3;i<1120;i+=2){
    bool flag = true;
    for(int j=0;prime[j]*prime[j]<=i;j++)
      if(i%prime[j]==0) flag = false;
    if(flag) prime[size++] = i;
  }
  // ツ素ツ青板づー1ツ古つつセツつッツ使ツづつスツ湘ェツ債づーツ記ツ録
  for(int i=0;i<size;i++) memo[prime[i]][i][1] = 1;
  // DPツづ残ツづィツづ個閉ェツづーツ仰づ淞づゥ
  for(int i=1;i<14;i++){
    for(int j=0;j<1121;j++){
      for(int k=0;k<187;k++){
	if(memo[j][k][i]==0) continue;
	// kツ氾板姪堋暗按降ツづ個素ツ青板づーツ堕ォツつオツ債づュツつケツつスツ閉ェツづーツカツウツδ督ト
	for(int l=k+1;l<187;l++){
	  if(j+prime[l]>1120) break;
	  memo[j+prime[l]][l][i+1] += memo[j][k][i];
	}
      }
    }
  }
  int n, k;
  while(cin >> n >> k, n){
    int ans = 0;
    // ツ前ツ渉按猟敖つオツつスツ表ツつゥツづァツ督堋つヲツづーツ仰づ淞づゥ
    for(int i=0;i<187;i++) ans += memo[n][i][k];
    printf("%d\n", ans);
  }
}

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

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

using namespace std;
const int MAX_PRIME=10000;
int prime[MAX_PRIME+1];
bool isPrime[MAX_PRIME+1];
int p;
void erats(){
	// primeツδ環スツトツづーツ渉可甘コツ可サ
	fill(isPrime,isPrime+MAX_PRIME,true);
	p = 0;
	isPrime[0] = isPrime[1] = false;

	for(int i = 2; i <= MAX_PRIME; i++){
		if(isPrime[i]){
			prime[p++] = i;
		}
		else
			continue;

		// ツづ督づゥツつ「ツづ可つゥツつッツづゥ
		for(int j = 2*i; j <= MAX_PRIME; j+=i){
			isPrime[j] = false;
		}
		cout << flush;
	}
}

int n,k;
int dp[15][1200][1200];
int dfs(int cnt,int left,int tail){
    if(dp[cnt][left][tail]!=-1)return dp[cnt][left][tail];
    int res=0;
    if(cnt==k){
        if(left==0)
            return 1;
        else
            return 0;
    }
    for(int i = tail; prime[i] <= left; i++){
        res+=dfs(cnt+1,left-prime[i],i+1);
    }
    return dp[cnt][left][tail]=res;
}

int main(){
    erats();
    while(cin>>n>>k&&!(n==0&&k==0)){
        memset(dp,-1,sizeof(dp));
        int res=dfs(0,n,0);
        cout<<res<<endl;
    }
    return 0;
}

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

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

using namespace std;
const int MAX_PRIME=2000;
int prime[MAX_PRIME+1];
bool isPrime[MAX_PRIME+1];
int p;
void erats(){
	// primeツδ環スツトツづーツ渉可甘コツ可サ
	fill(isPrime,isPrime+MAX_PRIME,true);
	p = 0;
	isPrime[0] = isPrime[1] = false;

	for(int i = 2; i <= MAX_PRIME; i++){
		if(isPrime[i]){
			prime[p++] = i;
		}
		else
			continue;

		// ツづ督づゥツつ「ツづ可つゥツつッツづゥ
		for(int j = 2*i; j <= MAX_PRIME; j+=i){
			isPrime[j] = false;
		}
		cout << flush;
	}
}

int n,k;
int dp[15][1200][305];
int dfs(int cnt,int left,int tail){
    if(dp[cnt][left][tail]!=-1)return dp[cnt][left][tail];
    int res=0;
    if(cnt==k){
        if(left==0)
            return 1;
        else
            return 0;
    }
    for(int i = tail; prime[i] <= left; i++){
        res+=dfs(cnt+1,left-prime[i],i+1);
    }
    return dp[cnt][left][tail]=res;
}

int main(){
    erats();
    while(cin>>n>>k&&!(n==0&&k==0)){
        memset(dp,-1,sizeof(dp));
        int res=dfs(0,n,0);
        cout<<res<<endl;
    }
    return 0;
}

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

import java.util.*;

public class Main{
    static int[] p = new int[1130];
    static int pnum;
    static int[][][] dp;

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

	calcPrimes();

	int n = sc.nextInt();
	int k = sc.nextInt();

	while(n!=0){

	    dp = new int[1121][15][188];
	    for(int i=0; i<=n; i++)
		for(int j=0; j<=k; j++)
		    for(int l=0; l<188; l++)dp[i][j][l] = -1;
	    System.out.println(solve(n,k,0));

	    n = sc.nextInt();
	    k = sc.nextInt();
	}
    }

    public static int solve(int n, int k, int idx){
	if(n==0 && k==0){return 1;}
	else if(n==0 || k==0){return 0;}
	if(dp[n][k][idx]>=0){return dp[n][k][idx];}
	
	int res = 0;
	for(int i=idx; i<pnum; i++){
	    if(p[i]>n){
		break;
	    }else{
		res += solve(n-p[i],k-1,i+1);
	    }
	}

	return dp[n][k][idx] = res;
    }

    public static void calcPrimes(){
	p[0] = 2;
	pnum = 1;
	for(int i=3; i<=1120; i+=2){
	    boolean add = true;
	    for(int j=0; j<pnum; j++){
		if(p[j]*p[j]>i){break;}
		if(i%p[j]==0){
		    add = false;
		    break;
		}
	    }
	    if(add){p[pnum++] = i;}
	}
    }
}

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

#include<iostream>
#include<cstring>
#define pb push_back
#include<vector>
using namespace std;
int n,k;
__int64 dp[20][2000];
vector<int> p;
int main(){
	vector<bool> used(1130,true);
	for(int i=2;i<=1120;i++){
		if(used[i]){
			for(int j=i*2;j<=1120;j+=i){
				used[j]=false;
			}
			p.pb(i);
		}
	}
	while(cin>>n>>k,n||k){
		memset(dp,0,sizeof(dp));
		dp[0][0]=1;
		for(int i=0;i<p.size()&&p[i]<=n;i++){//i番目の素数
			for(int j=k-1;j>=0;j--){//j回使った
				for(int l=0;l<=n-p[i];l++){//l
					if(dp[j][l]){
						dp[j+1][l+p[i]]+=dp[j][l];
					}
				}
			}
		}
		cout<<dp[k][n]<<endl;
	}
	return 0;
}

Compiler output:
a.cc:7:1: error: '__int64' does not name a type; did you mean '__int64_t'?
    7 | __int64 dp[20][2000];
      | ^~~~~~~
      | __int64_t
a.cc: In function 'int main()':
a.cc:20:24: error: 'dp' was not declared in this scope; did you mean 'p'?
   20 |                 memset(dp,0,sizeof(dp));
      |                        ^~
      |                        p
Language: C++

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

inline bool isPrime(int x){
  for(int i=2;i*i<=x;i++){
    if(x%i == 0)return false;
  }
  return true;
}

int n,k;
vector<int> prime;
int memo[1200][20];

int main(){
  for(int i=2;i<=1120;i++){
    if(isPrime(i))prime.push_back(i);
  }
  while(cin >> n >> k,n){
    memset(memo,0,sizeof(memo));
    memo[0][0] = 1;

    for(int x=0;x<prime.size();x++){
      if(prime[x] > n)break;

      for(int j=k-1;j>=0;j--){
	for(int i=n-prime[x];i>=0;i--){
	  memo[i+prime[x]][j+1] += memo[i][j];
	}
      }
    }

    cout << memo[n][k] << endl;
  }
}

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

#include <iostream>
#include <vector>

using namespace std;
int dp[15][1130];
bool isPrime[1130];
vector<int> prime;

void PrimeCalc()
{
	memset(isPrime, 1, sizeof(isPrime));
	isPrime[0] = isPrime[1] = false;
	for(int i = 2; i < 1130; ++i)
	{
		if(isPrime[i])
		{
			prime.push_back(i);
			for(int j = 2 * i; j < 1130; j += i)
			{
				isPrime[j] = false;
			}
		}
	}
}

void solve()
{
	PrimeCalc();
	dp[0][0] = 1;
	for(int i = 0; i < prime.size(); ++i)
	{
		for(int j = 14; j > 0; --j)
		{
			for(int k = prime[i]; k <=1120; ++k)
			{
				dp[j][k] += dp[j - 1][k - prime[i]];
			}
		}
	}
	int n, k;
	while(cin >> n >> k, n || k)
	{
		cout << dp[k][n] << endl;
	}
}

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

Compiler output:
a.cc: In function 'void PrimeCalc()':
a.cc:11:9: error: 'memset' was not declared in this scope
   11 |         memset(isPrime, 1, sizeof(isPrime));
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <vector>
  +++ |+#include <cstring>
    3 |
Language: Java

import java.util.Scanner;

//Power Calculus
public class AOJ1271 {

	int n;
	int[] k;
	boolean[] u;

	boolean reach(long b, long x, int rest){
		long r = b+x;
		while(rest--!=0)r+=r;
		return n<=r;
	}

	boolean dfs(int d, int x, int max, int len){
		if(d==0){
			return u[n];
		}
		if(d==1){
			return u[Math.abs(x-n)];
		}
		for(int i=len-1;i>=0;i--){
			int s = k[i]+x;
			if(!(2*n<s||u[s]||!reach(s, Math.max(max, s), d-1))){
				u[s] = true;
				k[len] = s;
				if(dfs(d-1, s, Math.max(max, s), len+1))return true;
				u[s] = false;
			}
			s = x-k[i];
			if(!(s<0||!reach(s, max, d-1)||u[s])){
				u[s] = true;
				k[len] = s;
				if(dfs(d-1, s, max, len+1))return true;
				u[s] = false;
			}
			s = k[i] - x;
			if(!(s<0||!reach(s, max, d-1)||u[s])){
				u[s] = true;
				k[len] = s;
				if(dfs(d-1, s, max, len+1))return true;
				u[s] = false;
			}
		}
		return false;
	}

	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			n = sc.nextInt();
			if(n==0)break;
			int x = 1, res = 0;
			while(x<n){
				x*=2; res++;
			}
			for(;;){
				u = new boolean[2500];
				k = new int[res+1];
				u[1] = true;
				k[0] = 1;
				if(dfs(res, 1, 1, 1)){
					System.out.println(res); break;
				}
				res++;
			}
		}
	}

	public static void main(String[] args) {
		new AOJ1271().run();
	}
}


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

    #include <cstdio>
     
    #define MAX_N 1024
    #define MAX_D 20
    int exp[MAX_D] = {1}, ans[MAX_N];
     
    void dfs(int d)
    {
        if (d > MAX_D)
        {
            return;
        }
        for (int i = 0; i <= d; i++)
        {
            exp[d + 1] = exp[i] + exp[d]; // 乘法
            if (exp[d + 1] < MAX_N && ans[exp[d + 1]] >= d + 1)
            {
                ans[exp[d + 1]] = d + 1;
                dfs(d + 1);
            }
            exp[d + 1] = exp[d] - exp[i]; // 除法
            if (exp[d + 1] > 0 && ans[exp[d + 1]] >= d + 1)
            {
                ans[exp[d + 1]] = d + 1;
                dfs(d + 1);
            }
        }
    }
     
    int main()
    {
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
    #endif
        for (int i = 2; i < MAX_N; i++)
        {
            //每个n的上界=除法+乘法
            ans[i] = __builtin_popcount(i) + (30 - __builtin_clz(i));
        }
        dfs(0);
     
        int n;
        while (~scanf("%d", &n), n)
        {
            printf("%d\n", ans[n]);
        }
    #ifndef ONLINE_JUDGE
        fclose(stdin);
    #endif
        return 0;
    }


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

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

int X;
int ANSWER;
bool exists[1<<13];
int estimate[1<<13];
int cur[13], maxi;

bool init() {
	scanf("%d", &X);
	return X > 0;
}


bool dfs(int depth) {
	if (depth + estimate[maxi] > ANSWER) {
		return false;
	}
	if (exists[X]) {
		return true;
	}
	for (int i = 0; i <= depth; ++i) {
		for (int j = 0; j <= depth; ++j) {
			const int add = cur[i] + cur[j];
			const int sub = cur[i] - cur[j];
			if (i <= j && !exists[add]) {
				int tmp = maxi;
				exists[add] = true;
				maxi = max(maxi, add);
				cur[depth + 1] = add;
				if (dfs(depth + 1)) {
					return true;
				}
				maxi = tmp;
				exists[add] = false;
			}
			if (sub > 0 && !exists[sub]) {
				exists[sub] = true;
				cur[depth + 1] = sub;
				if (dfs(depth + 1)) {
					return true;
				}
				exists[sub] = false;
			}
		}
	}
	return false;
}

int solve() {
	memset(exists, false, sizeof(exists));
	memset(estimate, 0, sizeof(estimate));
	for (int i = 1; i < 1<<13; ++i) {
		int t = i;
		for (;t < X; t <<= 1, ++estimate[i]);
	}
	exists[1] = true;
	cur[0] = 1;
	maxi = 1;
	for (ANSWER = 0; ANSWER <= 12; ++ANSWER) {
		if (dfs(0)) {
			return ANSWER;
		}
	}
	return ANSWER;
}


Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
#include <array>
#define repeat_from(i,m,n) for (int i = (m); (i) < (n); ++(i))
#define repeat(i,n) repeat_from(i,0,n)
#define repeat_from_reverse(i,m,n) for (int i = (n)-1; (i) >= (m); --(i))
#define repeat_reverse(i,n) repeat_from_reverse(i,0,n)
using namespace std;
constexpr int max_n = 1000;
constexpr int used_len = 2 * max_n;
bool iddfs(vector<int> & s, array<bool,used_len> & used, int mx, int depth, int n) {
    if (used[n]) return true;
    if (depth == 0) return false;
    if ((mx << depth) < n) return false;
    repeat_reverse (i,s.size()) {
        repeat_reverse (j,i+1) {
            for (int x : { s[i] + s[j], abs(s[i] - s[j]) }) {
                if (x <= 0 or used_len <= x) continue;
                if (used[x]) continue;
                used[x] = true;
                s.push_back(x);
                if (iddfs(s, used, max(mx, x), depth-1, n)) return true;
                s.pop_back();
                used[x] = false;
            }
        }
    }
    return false;
}
int iddfs(int n) {
    int depth = 0;
    while (true) {
        vector<int> s { 1 };
        array<bool,used_len> used = {};
        used[1] = true;
        if (iddfs(s, used, 1, depth, n)) break;
        depth += 1;
    }
    return depth;
}
int main() {
    while(scanf("%d", &n) && n){
      cout << iddfs(n) << endl;  
    }
    return 0;
}



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

#include<iostream>
#include<queue>
#include<vector>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define ALL(C)     (C).begin(),(C).end()
#define pb         push_back

const int N = 50;


class Edge{
public:
  int t,c;
};

class state{
public:
  int now;
  int cost;
  vector<int> path;
  bool operator<(const state & a)const{
    if (cost != a.cost)return cost > a.cost;
    rep(i,min(path.size(),a.path.size())){
      if (path[i] != a.path[i])return path[i] > a.path[i];
    }
    if (path.size()!= a.path.size())return path.size() < a.path.size();
    return false;
  }
};


vector<Edge>edge[N];

void dijkstra(int n,int f,int t,int k){
  int cnt = 0;
  priority_queue<state>Q;
  vector<int> ins;
  Q.push((state){f,0,ins});
  while(!Q.empty()){
    state now = Q.top();Q.pop();
    now.path.pb(now.now);
    if (now.now == t){
      cnt++;
      if (cnt == k){
	rep(i,now.path.size()){
	  if (i)cout <<"-";
	  cout << now.path[i]+1 ;
	}
	cout << endl;
	return;
      }
    }

    rep(i,edge[now.now].size()){
      if (find(ALL(now.path),edge[now.now][i].t)==
	  now.path.end())
      Q.push((state){edge[now.now][i].t,now.cost+edge[now.now][i].c,
		       now.path});
    }
  }
  cout <<"None"<<endl;
}

main(){
  int n,m,k,f,t;
  while(cin>>n>>m>>k>>f>>t && n){
    rep(i,n)edge[i].clear();
    rep(i,m){
      int tf,tt,td;
      cin>>tf>>tt>>td;
      edge[tf-1].pb((Edge){tt-1,td});
    }
    dijkstra(n,f-1,t-1,k);
  }
  return false;
}

Compiler output:
a.cc: In function 'void dijkstra(int, int, int, int)':
a.cc:57:15: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   57 |       if (find(ALL(now.path),edge[now.now][i].t)==
      |           ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:57:15: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   57 |       if (find(ALL(now.path),edge[now.now][i].t)==
      |           ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: At global scope:
a.cc:66:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   66 | main(){
      | ^~~~
Language: Java

import java.util.*;
class Main{
	public static void main(String[]z){
		Scanner cin=new Scanner(System.in);
		int n,k,m;
		for(;;System.out.println((r+m)%n+1)){
			n=cin.nextInt();k=cin.nextInt();m=cin.nextInt();
			if(n==0)break;
			for(r=i=0;++i<n;r%=i)r+=k;
		}
	}
}

Compiler output:
Main.java:6: error: cannot find symbol
		for(;;System.out.println((r+m)%n+1)){
		                          ^
  symbol:   variable r
  location: class Main
Main.java:9: error: cannot find symbol
			for(r=i=0;++i<n;r%=i)r+=k;
			    ^
  symbol:   variable r
  location: class Main
Main.java:9: error: cannot find symbol
			for(r=i=0;++i<n;r%=i)r+=k;
			      ^
  symbol:   variable i
  location: class Main
Main.java:9: error: cannot find symbol
			for(r=i=0;++i<n;r%=i)r+=k;
			            ^
  symbol:   variable i
  location: class Main
Main.java:9: error: cannot find symbol
			for(r=i=0;++i<n;r%=i)r+=k;
			                ^
  symbol:   variable r
  location: class Main
Main.java:9: error: cannot find symbol
			for(r=i=0;++i<n;r%=i)r+=k;
			                   ^
  symbol:   variable i
  location: class Main
Main.java:9: error: cannot find symbol
			for(r=i=0;++i<n;r%=i)r+=k;
			                     ^
  symbol:   variable r
  location: class Main
7 errors
Language: Java

import java.util.LinkedList;
import java.util.Scanner;

//And Then There Was One
public class AOJ1275 {

	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			int n = sc.nextInt(), k = sc.nextInt(), m = sc.nextInt();
			if((n|k|m)==0)break;
			LinkedList<Integer> l = new LinkedList<Integer>();
			for(int i=0;i<n;i++)l.add(i);
			int p = m-1;
			l.remove(p);
			while(l.size()>1){
				p = (p+k-1)%l.size();
				l.remove(p);
			}
			System.out.println(l.get(0)+1);
		}
	}
	
	public static void main(String[] args) {
		new AOJ1275().run();
	}
}

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

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

int joseph(int n,int diff,int initial){
	int r=0,i=1;
	for(;i<n;i++)r=(r+diff)%i;
	return (r+1+initial)%n+1;
}

int main(){
	int n,k,m;
	for(;scanf("%d%d%d",&n,&k,&m),n;){
		vector<int>v(n);
		for(int i=0;i<n;i++)v[i]=i+1;
		printf("%d\n",joseph(v,k,m-1));
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:38: error: cannot convert 'std::vector<int>' to 'int'
   16 |                 printf("%d\n",joseph(v,k,m-1));
      |                                      ^
      |                                      |
      |                                      std::vector<int>
a.cc:5:16: note:   initializing argument 1 of 'int joseph(int, int, int)'
    5 | int joseph(int n,int diff,int initial){
      |            ~~~~^
Language: C++

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

int joseph(int n,int diff,int initial){
	int r=0,i=1;
	for(;i<n;i++)r=(r+diff)%i;
	return (r+1+initial)%n+1;
}

int main(){
	int n,k,m;
	for(;scanf("%d%d%d",&n,&k,&m),n;printf("%d\n",joseph(v,k,m-1)));
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:62: error: 'v' was not declared in this scope
   13 |         for(;scanf("%d%d%d",&n,&k,&m),n;printf("%d\n",joseph(v,k,m-1)));
      |                                                              ^
Language: C++

#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<list>
using namespace std;
int stoi(string x){stringstream ss;ss<<x;int tmp;ss>>tmp;return tmp;}
string itos(int x){stringstream ss;ss<<x;return ss.str();}
int main(){
	vector<int>ta;
	int n,m,k;
	while(true){
	cin>>n>>k>>m;
	if(n==0&&m==0&&k==0)break;
	for(int i=0;i<n;i++)ta.push_back(i+1);
	//list<int>::iterator it=ta.begin();
	int i;
	int now=0;
	while(ta.size()!=1){
		//if(ta.size()>=n-5)for(int i=0;i<ta.size();i++)cout<<ta[i]<<" ";cout<<endl;
		if(ta.size()==n){
		now=(m-1)%ta.size();
		ta.erase(ta.begin()+now);
		}
		else{
		now=(now+k-1)%ta.size();
		ta.erase(ta.begin()+now);
		}
	}//endwhile
	cout<<ta[0]<<endl;
	ta.clear();
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'cin' was not declared in this scope
   16 |         cin>>n>>k>>m;
      |         ^~~
a.cc:9:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    8 | #include<list>
  +++ |+#include <iostream>
    9 | using namespace std;
a.cc:33:9: error: 'cout' was not declared in this scope
   33 |         cout<<ta[0]<<endl;
      |         ^~~~
a.cc:33:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include<iostream>
#include<vector>
using namespace std;
#define MAX 10001
int n,k,m;

void init(){
  for(int i=0;i<MAX;i++)bit[i]=0;
}

int main(){
  while(1){
    cin>>n>>k>>m;    
    if(n==0&&k==0&&m==0)break;
    init();

    vector<int> t;
    for(int i=1;i<=n;i++)t.push_back(i);

    m--;
    for(int i=0;i<n-1;i++){
      t.erase(t.begin()+m);
      if(m==(int)t.size())m=0;
      m+=k-1;
      m%=(int)t.size();
    }
    cout<<t[0]<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'void init()':
a.cc:8:25: error: 'bit' was not declared in this scope
    8 |   for(int i=0;i<MAX;i++)bit[i]=0;
      |                         ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {
  while (1) {
    int N, K, M; cin >> N >> K >> M;
    if (N == 0 and K == 0 and M == 0) break;
    M--;
    vector<int> stones(N); REP(i, N) stones[i] = i;
    while (stones.size() > 1) {
      stones.erase(stones.begin() + M);
      M = (M + K - 1 + stones.size()) % stones.size();
    }
    cout << stones[0] + 1 << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:32: error: 'i' was not declared in this scope
   10 |     vector<int> stones(N); REP(i, N) stones[i] = i;
      |                                ^
a.cc:10:28: error: 'REP' was not declared in this scope
   10 |     vector<int> stones(N); REP(i, N) stones[i] = i;
      |                            ^~~
Language: C++

#include<bits/stdc++.h>
#define vector list
using namespace std;
??
signed main(){
????????int a,b,c;
????????while(cin>>a>>b>>c,a|b|c){
????????????????vector<int>V;
????????????????for(int c=0;c<a;c++){
????????????????????????V.push_back(c+1);
????????????????????????}
????????????????auto d=V.begin();
????????????????????????for(int e=1;e<c;e++){
????????????????????????????????d++;
if(d==V.end())d=V.begin();
????????????????????????????????}
????????????????????????V.erase(d);
????????????????????????for(int e=2;e<a;e++){
????????????????????????????????for(int f=1;f<b;f++){
????????????????????????????????????????d++;
????????????????????????????????????????if(d==V.end())d=V.begin();
????????????????????????????????????????}
????????????????????????????????V.erase(d);
????????????????????????????????if(d==V.end())d=V.begin();?? 
????????????????????????????????}
????????????????cout<<*V.begin()<<endl;???????? 
????????????????}
????????}

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

#include <iostream>
using namespace std;

josephus(int n, int k){
	if(n==1) return 0;
	return (josephus(n-1,k)+k)%n;
}

int main(){
	while(1){
		int n,k,m;
		cin >> n >> k >> m;
		if(n==0) break;
		cout << (josephus(n-1,k)+m)%n + 1 << endl;
	}
	return 0;
}

Compiler output:
a.cc:4:1: error: ISO C++ forbids declaration of 'josephus' with no type [-fpermissive]
    4 | josephus(int n, int k){
      | ^~~~~~~~
Language: C++

#include <iostream>
using namespace std;
int main(){
	const int nmax = 10000;
	register int n, k ,m;
	int next[nmax+1];
	while(cin >> n >> k >> m){
		if(n == 0 && k == 0 && m == 0) break;
		for(int i = 1; i < n; i++){
			next[i] = i+1;
		}
		next[n] = 1;
		next[m-1] = next[m];
		while(next[m] != m){
			for(int j = 1; j < k; j++) m = next[p];
			next[m] = next[next[m]];
		}
		cout << m << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    5 |         register int n, k ,m;
      |                      ^
a.cc:5:25: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    5 |         register int n, k ,m;
      |                         ^
a.cc:5:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    5 |         register int n, k ,m;
      |                            ^
a.cc:15:61: error: 'p' was not declared in this scope
   15 |                         for(int j = 1; j < k; j++) m = next[p];
      |                                                             ^
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;


int st[10001];

int main(){
	int n,k,m;
	while(cin>>n){
		cin>>k>>m;
		
		for(int i=0;i<=n;i++){
			st[i]=i;
		}
		
		int lest=n;
		st[m]=0;
		while(n>2){
			for(int i=0;i<k;){
				m=m%n+1;
				if(st[m]!=0)++i;
			}
			
			st[m]=0;
		}
		
		for(int i=1;i<=n;i++){
			if(st[i])printf("%d\n",st[i]),break;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:55: error: expected primary-expression before 'break'
   47 |                         if(st[i])printf("%d\n",st[i]),break;
      |                                                       ^~~~~
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;
int n,k,m;
//f(n + 1,n) = f(n,n - 1) - [(n - 1) - (k - 1)% n] % n
void solve(){	
	int res = 0;
	for(int i = 2;i < n;i ++){
		res = (res - ((i - 1) - (k - 1) % i + i)%i + i)% i; 
		
	}
	int res =  (res + m) % n + 1;
}

int main(){
	while(scanf("%d%d%d",&n,&k,&m) && !(n == 0 && m == 0 && k == 0)){
		solve();
		
	}
	
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:12:13: error: redeclaration of 'int res'
   12 |         int res =  (res + m) % n + 1;
      |             ^~~
a.cc:7:13: note: 'int res' previously declared here
    7 |         int res = 0;
      |             ^~~
Language: C++

#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) cerr << #x << "=" << static_cast<bitset<16> >(x) << endl;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=x && x<w && 0<=y && y<h)

const int INF = 10000000;
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};
using namespace std;
typedef pair<int, int> P;

/**Problem1275 : And Then There Was One **/
int main()
{
	int n, k, m;
	
	while (cin>>n>>k>>m, n||k||m) {
		vector<int> v;
		rep(i, n) {
			v.push_back(i+1);
		}
		int pos=m-1;
		rep(i, n-1) {
			v.erase(v.begin()+pos);
			pos+=k-1;
			pos%=v.size();
		}
		cout << v[0] << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: 'vector' was not declared in this scope
   20 |                 vector<int> v;
      |                 ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | 
a.cc:20:24: error: expected primary-expression before 'int'
   20 |                 vector<int> v;
      |                        ^~~
a.cc:22:25: error: 'v' was not declared in this scope
   22 |                         v.push_back(i+1);
      |                         ^
a.cc:26:25: error: 'v' was not declared in this scope
   26 |                         v.erase(v.begin()+pos);
      |                         ^
a.cc:30:25: error: 'v' was not declared in this scope
   30 |                 cout << v[0] << endl;
      |                         ^
Language: Java

import java.util.ArrayList;
import java.util.Scanner;

public class AOJ1276 {
	public static void main(String[] args) {
		init(1300000);
		Scanner sc = new Scanner(System.in);
		while(true) {
			int n = sc.nextInt();
			if (n==0) {
				break;
			}
			if (isPrime(n) || n == 1) {
				System.out.println(0);
			}else{
				int i = n+1;
				while(!isPrime(i)) {
					i++;
				}
				int higherp = i;
				i = n-1;
				while(!isPrime(i)) {
					i--;
				}
				int lowerp = i;
				System.out.println(higherp-lowerp);
			}
		}
	}

	private static long max_number;
	private static int max_number_sieve;
	private static boolean[] is_not_prime;
	private static ArrayList<Integer> prime = new ArrayList<Integer>();
	public static void init(long maxnum) {
		max_number = maxnum;
		max_number_sieve = (int) Math.sqrt(max_number);
		is_not_prime = new boolean[max_number_sieve+1];
		is_not_prime[0] = is_not_prime[1] = true;
		for(int i=2;i*i<=max_number_sieve;i++) {
			if (!is_not_prime[i]) {
				int j = 2;
				while(i*j<=max_number_sieve) {
					is_not_prime[i*j] = true;
					j++;
				}
			}
		}
		for(int i=2;i<=max_number_sieve;i++) {
			if(!is_not_prime[i]) {
				prime.add(i);
			}
		}
	}
	public static boolean isPrime(long n) {
		if (n>max_number) {
			return false;
		}
		if (n<=max_number_sieve) {
			return !is_not_prime[(int) n];
		}else{
			for(int p:prime) {
				if (n%p==0 && n!=p) {
					return false;
				}
			}
			return true;
		}
	}
	public static int countPrime(long first,long last) {
		if (first>last) {
			return 0;
		}
		if (last>max_number) {
			return -1;
		}
		int num = 0;
		for(int i=(int) first;i<=last;i++) {
			if (isPrime(i)) {
				num++;
			}
		}
		return num;
	}
	public static ArrayList<Integer> primeFactor(long n) {
		ArrayList<Integer> factor = new ArrayList<Integer>();
		for(int p:prime) {
			while(n%p==0) {
				n/=p;
				factor.add(p);
			}
		}
		return factor;
	}
	public static ArrayList<Factor> primeFactorExp(long n) {
		ArrayList<Factor> factor = new ArrayList<Factor>();
		if (n==0) {
			return factor;
		}
		for(int p:prime) {
			int q = 0;
			while(n%p==0) {
				n/=p;
				q++;
			}
			if (q>=1) {
				factor.add(new Factor(p,q));
			}
		}
		return factor;
	}
}
class Factor {
	int base;
	int exp;
	public Factor(int base,int exp) {
		this.base = base;
		this.exp = exp;
	}
	public String toString() {
		if (exp==1) {
			return Integer.toString(base);
		}else{
			return base + "^" + exp;
		}
	}
}

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

#include<stdio.h>
int prime[1300001];

void isprime(void){
    int i,j,n,c;

    for(i = 4;i<1300001;i += 2)prime[i] = 1;

    for (i = 3;i * i <= 1300001;i += 2){
        if (prime[i] == 0){
            for (j = i + i; j <= 1300001; j += i){
                prime[j] = 1;
            }
        }
    }
}

int main(void){
    int n,i,a;
     
    isprime();
    
    while (scanf("%d",&n),n){
        a = 0;
        for (i = n; prime[i] == 1; i++)a++;
        for (i = n; !IS_PRIME(i); i--)gap++;
        printf("%d\n", a);
    }
     
    return (0);
}

Compiler output:
main.c: In function 'main':
main.c:26:22: error: implicit declaration of function 'IS_PRIME' [-Wimplicit-function-declaration]
   26 |         for (i = n; !IS_PRIME(i); i--)gap++;
      |                      ^~~~~~~~
main.c:26:39: error: 'gap' undeclared (first use in this function)
   26 |         for (i = n; !IS_PRIME(i); i--)gap++;
      |                                       ^~~
main.c:26:39: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int prime[1300001];

void isprime(void){
    int i,j,n,c;

    for(i = 4;i<1300001;i += 2)prime[i] = 1;

    for (i = 3;i * i <= 1300001;i += 2){
        if (prime[i] == 0){
            for (j = i + i; j <= 1300001; j += i){
                prime[j] = 1;
            }
        }
    }
}

int main(void){
    int n,i,a;
     
    isprime();
    
    while (scanf("%d",&n),n){
        a = 0;
        for (i = n; prime[i] == 1; i++)a++;
        for (i = n; !IS_PRIME(i); i--)a++;
        printf("%d\n", a);
    }
     
    return (0);
}

Compiler output:
main.c: In function 'main':
main.c:26:22: error: implicit declaration of function 'IS_PRIME' [-Wimplicit-function-declaration]
   26 |         for (i = n; !IS_PRIME(i); i--)a++;
      |                      ^~~~~~~~
Language: C++

#include<iostream>
using namespace std;
int primes[400003];
bool is(int n){
	if(n==2)return true;
	for(int i=3;i*i<=n;i++)if(n%i==0)return false;
	return true;
}
int main(){
	int cnt=0,ii=2;
	while(true){
	if(cnt==400003)break;
	if(is(ii)){
	primes[cnt]=ii;
	cnt++;
	}
	ii++;
	}
	int n;
	while(cin>>n){
	if(n==0)break;
	int a=0,b=0;
	bool f=0,f2=0;
	for(int i=0;i<400003;i++){
	if(primes[i]<n)a=primes[i];
	if(f==0&&primes[i]>n)b=primes[i],f=1;
	if(primes[i]==n)f2=1;
	}
	int ans=0;
	//for(int i=a+1;i<b;i++)if(is(i)==0)ans++;
	if(i<=1)cout<<0<<endl;
	else cout<<b-a<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:12: error: 'i' was not declared in this scope
   31 |         if(i<=1)cout<<0<<endl;
      |            ^
Language: C++

#include<iostream>
using namespace std;
int X, Y, A, i, j;
int main() {
	while (true) {
		cin >> A;
		for (i = A; i >= 2; i--) { for (j = 2; j <= sqrt(i); j++) { if (i%j == 0) { goto E; } }X = i; goto F; E:; }
	F:; for (i = A; i < 99999999; i++) { for (j = 2; j <= sqrt(i); j++) { if (i%j == 0) { goto G; } }Y = i; goto H; G:; }
	H:; cout << Y - X << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:61: error: 'sqrt' was not declared in this scope
    7 |                 for (i = A; i >= 2; i--) { for (j = 2; j <= sqrt(i); j++) { if (i%j == 0) { goto E; } }X = i; goto F; E:; }
      |                                                             ^~~~
a.cc:8:63: error: 'sqrt' was not declared in this scope
    8 |         F:; for (i = A; i < 99999999; i++) { for (j = 2; j <= sqrt(i); j++) { if (i%j == 0) { goto G; } }Y = i; goto H; G:; }
      |                                                               ^~~~
Language: C++

#include<iostream>
using namespace std;
int X, Y, A, i, j;
int main() {
	while (true) {
		cin >> A; if (A == 0) { break; }
		for (i = A; i >= 2; i--) { for (j = 2; j <= sqrt(i); j++) { if (i%j == 0) { goto E; } }X = i; goto F; E:; }
	F:; for (i = A; i < 99999999; i++) { for (j = 2; j <= sqrt(i); j++) { if (i%j == 0) { goto G; } }Y = i; goto H; G:; }
	H:; cout << Y - X << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:61: error: 'sqrt' was not declared in this scope
    7 |                 for (i = A; i >= 2; i--) { for (j = 2; j <= sqrt(i); j++) { if (i%j == 0) { goto E; } }X = i; goto F; E:; }
      |                                                             ^~~~
a.cc:8:63: error: 'sqrt' was not declared in this scope
    8 |         F:; for (i = A; i < 99999999; i++) { for (j = 2; j <= sqrt(i); j++) { if (i%j == 0) { goto G; } }Y = i; goto H; G:; }
      |                                                               ^~~~
Language: C++

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

public class Main{
	Scanner sc=new Scanner(System.in);

	void run(){
		boolean[] p=new boolean[2000000];
		Arrays.fill(p, true);
		p[0]=p[1]=false;
		for(int i=2; i<p.length; i++){
			if(p[i]){
				for(int j=i*2; j<p.length; j+=i){
					p[j]=false;
				}
			}
		}
		for(;;){
			int m=sc.nextInt();
			if(m==0){
				break;
			}
			int ans=0;
			for(int i=m; i>=0&&!p[i]; i--){
				ans++;
			}
			for(int i=m; i<p.length&&!p[i]; i++){
				ans++;
			}
			println(""+ans);
		}
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

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

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
vector<int> P;
const int pmax=1299709;
bool iscomp[pmax+1];
void init()
{
	P.reserve(100000);
	for(int i=2;i<pmax+1;i++){
		if(iscomp[i])continue;
		P.push_back(i);
		for(int j=2;i*j<pmax+1;j++)
			iscomp[i*j]=true;
	}
}
int main()
{
	init();
	while(true){
		int n;
		cin>>n;
		if(n==0)return;
		int pos=lower_bound(n)-R.begin();
		if(P[pos]==n)cout<<0<<endl;
		else{
			cout<<P[pos+1]-P[pos]<<endl;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:25: error: return-statement with no value, in function returning 'int' [-fpermissive]
   24 |                 if(n==0)return;
      |                         ^~~~~~
a.cc:25:36: error: no matching function for call to 'lower_bound(int&)'
   25 |                 int pos=lower_bound(n)-R.begin();
      |                         ~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:62,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note: candidate: 'template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&)'
 1530 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:1963:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> _FIter std::lower_bound(_FIter, _FIter, const _Tp&, _Compare)'
 1963 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1963:5: note:   candidate expects 4 arguments, 1 provided
a.cc:25:40: error: 'R' was not declared in this scope
   25 |                 int pos=lower_bound(n)-R.begin();
      |                                        ^
Language: C++

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
vector<int> P;
const int pmax=1299709;
bool iscomp[pmax+1];
void init()
{
	P.reserve(100000);
	for(int i=2;i<pmax+1;i++){
		if(iscomp[i])continue;
		P.push_back(i);
		for(int j=2;i*j<pmax+1;j++)
			iscomp[i*j]=true;
	}
}
int main()
{
	init();
	while(true){
		int n;
		cin>>n;
		if(n==0)return;
		int pos=lower_bound(P.begin(),P.end(),n)-P.begin();
		if(P[pos]==n)cout<<0<<endl;
		else{
			cout<<P[pos+1]-P[pos]<<endl;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:25: error: return-statement with no value, in function returning 'int' [-fpermissive]
   24 |                 if(n==0)return;
      |                         ^~~~~~
Language: C++

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

int prime[max];

void mk_prime(){
    for( int i = 0; i < max; i++){
        prime[i] = 1;
    }
    prime[0] = 0;
    prime[1] = 0;
    for( int i = 2; i < max; i++ ){
        if( prime[i] == 1 ){
            for( int j = 2 * i; j < max; j += i ){
                prime[j] = 0;
            }
        }
    }
}

int main(){
    mk_prime();
    int k;

    while( cin >> k && k ){
        if( prime[k] ){
            cout << 0 << endl;
            continue;
        }
        int s, e;
        for( int i = k - 1; ; i-- ){
            if( prime[i] ){
                s = i;
                break;
            }
        }
        for( int i = k + 1; ; i++ ){
            if( prime[i] ){
                e = i;
                break;
            }
        }
        cout << e - s << endl;
    }
}

Compiler output:
a.cc:3:20: error: expected ']' before ';' token
    3 | #define max 1000000;
      |                    ^
a.cc:5:11: note: in expansion of macro 'max'
    5 | int prime[max];
      |           ^~~
a.cc:5:14: error: expected unqualified-id before ']' token
    5 | int prime[max];
      |              ^
a.cc: In function 'void mk_prime()':
a.cc:8:28: error: expected primary-expression before ';' token
    8 |     for( int i = 0; i < max; i++){
      |                            ^
a.cc:8:28: error: expected ')' before ';' token
    8 |     for( int i = 0; i < max; i++){
      |        ~                   ^
a.cc:8:30: error: 'i' was not declared in this scope
    8 |     for( int i = 0; i < max; i++){
      |                              ^
a.cc:11:5: error: 'prime' was not declared in this scope
   11 |     prime[0] = 0;
      |     ^~~~~
a.cc:13:28: error: expected primary-expression before ';' token
   13 |     for( int i = 2; i < max; i++ ){
      |                            ^
a.cc:13:28: error: expected ')' before ';' token
   13 |     for( int i = 2; i < max; i++ ){
      |        ~                   ^
a.cc: In function 'int main()':
a.cc:27:13: error: 'prime' was not declared in this scope
   27 |         if( prime[k] ){
      |             ^~~~~
a.cc:33:17: error: 'prime' was not declared in this scope
   33 |             if( prime[i] ){
      |                 ^~~~~
a.cc:39:17: error: 'prime' was not declared in this scope
   39 |             if( prime[i] ){
      |                 ^~~~~