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

#include <stdio.h>

const int max = 300000;
bool is_Prime[max];

void eratos(){
	is_Prime[0] = is_Prime[1] = false;
	for(int i=2; i<max; i++){
		is_Prime[i] = true;
	}
	for(int i=4; i<max; i+=2)
		is_Prime[i] = false;
	for(int i=3; i*i<max; i+=2){
		if(is_Prime[i])
			for(int j=2*i; j<max; j+=i)
				is_Prime[j] = false;
	}
}

int main(){
	int n,ans;
	
	eratos();
	
	while(1){
		scanf("%d", &n);
		if(!n)
			break;
		ans = 0;
		for(int i=n+1; i<=2*n; i++){
			if(is_Prime[i])
				ans++;
		}
		printf("%d\n", ans);
	}
	
	return 0;
}

Compiler output:
main.c:4:1: error: unknown type name 'bool'
    4 | bool is_Prime[max];
      | ^~~~
main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include <stdio.h>
  +++ |+#include <stdbool.h>
    2 | 
main.c:4:6: error: variably modified 'is_Prime' at file scope
    4 | bool is_Prime[max];
      |      ^~~~~~~~
main.c: In function 'eratos':
main.c:7:37: error: 'false' undeclared (first use in this function)
    7 |         is_Prime[0] = is_Prime[1] = false;
      |                                     ^~~~~
main.c:7:37: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:7:37: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:31: error: 'true' undeclared (first use in this function)
    9 |                 is_Prime[i] = true;
      |                               ^~~~
main.c:9:31: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
Language: C

#include <stdio.h>

const int max = 300000;
int is_Prime[max];

void eratos(){
	is_Prime[0] = is_Prime[1] = 0;
	for(int i=2; i<max; i++){
		is_Prime[i] = 1;
	}
	for(int i=4; i<max; i+=2)
		is_Prime[i] = 0;
	for(int i=3; i*i<max; i+=2){
		if(is_Prime[i])
			for(int j=2*i; j<max; j+=i)
				is_Prime[j] = 0;
	}
}

int main(){
	int n,ans;
	
	eratos();
	
	while(1){
		scanf("%d", &n);
		if(!n)
			break;
		ans = 0;
		for(int i=n+1; i<=2*n; i++){
			if(is_Prime[i])
				ans++;
		}
		printf("%d\n", ans);
	}
	
	return 0;
}

Compiler output:
main.c:4:5: error: variably modified 'is_Prime' at file scope
    4 | int is_Prime[max];
      |     ^~~~~~~~
Language: C

#include <stdio.h>

void eratos(int* is_Prime, int size){
	is_Prime[0] = is_Prime[1] = 0;
	int i,j;
	for(i=2; i<max; i++){
		is_Prime[i] = 1;
	}
	for(i=4; i<max; i+=2)
		is_Prime[i] = 0;
	for(i=3; i*i<max; i+=2){
		if(is_Prime[i])
			for(j=2*i; j<max; j+=i)
				is_Prime[j] = 0;
	}
}

int main(){
	const int max = 300000;
	int is_Prime[max];
	int i,n,ans;
	
	eratos(is_Prime, max);
	
	while(1){
		scanf("%d", &n);
		if(!n)
			break;
		ans = 0;
		for(i=n+1; i<=2*n; i++){
			if(is_Prime[i])
				ans++;
		}
		printf("%d\n", ans);
	}
	
	return 0;
}

Compiler output:
main.c: In function 'eratos':
main.c:6:20: error: 'max' undeclared (first use in this function)
    6 |         for(i=2; i<max; i++){
      |                    ^~~
main.c:6:20: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include<stdlib.h>
int main(int argc, char *argv[])
{
  while(1){
    int x, n;
    int res = 0;

    scanf("%d", &n);
    if( n == 0 ) break;
    
    for(x = n+1; x <= 2*n; ++x){
      int is_x_prime = 1;
      for(i = 2; i < x; ++i){
        if( x % I == 0 ){
          is_x_prime = 0;
        }
      }
      if( is_x_prime ) ++res;
    }

    printf("%d\n", res);
  }
  return (EXIT_SUCCESS);
}

Compiler output:
main.c: In function 'main':
main.c:14:11: error: 'i' undeclared (first use in this function)
   14 |       for(i = 2; i < x; ++i){
      |           ^
main.c:14:11: note: each undeclared identifier is reported only once for each function it appears in
main.c:15:17: error: 'I' undeclared (first use in this function)
   15 |         if( x % I == 0 ){
      |                 ^
Language: C

#include<stdio.h>
N=2*123456;
i,j,x,n,p,f[1+N];
int main(){for(i=2;i<=N;++i)f[i]=1;for(i=2;i<N;++i)if(f[i])for(j=2;i*j<N;++j)f[i*j]=0;while(scanf("%d",&n)&&n){for(x=n+1;x<=2*n;++x){if(f[x])++p;}printf("%d\n",p);}return 0;}

Compiler output:
main.c:2:1: warning: data definition has no type or storage class
    2 | N=2*123456;
      | ^
main.c:2:1: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
main.c:3:1: warning: data definition has no type or storage class
    3 | i,j,x,n,p,f[1+N];
      | ^
main.c:3:1: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
main.c:3:3: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
    3 | i,j,x,n,p,f[1+N];
      |   ^
main.c:3:5: error: type defaults to 'int' in declaration of 'x' [-Wimplicit-int]
    3 | i,j,x,n,p,f[1+N];
      |     ^
main.c:3:7: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
    3 | i,j,x,n,p,f[1+N];
      |       ^
main.c:3:9: error: type defaults to 'int' in declaration of 'p' [-Wimplicit-int]
    3 | i,j,x,n,p,f[1+N];
      |         ^
main.c:3:11: error: type defaults to 'int' in declaration of 'f' [-Wimplicit-int]
    3 | i,j,x,n,p,f[1+N];
      |           ^
main.c:3:11: error: variably modified 'f' at file scope
Language: C

#include<stdio.h>
N=2*123456;
i,j,x,n,p,q[1+N];
int main(){for(i=2;i<=N;++i)q[i]=1;for(i=2;i<N;++i)if(q[i])for(j=2;i*j<N;++j)q[i*j]=0;while(scanf("%d",&n)&&n){for(x=n+1;x<=2*n;++x){if(q[x])++p;}printf("%d\n",p);}return 0;}

Compiler output:
main.c:2:1: warning: data definition has no type or storage class
    2 | N=2*123456;
      | ^
main.c:2:1: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
main.c:3:1: warning: data definition has no type or storage class
    3 | i,j,x,n,p,q[1+N];
      | ^
main.c:3:1: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
main.c:3:3: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
    3 | i,j,x,n,p,q[1+N];
      |   ^
main.c:3:5: error: type defaults to 'int' in declaration of 'x' [-Wimplicit-int]
    3 | i,j,x,n,p,q[1+N];
      |     ^
main.c:3:7: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
    3 | i,j,x,n,p,q[1+N];
      |       ^
main.c:3:9: error: type defaults to 'int' in declaration of 'p' [-Wimplicit-int]
    3 | i,j,x,n,p,q[1+N];
      |         ^
main.c:3:11: error: type defaults to 'int' in declaration of 'q' [-Wimplicit-int]
    3 | i,j,x,n,p,q[1+N];
      |           ^
main.c:3:11: error: variably modified 'q' at file scope
Language: C

#include<stdio.h>
N=1<<20;i,j,x,n,p;int f[N];
int main(){for(i=2;i<N;++i)if(!f[i])for(j=i*2;j<N;j+=i)f[j]=1;while(scanf("%d",&n)&&n){for(x=n+1;x<=2*n;++x)if(!f[x])++p;printf("%d\n",p);}return 0;}

Compiler output:
main.c:2:1: warning: data definition has no type or storage class
    2 | N=1<<20;i,j,x,n,p;int f[N];
      | ^
main.c:2:1: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
main.c:2:9: warning: data definition has no type or storage class
    2 | N=1<<20;i,j,x,n,p;int f[N];
      |         ^
main.c:2:9: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
main.c:2:11: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
    2 | N=1<<20;i,j,x,n,p;int f[N];
      |           ^
main.c:2:13: error: type defaults to 'int' in declaration of 'x' [-Wimplicit-int]
    2 | N=1<<20;i,j,x,n,p;int f[N];
      |             ^
main.c:2:15: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
    2 | N=1<<20;i,j,x,n,p;int f[N];
      |               ^
main.c:2:17: error: type defaults to 'int' in declaration of 'p' [-Wimplicit-int]
    2 | N=1<<20;i,j,x,n,p;int f[N];
      |                 ^
main.c:2:23: error: variably modified 'f' at file scope
    2 | N=1<<20;i,j,x,n,p;int f[N];
      |                       ^
Language: C

#include<stdio.h>
const N=1<<20;i,j,x,n,p,f[N];
int main(){for(i=2;i<N;++i)if(!f[i])for(j=i*2;j<N;j+=i)f[j]=1;while(scanf("%d",&n)&&n){for(x=n+1;x<=2*n;++x)if(!f[x])++p;printf("%d\n",p);}return 0;}

Compiler output:
main.c:2:7: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
    2 | const N=1<<20;i,j,x,n,p,f[N];
      |       ^
main.c:2:15: warning: data definition has no type or storage class
    2 | const N=1<<20;i,j,x,n,p,f[N];
      |               ^
main.c:2:15: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
main.c:2:17: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
    2 | const N=1<<20;i,j,x,n,p,f[N];
      |                 ^
main.c:2:19: error: type defaults to 'int' in declaration of 'x' [-Wimplicit-int]
    2 | const N=1<<20;i,j,x,n,p,f[N];
      |                   ^
main.c:2:21: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
    2 | const N=1<<20;i,j,x,n,p,f[N];
      |                     ^
main.c:2:23: error: type defaults to 'int' in declaration of 'p' [-Wimplicit-int]
    2 | const N=1<<20;i,j,x,n,p,f[N];
      |                       ^
main.c:2:25: error: type defaults to 'int' in declaration of 'f' [-Wimplicit-int]
    2 | const N=1<<20;i,j,x,n,p,f[N];
      |                         ^
main.c:2:25: error: variably modified 'f' at file scope
Language: C

#include<stdio.h>
#define tmp 123456 * 2 + 1
int main(void)
{
	int f1, f2, n, cnt, *SL;
	SL = new int [tmp];

	for(f1 = 0; f1 <= tmp; f1++)
	{
		SL[f1] = 1;
	}
	SL[1] = 0;
	for(f1 = 2; f1 * f1 <= tmp; f1++)
	{
		if(SL[f1] == 1){
			for(f2 = f1 * 2; f2 <= tmp; f2 += f1)
			{
				SL[f2] = 0;
			}
		}
	}
	while(scanf("%d",&n) && n > 0)
	{
		cnt = 0;
		for(f1 = n+1; f1 <= n * 2; f1++)
		{
			if(SL[f1] == 1)
				cnt++;
		}
		printf("%d\n",cnt);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:14: error: 'new' undeclared (first use in this function)
    6 |         SL = new int [tmp];
      |              ^~~
main.c:6:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:17: error: expected ';' before 'int'
    6 |         SL = new int [tmp];
      |                 ^~~~
      |                 ;
Language: C

#include<stdio.h>
const int MAX=123456*2+1;
int P[MAX],F[MAX]={0},i,j,p=0,r;
int main()
{
	int N;
	for(i=2;i<MAX;i++)
		if(!F[i])
		{
			P[p++]=i;
			for(j=i*2;j<MAX;j+=i)
				F[j]=1;
		}
	for(;scanf("%d",&N)*N;)
	{
		for(i=r=0;i<p;i++)
			if(P[i]>N&&P[i]<=2*N)
				r++;
		printf("%d\n",r);
	}
	return 0;
}

Compiler output:
main.c:3:5: error: variably modified 'P' at file scope
    3 | int P[MAX],F[MAX]={0},i,j,p=0,r;
      |     ^
main.c:3:12: error: variably modified 'F' at file scope
    3 | int P[MAX],F[MAX]={0},i,j,p=0,r;
      |            ^
Language: C

 #include <stdio.h>$
  2 $
  3 int main(){$
  4     int n, p;$
  5     int i, j, k;$
  6     int f;$
  7 $
  8     while(1){$
  9         scanf("%d", &n);$
 10         if(n == 0){$
 11             break;$
 12         }$
 13 $
 14         p = 0;$
 15         for(i=n+1; i<=2*n; i++){$
 16             f = 1;$
 17             for(j=2; j<i; j++){$
 18                 if(i%j == 0){$
 19                     f = 0;$
 20                     break;$
 21                 }$
 22             }$
 23             if(f){$
 24                 p++;$
 25             }$  
 26 $
 27         }$
 28         printf("%d\n", p);$
 29 $   
 30     }$
 31     return 0;$
 32 }$
~                        

Compiler output:
main.c:1:20: warning: extra tokens at end of #include directive
    1 |  #include <stdio.h>$
      |                    ^
main.c:2:3: error: expected identifier or '(' before numeric constant
    2 |   2 $
      |   ^
main.c:33:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '~' token
   33 | ~
      | ^
Language: C++

#include <iostream>

using namespace std;

int dp[130000*2];

int main(){
	while(1){
		int n; cin >> n;
		if(!n) break;
		int count =0;
		for(int i=n+1; i<=2*n; i++){
			bool flag =true;
			for(int j=2; j<n; j++){
				if(dp[i]==1){
					count++;
					flag=false;
					break;
				}
				if(i%j==0){
					flag=false;
					break;
				}
			}
			if(flag){
				dp[i]=1;
				count++;
			}
		}
		cout << count << endl;
	} 
	return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:32:18: error: expected '}' at end of input
   32 |         return 0;
      |                  ^
a.cc:7:11: note: to match this '{'
    7 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<vector>
#include<list>


using namespace std;
using vec = vector<int>;
using lst = list<int>;

bool check(int x, lst & sosu)
{
	for(auto s : sosu)
	{
		if (sqrt(x) < s)return true;
		if (x%s == 0)return false;
	}
	return true;
}


int main()
{
	vec count(123456 * 2 + 1);
	lst sosu;
	
	count[0] = 0;
	count[1] = 0;
	count[2] = 1;
	sosu.emplace_back(2);

	for (int i = 3; i < count.size(); ++i)
	{
		count[i] = count[i - 1];
		if (check(i, sosu))
		{
			++count[i];
			sosu.emplace_back(i);
		}
	}


	int n;
	while (true)
	{
		cin >> n;

		if (n == 0)return 0;

		cout << count[2 * n] - count[n - 1] << endl;
	}
}


Compiler output:
a.cc: In function 'bool check(int, lst&)':
a.cc:14:21: error: 'sqrt' was not declared in this scope
   14 |                 if (sqrt(x) < s)return true;
      |                     ^~~~
Language: C++

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

using namespace std;

#define REP(i, x) for(int i=0;i<(int)(x);i++)
#define REPS(i, x) for(int i=1;i<=(int)(x);i++)
#define RREP(i, x) for(int i=(int)(x)-1;i>=0;i--)
#define RREPS(i, x) for(int i=(int)(x);i>0;i--)
#define FOR(i, x) for(auto it=x.begin();it!=x.end();++it)
typedef long long ll;
typedef vector<int> vi;

int n, p[300000];

int c(int x){
        return p[max(x-1, 0)];
}

int main(){
        for(int i=2;i<300000;i++){
                if(!p[i]){
                        for(ll j=(ll)i*i;j<300000;j+=i) p[j]=1;
                }
                p[i] = !p[i];
        }
        REP(i, 300000) p[i+1] += p[i];
        while(cin >> n, n){
                cout << c(2*n+1) - c(n+1) << endl;
        }
        return 0;
}
~       

Compiler output:
a.cc:35:2: error: expected class-name at end of input
   35 | ~
      |  ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

bool sosu(int a){
  if(a > 1000000){
	FOR(i,2,a/1000){
	  if(a%i==0) return false;
	}
  if(a > 10000){
	FOR(i,2,a/100){
	  if(a%i==0) return false;
	}
  }
  if(a > 100){
	FOR(i,2,a/10){
	  if(a%i==0) return false;
	}
  }else{ FOR(i,2,a/2){
	  if(a%i==0) return false;
	}
  }
  return true;
}

 
int main(){

  while(1){
	int n;
	int c = 0;
	cin >> n;
	if(n==0) break;
	FOR(i,n+1,2*n+1){
	  if(sosu(i)) c++; //cout << i << endl;
	}

	cout << c << endl;

  }
}

Compiler output:
a.cc: In function 'bool sosu(int)':
a.cc:50:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   50 | int main(){
      |         ^~
a.cc:50:9: note: remove parentheses to default-initialize a variable
   50 | int main(){
      |         ^~
      |         --
a.cc:50:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:50:11: error: a function-definition is not allowed here before '{' token
   50 | int main(){
      |           ^
a.cc:64:2: error: expected '}' at end of input
   64 | }
      |  ^
a.cc:28:17: note: to match this '{'
   28 | bool sosu(int a){
      |                 ^
a.cc:64:2: warning: control reaches end of non-void function [-Wreturn-type]
   64 | }
      |  ^
Language: C++

#include<iostream>
#include<string.h>
using namespace std;

vector<int>prime;
vector<int>not_prime;
int p[300000];
int main(){
    memset(p,0,sizeof(p));
    for(int i=2;i<253456;i++){
        for(int j=2;i*j<253456;j++){
            p[i*j]=1;
        }
    }
    int n,ans;
    while(cin>>n,n){
        ans=0;
        for(int i=n+1;i<=2*n;i++){
            //cout<<i<<"   p[i]  "<<p[i]<<endl;
            if(p[i]==0)ans++;
        }
        cout<<ans<<endl;
    }
    return 0;
}

Compiler output:
a.cc:5:1: error: 'vector' does not name a type
    5 | vector<int>prime;
      | ^~~~~~
a.cc:6:1: error: 'vector' does not name a type
    6 | vector<int>not_prime;
      | ^~~~~~
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int p[300000];
int main(){
    memset(p,0,sizeof(p));
    for(int i=2;i<253456;i++)
        for(int j=2;i*j<253456;j++)
            p[i*j]=1;
    int n,ans;
    while(cin>>n,n){
        ans=0;
        for(int i=n+1;i<=2*n;i++)
            if(p[i]==0)ans++;
        cout<<ans<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'memset' was not declared in this scope
    6 |     memset(p,0,sizeof(p));
      |     ^~~~~~
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 <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <stack>

using namespace std;


//エラトステネスの篩
int main(){
  int n;

  while(1){
    cin >> n;
    if(n==0) break;

    int count = 0;
    bool s[2*n+1];
    int era;

    for(int i=2; i<2*n+1 ; i++){
      s[i] = true;
    }

    for(int i=2 ; i*i<=(2*n+1) ; i++){
      if(s[i] != false){
        era = i;
        for(int j=2 ; (j*era)<(2*n+1) ; j++){
          s[j*era] = false;
        }
      }
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:36:6: error: expected '}' at end of input
   36 |     }
      |      ^
a.cc:17:11: note: to match this '{'
   17 |   while(1){
      |           ^
a.cc:36:6: error: expected '}' at end of input
   36 |     }
      |      ^
a.cc:14:11: note: to match this '{'
   14 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main(){
  vector<int> prime;		  
  for (int i=2;i<246912;i++){
    int count=0;
    int j;
    if (i%2!=0||(sqrt(i)-(int)sqrt(i))!=0){
      for (j=2;j<i/2;j++){
	if (i%j==0){
	  break;
	}
      }
    }
    if ((j==i/2||i==2||i==3)&&i!=4){
      prime.push_back(i);
    }
  }
  int n;
  while (cin>>n,n|n!=0){
    int i=0;
    int s;
    while (1){
      if (n<prime[i]){
	s=i;
	break;
      }
      i++;
    }
    int e;
    while (1){
      if (2*n<prime[i]){
	e=i-1;
	break;
      }
      i++;
    }
    cout<<e-s+1<<endl;
  }
　return 0;
}

Compiler output:
a.cc:42:1: error: extended character 　 is not valid in an identifier
   42 | 　return 0;
      | ^
a.cc: In function 'int main()':
a.cc:42:1: error: '\U00003000return' was not declared in this scope
   42 | 　return 0;
      | ^~~~~~~~
Language: C++

#include <iostream>

using namespace std;

bool prime_check(int n){
  prime_count = 0;
  for (int i = 2; i < n; ++i)
  {
    if (n%i == 0){
      prime_count ++;
      if (prime_count > 1)
      {
        return false
      }
    }
  }
  if (prime_count == 1){
    return true
  }
}


int main(){
  int n;
  while(cin >> n, n){
    count = 0;
    for (int i =  n+1; i <= 2*n ; ++i)
    {
      if (prime_check(i)){
        count++ ;
      }
    }
    cout << count << endl;
  }
}

Compiler output:
a.cc: In function 'bool prime_check(int)':
a.cc:6:3: error: 'prime_count' was not declared in this scope
    6 |   prime_count = 0;
      |   ^~~~~~~~~~~
a.cc:13:21: error: expected ';' before '}' token
   13 |         return false
      |                     ^
      |                     ;
   14 |       }
      |       ~              
a.cc:18:16: error: expected ';' before '}' token
   18 |     return true
      |                ^
      |                ;
   19 |   }
      |   ~             
a.cc: In function 'int main()':
a.cc:26:5: error: 'count' was not declared in this scope
   26 |     count = 0;
      |     ^~~~~
a.cc: In function 'bool prime_check(int)':
a.cc:20:1: warning: control reaches end of non-void function [-Wreturn-type]
   20 | }
      | ^
Language: C++

  #include<iostream>
  #include<vector>
  
  using namespace std;
  
  int main(void) {
  
          int in; 
  
          vector<int> list;
  
          for(int i=2;i<=123456;i++) {
                  bool sosu = true;
>>                for(int &n: list) {
                          if(i%n==0) {
                                  sosu = false;
                                  break;
                          }   
                  }   
                  if(sosu) {
                    list.push_back(i);
                  }   
                      
          }   
  
          while(cin >> in && in) {
  
                  int count=0;
                  for(int i=in+1;i<2*in;i++) {
                          bool sosu = true;
>>                        for(int &n: list) {
                                  if(n>=i) break;
                                  if(i%n==0) {
                                          sosu = false;
                                          break;
                                  }   
                          }   
                          if(sosu) count++;
                  }   
                  cout << count << endl;
          }   
              
          return 0;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:14:1: error: expected primary-expression before '>>' token
   14 | >>                for(int &n: list) {
      | ^~
a.cc:14:19: error: expected primary-expression before 'for'
   14 | >>                for(int &n: list) {
      |                   ^~~
a.cc:31:1: error: expected primary-expression before '>>' token
   31 | >>                        for(int &n: list) {
      | ^~
a.cc:31:27: error: expected primary-expression before 'for'
   31 | >>                        for(int &n: list) {
      |                           ^~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int cheb(int n);
int main(){
	int n;
	while (true){
		cin >> n;
		if (n == 0){ break; }
		cout << cheb(n) << endl;
	}
	cin.get();
	cin.get();
	return 0;
}
int cheb(int n){//10
	vector<int> searchlist;
	vector<int>::iterator sitr = searchlist.begin();
	vector<int> primelist;
	vector<int>::iterator pitr = primelist.begin();

	int prime = 0;
	int maxsearch = sqrt(n * 2);
	for (int i = 2; i < n; i++){		
		primelist.push_back(i);
	}
	for (int i = n + 1; i <= n * 2; i++){
		searchlist.push_back(i);
	}
	if (searchlist.at(0) == 2){
		return 1;
	}
	for (pitr = primelist.begin(); pitr != primelist.end();++pitr){
		int bufprime = *pitr;
		if (maxsearch < *pitr){ break; }
		for (vector<int>::iterator bufitr = primelist.begin(); bufitr != primelist.end();){
			if (*bufitr != bufprime && *bufitr % bufprime == 0){
				bufitr = primelist.erase(bufitr);
				continue;
			}
			bufitr++;
		}
	}
	for (pitr = primelist.begin(); pitr != primelist.end(); ++pitr){
		if (maxsearch < *pitr){ break; }
		for (sitr = searchlist.begin(); sitr != searchlist.end();){
			if (*sitr % *pitr == 0){
				sitr = searchlist.erase(sitr);
				continue;
			}
			sitr++;
		}
	}
	return (int)searchlist.size();
}

Compiler output:
a.cc: In function 'int cheb(int)':
a.cc:23:25: error: 'sqrt' was not declared in this scope
   23 |         int maxsearch = sqrt(n * 2);
      |                         ^~~~
Language: C++


#include <iostream>
using namespace std;

 
int main()
{
	int n;
	for (; cin >> n, n != 0;)
	{
		int c = 0;
		if (n == 1 || n== 2)c = 1;
		else
		{
			for (int i = n + 1; i <= 2 * n; i++)
			{
				if (i % 2 == 0 ||i%3==0 )continue;
				else
				{
					int a= (i - 3) / 2;
					for (int l = 3; l <= int(sqrt(i)); l+=2)
					{
						if (i%l == 0) {
							a--;
							break;
						}
					}
					if (a == (i-3)/2) c++;
				}
			}
		}
		cout << c << endl;
	}							
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:66: error: 'sqrt' was not declared in this scope
   21 |                                         for (int l = 3; l <= int(sqrt(i)); l+=2)
      |                                                                  ^~~~
Language: C++

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

int main() {
	int n,i,j,pin=0,p=0;
	while (1) {
		cin >> n;
		if (n == 0) { break; }
		for (i = n+1; i < 2 * n + 1; i++) {
			for (j = 2; j < sqrt(i)+1; j++) {
				if (i%j == 0) {
					pin = 1;
					break;
				}
			}
			if (pin == 0) { p = p + 1; }
			else { pin = 0; }
		}if (n == 1) { cout << 1; }else{cout << p << endl;
	}
		p = 0;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:41: error: 'sqrt' was not declared in this scope
   11 |                         for (j = 2; j < sqrt(i)+1; j++) {
      |                                         ^~~~
Language: C++

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

int main(){
    int n;
    while(cin>>n,n){
            vector<int> isprime(2*n+1,1);
            isprime[0]=0;
            isprime[1]=1;
                    for(int i=1;i<=2*n;i++)
                        if(isprime[i]){
                            for(int j=i*2;j<=2*n;j+=i)
                                isprime[j]=0;


                        }

                    int cnt=0;
                    for(int i=n;i<=2*n;i++)
                        cnt+=isprime[i];
                        }
            cout<<cnt<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:19: error: 'cnt' was not declared in this scope; did you mean 'int'?
   22 |             cout<<cnt<<endl;
      |                   ^~~
      |                   int
Language: C++

#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>
#include<functional>
#include<set>
using namespace std;

#define INF 1<<21
#define DIV 1000000007
#define MAX 250000



int main(){
  char prime[MAX];
  prime[0] = 0;
  prime[1] = 0;
  memset(prime, 1, sizeof(prime));
  for (int i = 2; i*i <MAX ; i++) {
	if (prime[i]) {
	  for (int j = 2*i; j < MAX; j += i) {
		prime[j] = 0;
	  }
	}
  }
  int n;
  while (cin >> n, n) {
	int cnt = 0;
	for (int i = n + 1; i <= 2 * n; i++) {
	  if (prime[i])cnt++;
	}
	cout << cnt << endl;
  }
  return 0;
}

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

import java.util.*;
class Main{
	public static void main(String[] args) {
		Scanner scn=new Scanner(System.in);
		int n;
		List<Integer> dat=new ArrayList<Integer>();
		while(true){
			int ans=0;
			n=scn.nextInt();
			if(n==0)break;

			for(int i=n+1;i<=2*n;i++){
				for(int j=2;j<=i;j++){
					if(i%j==0)break;
					if(j>=i/2){
						ans++;
						break;
					}

				}
			}
			dat.add(ans);
		}
		for(int i=0;i<dat.size();i++){
			System.out.println(dat.get(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:15: error: expected ':' before 'static'
    3 |         public static void main(String[] args) {
      |               ^~~~~~~
      |               :
a.cc:3:33: error: 'String' has not been declared
    3 |         public static void main(String[] args) {
      |                                 ^~~~~~
a.cc:3:42: error: expected ',' or '...' before 'args'
    3 |         public static void main(String[] args) {
      |                                          ^~~~
a.cc:28:2: error: expected ';' after class definition
   28 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:4:17: error: 'Scanner' was not declared in this scope
    4 |                 Scanner scn=new Scanner(System.in);
      |                 ^~~~~~~
a.cc:6:17: error: 'List' was not declared in this scope
    6 |                 List<Integer> dat=new ArrayList<Integer>();
      |                 ^~~~
a.cc:6:22: error: 'Integer' was not declared in this scope
    6 |                 List<Integer> dat=new ArrayList<Integer>();
      |                      ^~~~~~~
a.cc:6:31: error: 'dat' was not declared in this scope
    6 |                 List<Integer> dat=new ArrayList<Integer>();
      |                               ^~~
a.cc:6:39: error: 'ArrayList' does not name a type
    6 |                 List<Integer> dat=new ArrayList<Integer>();
      |                                       ^~~~~~~~~
a.cc:6:58: error: expected primary-expression before ')' token
    6 |                 List<Integer> dat=new ArrayList<Integer>();
      |                                                          ^
a.cc:9:27: error: 'scn' was not declared in this scope
    9 |                         n=scn.nextInt();
      |                           ^~~
a.cc:25:25: error: 'System' was not declared in this scope
   25 |                         System.out.println(dat.get(i));
      |                         ^~~~~~
Language: C++

import java.util.Scanner;

/**
 * @author 0x306e
 * 
 *         judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1172
 *
 */
public class Main {

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

    int data = sc.nextInt();

    while (data != 0) {
      if (data != 1) {
        System.out.println(cntPrimeNumber(data));
        data = sc.nextInt();
      } else {
        System.out.println(1);
        data = sc.nextInt();
      }
    }

    sc.close();
  }

  public static int cntPrimeNumber(int n) {
    int cnt = 0;
    if (isPrimeNumber(n)) {
      cnt--;
    }

    for (int i = n; i < n * 2; i++) {
      if (isPrimeNumber(i)) {
        cnt++;
      }
    }

    return cnt;
  }

  public static boolean isPrimeNumber(int n) {
    if (n < 2) {
      return false;
    } else if (n == 2) {
      return true;
    } else if ((n % 2) == 0) {
      return false;
    }

    double sqrtNum = Math.sqrt(n);
    for (int i = 3; i <= sqrtNum; i += 2) {
      if ((n % i) == 0) {
        return false;
      }
    }
    return true;
  }

}

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

#include<iostream>
using namespace std;
bool isprime(int n) {
	if (n == 2)return true;
	if (n % 2 == 0)return false;
	for (int i = 3; i <= sqrt(n); i += 2) if (n%i == 0)return false;
	return true;
}
int main() {
	int n;
	while (cin >> n) {
		if (!n)return 0;
		int sum = 0;
		for (int i = n + 1; i <= 2 * n; i++) {
			if (isprime(i))sum++;
		}
		cout << sum << endl;
	}
}

Compiler output:
a.cc: In function 'bool isprime(int)':
a.cc:6:30: error: 'sqrt' was not declared in this scope
    6 |         for (int i = 3; i <= sqrt(n); i += 2) if (n%i == 0)return false;
      |                              ^~~~
Language: C++

#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);


int main() {
	cin.sync_with_stdio(false);
	bool f[250000] = {};
	reps(i, 2, 250000) {
		if (f[i] == 1)continue;
		reps(j, i + 1, 250000) {
			if (j%i == 0)f[j] = 1;
		}
	}
	int cnt = 0;
	while (1) {
		int Q;
		cin >> Q;
		if (Q == 0)return 0;
		int cnt1 = 0, cnt2 = 0;
		reps(i,2, Q * 2+1) {
			if (f[i] == 0) {
				if (i <= Q)cnt1++;
				cnt2++;
			}
		}
		cout << cnt2 - cnt1 << endl:;
	}
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:33:44: error: expected ';' before ':' token
   33 |                 cout << cnt2 - cnt1 << endl:;
      |                                            ^
      |                                            ;
Language: C++

clude <iostream>
using namespace std;

int main(){
	int n,c,f;
	while(1){
		c=0;
		cin>>n;
		if(n==0) break;
		for(int i=n+1;i<=2*n;i++){
			f=1;
			for(int j=2;j<sqrt(i);j++){
				if(i%j==0){
					f=0;
					break;
				}
			}
			if(f==1) c++;
		}
		cout<<c<<endl;
	}
	return 0;
}


Compiler output:
a.cc:1:1: error: 'clude' does not name a type
    1 | clude <iostream>
      | ^~~~~
a.cc: In function 'int main()':
a.cc:8:17: error: 'cin' was not declared in this scope
    8 |                 cin>>n;
      |                 ^~~
a.cc:12:39: error: 'sqrt' was not declared in this scope
   12 |                         for(int j=2;j<sqrt(i);j++){
      |                                       ^~~~
a.cc:20:17: error: 'cout' was not declared in this scope
   20 |                 cout<<c<<endl;
      |                 ^~~~
a.cc:20:26: error: 'endl' was not declared in this scope
   20 |                 cout<<c<<endl;
      |                          ^~~~
Language: C++

#include <iostream>
using namespace std;

int main(){
	int n,c,f;
	while(1){
		c=0;
		cin>>n;
		if(n==0) break;
		for(int i=n+1;i<=2*n;i++){
			f=1;
			for(int j=2;j<sqrt(i);j++){
				if(i%j==0){
					f=0;
					break;
				}
			}
			if(f==1) c++;
		}
		cout<<c<<endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:39: error: 'sqrt' was not declared in this scope
   12 |                         for(int j=2;j<sqrt(i);j++){
      |                                       ^~~~
Language: C++

#include<stdio.h>
int p[300000];
int main(){
    int n;
    p[0]=p[1]=-1;
    for(int i=2;i<300000;i++){
        if(!p[i]){
            p[i]=1;
            for(int j=i+i;j<300000;j+=i)p[j]=-1;
        }
    }
    while(cin >> n){
        int ans=0;
        for(int i=n+1;i<=n+n;i++){
            if(p[i]==1)ans++;
        }
        cout << ans;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: 'cin' was not declared in this scope
   12 |     while(cin >> n){
      |           ^~~
a.cc:17:9: error: 'cout' was not declared in this scope
   17 |         cout << ans;
      |         ^~~~
Language: C++

#include<iostream>
using namespace std;

int p[300000];

int main(){
    int n;
    p[0]=p[1]=-1;
    for(int i=2;i<300000;i++){
        if(!p[i]){
            p[i]=1;
            for(int j=i+i;j<300000;j+=i)p[j]=-1;
        }
    }
    while(1){

        int ans=0;
        cin >> n

        if(n==0)break;

        for(int i=n+1;i<=n+n;i++){
            if(p[i]==1)ans++;
        }
        cout << ans;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: expected ';' before 'if'
   18 |         cin >> n
      |                 ^
      |                 ;
   19 | 
   20 |         if(n==0)break;
      |         ~~
Language: C++

#include<math.h>
using namespace std;

#define max 200000

int main(){
  int n;
  int count,limit;
  bool a[max];
  a[0]=a[1]=false;
  for(int i=2;i<max;i++) a[i]=true;
  limit=sqrt(max);
  /* cout<<limit<<endl;
     cout<<a[20]<<endl;*/
  for(int i=2;i<=limit;i++){
       if(a[i]==true){
           for(int k=2*i;k<max;k+=i){
	   a[k]=false;
           }
       }
   }
  /*cout<<a[20]<<endl;
    cout<<"ha?"<<endl;*/
  while(1){
    count=0;
    cin>>n;
    if(n==0) break;
    for(int i=n+1;i<2*n;i++){
      if(a[i]==true) count++;
    }
    if(n==1) cout<<"1"<<endl;
    else cout<<count<<endl;
  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:26:5: error: 'cin' was not declared in this scope
   26 |     cin>>n;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<math.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:31:14: error: 'cout' was not declared in this scope
   31 |     if(n==1) cout<<"1"<<endl;
      |              ^~~~
a.cc:31:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:31:25: error: 'endl' was not declared in this scope
   31 |     if(n==1) cout<<"1"<<endl;
      |                         ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<math.h>
  +++ |+#include <ostream>
    2 | using namespace std;
a.cc:32:10: error: 'cout' was not declared in this scope
   32 |     else cout<<count<<endl;
      |          ^~~~
a.cc:32:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:32:23: error: 'endl' was not declared in this scope
   32 |     else cout<<count<<endl;
      |                       ^~~~
a.cc:32:23: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

#include<iostream.h>
int p[1<<18];
main(i,j,n){p[0]=p[1]=1;for(i=0;i<1<<18;i++)if(!p[i]){for(j=i*2;j<1<<18;j+=i)p[j]=1;}while(cin>>n,n){j=0;for(i=n;++i<=2*n;)if(!p[i])j++;cout<<j<<endl;}return 0;}

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

#include<iostream>
int p[1<<18];
main(i,j,n){p[0]=p[1]=1;for(i=0;i<1<<18;i++)if(!p[i]){for(j=i*2;j<1<<18;j+=i)p[j]=1;}while(std::cin>>n,n){j=0;for(i=n;++i<=2*n;)if(!p[i])j++;std::cout<<j<<std::endl;}return 0;}

Compiler output:
a.cc:3:5: error: expected constructor, destructor, or type conversion before '(' token
    3 | main(i,j,n){p[0]=p[1]=1;for(i=0;i<1<<18;i++)if(!p[i]){for(j=i*2;j<1<<18;j+=i)p[j]=1;}while(std::cin>>n,n){j=0;for(i=n;++i<=2*n;)if(!p[i])j++;std::cout<<j<<std::endl;}return 0;}
      |     ^
Language: C++

#include<iostream>
int p[1<<18];
int main(i,j,n){p[0]=p[1]=1;for(i=0;i<1<<18;i++)if(!p[i]){for(j=i*2;j<1<<18;j+=i)p[j]=1;}while(std::cin>>n,n){j=0;for(i=n;++i<=2*n;)if(!p[i])j++;std::cout<<j<<std::endl;}return 0;}

Compiler output:
a.cc:3:5: error: cannot declare '::main' to be a global variable
    3 | int main(i,j,n){p[0]=p[1]=1;for(i=0;i<1<<18;i++)if(!p[i]){for(j=i*2;j<1<<18;j+=i)p[j]=1;}while(std::cin>>n,n){j=0;for(i=n;++i<=2*n;)if(!p[i])j++;std::cout<<j<<std::endl;}return 0;}
      |     ^~~~
a.cc:3:10: error: 'i' was not declared in this scope
    3 | int main(i,j,n){p[0]=p[1]=1;for(i=0;i<1<<18;i++)if(!p[i]){for(j=i*2;j<1<<18;j+=i)p[j]=1;}while(std::cin>>n,n){j=0;for(i=n;++i<=2*n;)if(!p[i])j++;std::cout<<j<<std::endl;}return 0;}
      |          ^
a.cc:3:12: error: 'j' was not declared in this scope
    3 | int main(i,j,n){p[0]=p[1]=1;for(i=0;i<1<<18;i++)if(!p[i]){for(j=i*2;j<1<<18;j+=i)p[j]=1;}while(std::cin>>n,n){j=0;for(i=n;++i<=2*n;)if(!p[i])j++;std::cout<<j<<std::endl;}return 0;}
      |            ^
a.cc:3:14: error: 'n' was not declared in this scope
    3 | int main(i,j,n){p[0]=p[1]=1;for(i=0;i<1<<18;i++)if(!p[i]){for(j=i*2;j<1<<18;j+=i)p[j]=1;}while(std::cin>>n,n){j=0;for(i=n;++i<=2*n;)if(!p[i])j++;std::cout<<j<<std::endl;}return 0;}
      |              ^
a.cc:3:15: error: expression list treated as compound expression in initializer [-fpermissive]
    3 | int main(i,j,n){p[0]=p[1]=1;for(i=0;i<1<<18;i++)if(!p[i]){for(j=i*2;j<1<<18;j+=i)p[j]=1;}while(std::cin>>n,n){j=0;for(i=n;++i<=2*n;)if(!p[i])j++;std::cout<<j<<std::endl;}return 0;}
      |               ^
Language: C++

#include <iostream>

using namespace std;
bool IsPrime[250000];
int PrimeCount[250000];
void calc()
{
	memset(IsPrime, 1, sizeof(bool) * 250000);
	int count = 0;
	PrimeCount[0] = count;
	PrimeCount[1] = count;
	for(int i = 2; i < 250000; ++i)
	{
		if(IsPrime[i])
		{
			count++;
			for(int j = 2 * i; j < 250000; j += i)
			{
				IsPrime[j] = false;
			}
		}
		PrimeCount[i] = count;
	}
}

void solve()
{
	calc();
	int n;
	while(cin >> n, n)
	{
		cout << PrimeCount[2 * n] - PrimeCount[n] << endl;
	}
}

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

Compiler output:
a.cc: In function 'void calc()':
a.cc:8:9: error: 'memset' was not declared in this scope
    8 |         memset(IsPrime, 1, sizeof(bool) * 250000);
      |         ^~~~~~
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 |
Language: C++

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

//nツづ債甘慊づ慊づ按つ「ツづヲツ！
vector<int> sieve_of_eratosthenes(int n) {
  vector<int> primes(n);
  for (int i = 2; i < n; ++i)
    primes[i] = i;
  for (int i = 2; i*i < n; ++i)
    if (primes[i])
      for (int j = i*i; j < n; j+=i)
        primes[j] = 0;
  return primes;
}

int main()
{
	int n;
	vector<int> V=sieve_of_eratosthenes(123457*2);
	while(cin>>n,n){
		int count=0;
		for(int i=n+1;i<=n*2;i++)
			if(V[i]!=0) count++;
		cout<<count<<endl;
	}
	return 0;
}



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

//nツづ債甘慊づ慊づ按つ「ツづヲツ！
vector<int> sieve_of_eratosthenes(int n) {
  vector<int> primes(n);
  for (int i = 2; i < n; ++i)
    primes[i] = i;
  for (int i = 2; i*i < n; ++i)
    if (primes[i])
      for (int j = i*i; j < n; j+=i)
        primes[j] = 0;
  return primes;
}

int main()
{
	int n;
	vector<int> V=sieve_of_eratosthenes(123457*2);
	while(cin>>n,n){
		int count=0,i=n;
		while(V[i]<=n*2){
			if(V[i]!=0)
				count++;
			i++;
		}
		cout<<count<<endl;
	}
	return 0;
}

Compiler output:
a.cc:39:13: error: redefinition of 'std::vector<int> sieve_of_eratosthenes(int)'
   39 | vector<int> sieve_of_eratosthenes(int n) {
      |             ^~~~~~~~~~~~~~~~~~~~~
a.cc:7:13: note: 'std::vector<int> sieve_of_eratosthenes(int)' previously defined here
    7 | vector<int> sieve_of_eratosthenes(int n) {
      |             ^~~~~~~~~~~~~~~~~~~~~
a.cc:50:5: error: redefinition of 'int main()'
   50 | int main()
      |     ^~~~
a.cc:18:5: note: 'int main()' previously defined here
   18 | int main()
      |     ^~~~
Language: C++

s,j,n;main(i){for(;scanf("%d",&n),n,s=n;printf("%d\n",s))for(i=n;++i<=n*2;)for(j=2;j*j<=i;)if(!(i%j++)&&s--)break;return 0;}

Compiler output:
a.cc:1:1: error: 's' does not name a type
    1 | s,j,n;main(i){for(;scanf("%d",&n),n,s=n;printf("%d\n",s))for(i=n;++i<=n*2;)for(j=2;j*j<=i;)if(!(i%j++)&&s--)break;return 0;}
      | ^
a.cc:1:11: error: expected constructor, destructor, or type conversion before '(' token
    1 | s,j,n;main(i){for(;scanf("%d",&n),n,s=n;printf("%d\n",s))for(i=n;++i<=n*2;)for(j=2;j*j<=i;)if(!(i%j++)&&s--)break;return 0;}
      |           ^
Language: C++

s=0,n=0;main(i,j){for(;scanf("%d",&n),n,s=n;printf("%d\n",s))for(i=n;++i<=n*2;)for(j=2;j*j<=i;)if(!(i%j++)&&s--)break;}

Compiler output:
a.cc:1:1: error: 's' does not name a type
    1 | s=0,n=0;main(i,j){for(;scanf("%d",&n),n,s=n;printf("%d\n",s))for(i=n;++i<=n*2;)for(j=2;j*j<=i;)if(!(i%j++)&&s--)break;}
      | ^
a.cc:1:13: error: expected constructor, destructor, or type conversion before '(' token
    1 | s=0,n=0;main(i,j){for(;scanf("%d",&n),n,s=n;printf("%d\n",s))for(i=n;++i<=n*2;)for(j=2;j*j<=i;)if(!(i%j++)&&s--)break;}
      |             ^
Language: C++

a['___'],c;
main(i,j)
{
  for(;++i*i<1e6;)for(j=i;j<1e6;)a[j+=i]=1;
  for(;scanf("%d",&j),i=j;c=!printf("%d\n",c))
    for(;j++<=i*2;)c+=!a[j];
}

Compiler output:
a.cc:1:3: warning: multi-character character constant [-Wmultichar]
    1 | a['___'],c;
      |   ^~~~~
a.cc:1:1: error: 'a' does not name a type
    1 | a['___'],c;
      | ^
a.cc:2:5: error: expected constructor, destructor, or type conversion before '(' token
    2 | main(i,j)
      |     ^
Language: C++

s,n;main(i,j){for(;i=s=scanf("%d",&n)*n;printf("%d\n",s))for(;++i<=n*2;)for(j=2;j*j<=i&&!(!(i%j++)&&s--););}

Compiler output:
a.cc:1:1: error: 's' does not name a type
    1 | s,n;main(i,j){for(;i=s=scanf("%d",&n)*n;printf("%d\n",s))for(;++i<=n*2;)for(j=2;j*j<=i&&!(!(i%j++)&&s--););}
      | ^
a.cc:1:9: error: expected constructor, destructor, or type conversion before '(' token
    1 | s,n;main(i,j){for(;i=s=scanf("%d",&n)*n;printf("%d\n",s))for(;++i<=n*2;)for(j=2;j*j<=i&&!(!(i%j++)&&s--););}
      |         ^
Language: C++

#define MAX (1<<18)

arr[MAX];
n;
cnt;

main(i,j) {
	memset(arr, -1, sizeof arr);
	arr[0] = arr[1] = 0;
	for(i = 2; i * i <= MAX; i++)
		if(arr[i])
			for(j = 2 * i; j <= MAX; j += i)
				arr[j] = 0;

	for(;scanf("%d",&n),n;) {
		cnt = 0;
		for(i = n + 1; i <= 2 * n; i++)
			if(arr[i])
				cnt++;
		printf("%d\n", cnt);
	}
	exit(0);
}

Compiler output:
a.cc:3:1: error: 'arr' does not name a type
    3 | arr[MAX];
      | ^~~
a.cc:4:1: error: 'n' does not name a type
    4 | n;
      | ^
a.cc:5:1: error: 'cnt' does not name a type; did you mean 'int'?
    5 | cnt;
      | ^~~
      | int
a.cc:7:5: error: expected constructor, destructor, or type conversion before '(' token
    7 | main(i,j) {
      |     ^
Language: C++

a[1<<18];
n=1<<18;
main(i,c) {
	*a=a[1]=1;
	for(i=2;i<n;i++)
		if(!a[i])
			for(c=2*i;c<n;c+=i)
				a[c]=1;
	for(;scanf("%d",&n),n;){
		c=0;
		for(i=n+1;i<=2*n;i++)
			if(a[i])
				c++;
		printf("%d\n",c);
	}
	exit(0);
}

Compiler output:
a.cc:1:1: error: 'a' does not name a type
    1 | a[1<<18];
      | ^
a.cc:2:1: error: 'n' does not name a type
    2 | n=1<<18;
      | ^
a.cc:3:5: error: expected constructor, destructor, or type conversion before '(' token
    3 | main(i,c) {
      |     ^
Language: C++

a[1<<20];
n=1<<20;
main(i,c){
	*a=a[1]=1;
	for(;++i<n;)
		if(!a[i])
			for(c=1;++c*i<n;)
				a[i*c]=1;
	for(;scanf("%d",&n),n;){
		c=0;
		for(i=n;++i<=2*n;)
			!a[i]&&c++;
		printf("%d\n",c);
	}
	exit(0);
}

Compiler output:
a.cc:1:1: error: 'a' does not name a type
    1 | a[1<<20];
      | ^
a.cc:2:1: error: 'n' does not name a type
    2 | n=1<<20;
      | ^
a.cc:3:5: error: expected constructor, destructor, or type conversion before '(' token
    3 | main(i,c){
      |     ^
Language: C++

a[1<<20];
n=1<<20;
main(i,c){
	*a=a[1]=1;
	for(;++i<n;)
		if(!a[i])
			for(c=2;c*i<n;)
				a[i*c++]=1;
	for(;scanf("%d",&n),n;printf("%d\n",c)){
		c=0;
		for(i=n;++i<=2*n;)
			a[i]||c++;
	}
	0;
}

Compiler output:
a.cc:1:1: error: 'a' does not name a type
    1 | a[1<<20];
      | ^
a.cc:2:1: error: 'n' does not name a type
    2 | n=1<<20;
      | ^
a.cc:3:5: error: expected constructor, destructor, or type conversion before '(' token
    3 | main(i,c){
      |     ^
Language: C++

#include <iostream>
using namespace std;
int main(){
	int i,j,n,p[123457*2]={0};
	char buf[120], p;
	for(i=2;i<123457;i++) if(!p[i]) for(j=i*2;j<123457*2;j+=i) p[j]=1;
	for(i=2;i<123457*2;i++) p[i]=p[i-1]+!p[i];
	while(cin>>n,n) cout << p[2*n+1] - p[n] << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:24: error: conflicting declaration 'char p'
    5 |         char buf[120], p;
      |                        ^
a.cc:4:19: note: previous declaration as 'int p [246914]'
    4 |         int i,j,n,p[123457*2]={0};
      |                   ^
Language: C++

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

#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for(int i = m; i < (n); ++i)
#define pb push_back
#define ALL(c) (c).begin(), (c).end()

typedef vector<int> vi;

bool prime[300000];

int main()
{
    int n;
    fill_n(prime, 300000, true);
    prime[0] = prime[1] = false;
    rep2(i, 2, 300000) if(prime[i])
        for(int j = i*2; j < 300000; j+=i)
            prime[j] = false;
    vi p;
    rep(i, 300000) if(prime[i]) p.pb(i);
    while(cin >> n && n)
        cout << upper_bound(ALL(p), 2*n) - upper_bound(ALL(p), n) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:17: error: 'upper_bound' was not declared in this scope
   25 |         cout << upper_bound(ALL(p), 2*n) - upper_bound(ALL(p), n) << endl;
      |                 ^~~~~~~~~~~