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

 #include <stdio.h>
   

   int main(void){
     char check=1;
     int i,j,k,m,n;
     int num[150000];
     num[0] = 2;
      k=0;
       for(i=3;i<=1000000;i=i+2){
          for( j=0; j<=k; j++){  
           if(i%num[j] == 0){
               check =0; break;
           }
           if(!check )
              break;
              }
           if(check){
            k++;
           num[k]=i;
          }else{
            check =1;
}
}
　　  while( scanf("%d",&n) != EOF){
             for(m=0; m<=k; m++){
                 if( num[m]<=n)
                      break;
                 }
                 printf("%d\n",m+1);
             }
       return 0;
}  
      

Compiler output:
main.c: In function 'main':
main.c:25:1: error: stray '\343' in program
   25 | <U+3000><U+3000>  while( scanf("%d",&n) != EOF){
      | ^~~~~~~~
main.c:25:3: error: stray '\343' in program
   25 | <U+3000><U+3000>  while( scanf("%d",&n) != EOF){
      |         ^~~~~~~~
Language: C

#include <stdio.h>

int main(void){
  int n;
  int prime[270000];
  prime[0]=2;
  int i,j,k=1,num,check;
     for( i=3; i<1000000;i=i+2){
            check =1;
           for(j=0;j<k; j++){
              if(a%prime[j] == 0 ){
                  check =0; break;
                }
            if(check){
                  prime[k] =i; k++;
             }
       }
    while( scanf("%d",&n) != EOF){
         for(i=0; i<=k; i++){
            if( prime[i] < n){
              printf("%d",i+1);
}
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:18: error: 'a' undeclared (first use in this function)
   11 |               if(a%prime[j] == 0 ){
      |                  ^
main.c:11:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:24:1: error: expected declaration or statement at end of input
   24 | }
      | ^
main.c:24:1: error: expected declaration or statement at end of input
main.c:24:1: error: expected declaration or statement at end of input
Language: C

#include <stdio.h>

int main(void){
  int n;
  int prime[270000];
  prime[0]=2;
  int i,j,k=1,num,check;
     for( i=3; i<1000000;i=i+2){
            check =1;
           for(j=0;j<k; j++){
              if(i%prime[j] == 0 ){
                  check =0; break;
                }
            if(check){
                  prime[k] =i; k++;
             }
       }
    while( scanf("%d",&n) != EOF){
         for(i=0; i<=k; i++){
            if( prime[i] < n)
              printf("%d",i+1);
         }
      }
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:25:1: error: expected declaration or statement at end of input
   25 | }
      | ^
Language: C

#include <stdio.h>

int prime_check(int a){
	int prime[270000];
        prime[0]=2;
        prime[1]=3;
	int i,j,k=0;
	int check;
	if( a ==1)
		return 0;
	for(i=1;<=166667;i++){
		check =1;
		for(j=0;j<=k;j++){
		if((6*i+1)% prime[j] == 0)
		       check =0;
		}
        if(check){
		k++; prime[k]=i;
		}
                check =1;
		for(j=0;j<=k;j++){
		if((6*i+5)% prime[j] == 0)
		       check =0;
		}
        if(check){
		k++; prime[k]=i;
		}
	}
	for(j=0;j<=k;j++)
       {
	if(a<prime[j] )
	return j;
	}
}

int main(void){
	int  N,prime;
	while(scanf("%d",&N)  != EOF)
     {
	printf("%d\n",prime_check(N));
      }
	return  0;
}

Compiler output:
main.c: In function 'prime_check':
main.c:11:17: error: expected expression before '<=' token
   11 |         for(i=1;<=166667;i++){
      |                 ^~
Language: C

#include <stdio.h>

int check(unsigned long num)
{
	unsigned long i;

	if(num == 1){ return 0; }
	if(num == 2){ return 1; }
	if(num == 3){ return 1; }
	if(num == 4){ return 0; }

	for(i=2; i<(num/2); i++){
		if((num%i) == 0){
			return 0;
		}
	}
	return 1;
}


int main()
{
	unsigned long n, i, j, buf, cnt;
	bool flag=1;

	while(flag == 1){
		cnt = 0;
		//printf("Please input any number :");
		scanf("%lu", &n);
		getchar();

		if(n == 0){
			//printf("result :0\n");
			printf("0\n");
		}else{
			for(i=1; i<=n; i++){
				cnt += check(i);
				//printf("%10lu: %lu\n", i, cnt);
			}
		}

		//printf("result :%lu\n\n", cnt);
		printf("%lu\n", cnt);
	}
}

Compiler output:
main.c: In function 'main':
main.c:24:9: error: unknown type name 'bool'
   24 |         bool flag=1;
      |         ^~~~
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 |
Language: C

#include<iostream>
using namespace std;

int F(int n)
{
	int result=0;
	if (n==1  || n==0) result=0;
	else
	{
		for(int i=2;i<=n;i++)
		{
			int flag=0;
			for(int j=2;j<i;j++)
			{
				if(i%j==0)
					flag=1;
			}
			if(flag==0)
				result++;
		}
	}
	return result;
}

int main()
{
	int number=0;
	while(1)
	{
		scanf("%d",&number);
		printf("%d\n",F(number));
	}
	return 0;
}

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

#include<conio.h>
#include<stdio.h>


int F(int n)
{
	int result=0;
	if (n==1  || n==0) result=0;
	else
	{
		for(int i=2;i<=n;i++)
		{
			int flag=0;
			for(int j=2;j<i;j++)
			{
				if(i%j==0)
					flag=1;
			}
			if(flag==0)
				result++;
		}
	}
	return result;
}

int main()
{
	int number=0;
	while(1)
	{
		scanf("%d",&number);
		printf("%d\n",F(number));
	}
	return 0;
}

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

#include<stdio.h>
#include<math.h>

#define max 1000000

int main()
{
	int a;
	int x,y,z;
	int r[max];
	for(x=3;x<=max;x+=2){
			r[x]=1;
	}
	while((scanf("%d",&a))!=EOF){
		
		if(a==1){
			printf("%d",1);
		continue;
		}
		y=sqrt((double)a);

		for(z=3;z<=y;z+=2)
			if(r[x]==1){
			for(x=3;x<=a/z;x+=2){
					r[x*z]=0;
			}
			}
			for(x=3;x<=a;x+=2){
			if(r[x]==1)
				t++;
			}
			printf("%d\n",t);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:30:33: error: 't' undeclared (first use in this function)
   30 |                                 t++;
      |                                 ^
main.c:30:33: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#define N 100000
#define rep(i,n) for(int i=0;i<n;i++)

int main(void)
{
    bool a[N+1];
    int prime[N], n;
    rep(i,N)
    {
        a[i] = true;
    }
    a[0] = a[1] = false;
    for(int i=2;i*i<=N;i++)
    {
        if(a[i])
        {
            prime[i] = prime[i-1] + 1;
            for(int j=i*i;j<N;j+=i)
                a[j] = false;
        }
        else
            prime[i] = prime[i-1];
    }

    while(scanf("%d", &n)!=EOF)
        printf("%d\n", prime[n]);
    
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:5: error: unknown type name 'bool'
    7 |     bool a[N+1];
      |     ^~~~
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 | #define N 100000
main.c:11:16: error: 'true' undeclared (first use in this function)
   11 |         a[i] = true;
      |                ^~~~
main.c:11:16: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:11:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:19: error: 'false' undeclared (first use in this function)
   13 |     a[0] = a[1] = false;
      |                   ^~~~~
main.c:13:19: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
Language: C

#include <stdio.h>
int main(void) {
  int a;
  while(scanf("%d", &a) != EOF) {
    printf("%d\n", prime(a));
  }
}
int prime(int n) {
  int i, j, count = 0;
  for(i = 2;i <= n;i++) {
    for(j = 2;j*j <= i;j++) {
      if(i%j == 0)
	break;
    }
    if(j*j > i)
      count++;
  }
  return count;
}
return count;
}

Compiler output:
main.c: In function 'main':
main.c:5:20: error: implicit declaration of function 'prime' [-Wimplicit-function-declaration]
    5 |     printf("%d\n", prime(a));
      |                    ^~~~~
main.c: At top level:
main.c:20:1: error: expected identifier or '(' before 'return'
   20 | return count;
      | ^~~~~~
main.c:21:1: error: expected identifier or '(' before '}' token
   21 | }
      | ^
Language: C

#include <stdio.h>

int main(){
int n,i,j,a,f;
int a[1000000];
for(i=2;i<1000000;i++){
a[i]=1;
}
for(i=2;i<1000000;i++){
for(j=2;j<i;j++){
a=i%j;
if(a==0){
a[i]=0;
break;
}
}
}
a[2]=1;
while(scanf("%d",&n) != EOF){
f=0;
for(i=2;i<=n;i++){
f+=a[i];
}
printf("%d\n",f)

}
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:5: error: conflicting types for 'a'; have 'int[1000000]'
    5 | int a[1000000];
      |     ^
main.c:4:11: note: previous declaration of 'a' with type 'int'
    4 | int n,i,j,a,f;
      |           ^
main.c:24:17: error: expected ';' before '}' token
   24 | printf("%d\n",f)
      |                 ^
      |                 ;
   25 | 
   26 | }
      | ~
Language: C

#include<stdio.h>
#include<cmath>
#include<iostream>
using namespace std;
int a[1000010];
int main()
{
	int fun(int n);
	int n,i,j,k,m;
	while(scanf("%d",&n)!=EOF)
	{
		memset(a,0,sizeof(a));
		m=fun(n);
		printf("%d\n",m);
	}
	return 0;
}
int fun(int m)
{
	int i,j,k=0,q;
	for(i=2;i<=m;i++)
	{
		for(j=2;i*j<=m;j++)
		{
			if(a[i*j]==0)
			{
				a[i*j]=-1;
			}
		}
	}
	for(i=2;i<=m;i++)
		if(a[i]==0)k++;
	return k;
}

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

#include <stdio.h>
#include <math.h>

int judgeprime(long num){
  int primeflag=1,i;

  if(num%2==0){primeflag=0;}
  else for(i=3;i<sqrt(num);i+=2){

    if( num%i==0 ){
      primeflag=0;
      break;
    }

  }

  if(num==0||num==1||num==4){primeflag=0;}
  else if(num==2){primeflag=1;}

  return primeflag;

}

int main(void){
  long i,num;
  int much;

  while( scanf("%ld",&num) != -1 ){

    much=0;

    for(i=1;i<=num;i++){
      much+=judgeprime(i);
    }

    printf("%d\n",much);

  }

  return 0;  
}
04:57:02 ~/programming/AOJ 
$

Compiler output:
main.c:42:1: error: expected identifier or '(' before numeric constant
   42 | 04:57:02 ~/programming/AOJ
      | ^~
Language: C

#include <stdio.h>
#include <math.h>
int
main (void)
{
  int n;
  int *list;
  while (scanf ("%d", &n) != EOF)
    {
      list = (int *) calloc (sizeof (int), n + 1);
      list[0] = list[1] = 0;
      for (int i = 2; i <= sqrt (n); i++)
	{
	  if (list[i] == 0)
	    {
	      for (int j = i + 1; j <= n; j++)
		if (j % i == 0)
		  list[j] = -1;
	    }
	  else
	    continue;
	}
      for (int i = 2; i <= n; i++)
	if (list[i] == 0)
	  list[0]++;
      printf ("%d\n", list[0]);
      free (list);
    }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:22: error: implicit declaration of function 'calloc' [-Wimplicit-function-declaration]
   10 |       list = (int *) calloc (sizeof (int), n + 1);
      |                      ^~~~~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'calloc'
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | int
main.c:10:22: warning: incompatible implicit declaration of built-in function 'calloc' [-Wbuiltin-declaration-mismatch]
   10 |       list = (int *) calloc (sizeof (int), n + 1);
      |                      ^~~~~~
main.c:10:22: note: include '<stdlib.h>' or provide a declaration of 'calloc'
main.c:27:7: error: implicit declaration of function 'free' [-Wimplicit-function-declaration]
   27 |       free (list);
      |       ^~~~
main.c:27:7: note: include '<stdlib.h>' or provide a declaration of 'free'
main.c:27:7: warning: incompatible implicit declaration of built-in function 'free' [-Wbuiltin-declaration-mismatch]
main.c:27:7: note: include '<stdlib.h>' or provide a declaration of 'free'
Language: C

#include<stdio.h>
#define N 1000000
int main(void)
{
	int ans,n,i;
	int a,m,TBL[N];
	float AM=10; // forの条件式をスルーするために10代入
	for(a=3;a<N;a+=2) TBL[a]=0;
	for(a=3;a<N;a+=2){
		if(TBL[a]==0){
			TBL[a]==1;
			for(m=2;AM<N;m++){
				AM=a*m;
				TBL[AM]=-1;
			}
		}
	}
	while(scanf("%d",&n)!=EOF){
		ans=1;
		for(i=3;i<=n;i+=2){
			if(TBL[i]==1) ans++;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:14:36: error: array subscript is not an integer
   14 |                                 TBL[AM]=-1;
      |                                    ^
Language: C

#include <stdio.h>

#define NPRIMES  1000
#define FALSE 0
#define TRUE  1


int main(void) {
  int n;
  int i,j;
  int flag;
  int primes[NPRIMES]; 
  int level;          


  printf("Enter value of N > ");
  scanf("%d",&n);
  level = 0;

  for(i=2;i<=n;i++) {
    for(j = 0, flag = TRUE; j<level && flag; j++)
      flag = (i%primes[j]);
    if (flag) 
      printf("%12d\n", i);
      if (level < NPRIMES)
	primes[level++] = i;
    }
  }
}

Compiler output:
main.c:29:1: error: expected identifier or '(' before '}' token
   29 | }
      | ^
Language: C

#include<iostream>
using namespace std;
#define N 200000
int main()
{
    int a[N]={0},n,i,j,z;
    for(i=2;i<=N/2;i++){
	if(a[i]==0){
	    for(j=2;j*i<=N;j++){
		a[i*j]=1;	     
    	    }
	}
    }
    while((cin>>n)!=0){
    	z=0;
	for(i=2;i<=n;i++){
    	    if(a[i]==0)z++;
	}
	cout<<z<<endl;
    }
    return 0;	
}

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

int main(void){

    int i,j,sq_n,count;
    double n;

    while(scanf("%lf",&n)!=EOF){
        count=0;
        sq_n=sqrt(n);
        for(i=0;i<n;i++)
            prime[i]=1;
        prime[0]=0;

        for(i=1;i<sq_n;i++){
            if(prime[i]==1){
                for(j=(i+1);(i+1)*j<=n;j++) {
                    prime[(i+1)*j-1]=0;
                }
            }
        }
        for(i=0;i<n;i++){
            if(prime[i]==1){
                count++;
            }
        }
        printf("%d\n",count);
    }


    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:11: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    6 |     while(scanf("%lf",&n)!=EOF){
      |           ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int main(void){
main.c:6:11: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    6 |     while(scanf("%lf",&n)!=EOF){
      |           ^~~~~
main.c:6:11: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:6:28: error: 'EOF' undeclared (first use in this function)
    6 |     while(scanf("%lf",&n)!=EOF){
      |                            ^~~
main.c:6:28: note: 'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
main.c:6:28: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:14: error: implicit declaration of function 'sqrt' [-Wimplicit-function-declaration]
    8 |         sq_n=sqrt(n);
      |              ^~~~
main.c:1:1: note: include '<math.h>' or provide a declaration of 'sqrt'
  +++ |+#include <math.h>
    1 | int main(void){
main.c:8:14: warning: incompatible implicit declaration of built-in function 'sqrt' [-Wbuiltin-declaration-mismatch]
    8 |         sq_n=sqrt(n);
      |              ^~~~
main.c:8:14: note: include '<math.h>' or provide a declaration of 'sqrt'
main.c:10:13: error: 'prime' undeclared (first use in this function)
   10 |             prime[i]=1;
      |             ^~~~~
main.c:25:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   25 |         printf("%d\n",count);
      |         ^~~~~~
main.c:25:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:25:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:25:9: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include "sort.h"
int main()
{
    int n;
    int result;
    while(scanf("%d",&n)!=EOF)
    {
        if(n <= 1)
            printf("Error input!");
        else if(n == 2)
        {
            result = 1;
        }
            else if(n == 3)
            {
                result = 2;
            }
            else
            {
                result = n - function(n) - 1;
            }

           printf("%d\n",result);
        }

	return 0;
}

int function(n)
{
    int i,j;
    int count = 0;
    for(i=2;i<=n;i++)
    {
        for(j=2;j<=(int)sqrt(i);j++)
        {
            if(i%j == 0)
            {
                count++;
                break;
            }

        }
    }
    return count;
}

Compiler output:
main.c:1:10: fatal error: sort.h: No such file or directory
    1 | #include "sort.h"
      |          ^~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
int main(void)
{
  int a,j,i;

  while(scanf("%d",&a)!=EOF){
    int b=0,count=0;

    for(j=2;j<=a;j++){
      for(i=2;i<a;i++){
        if(a%i=0)
          b=1;
      }
      if(b==0)
        count+=1;
    }
    printf("%d\n",count);
  }

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:15: error: lvalue required as left operand of assignment
   11 |         if(a%i=0)
      |               ^
Language: C

#include <stdio.h>

int main(){
	int sosuu[100000] = { 2, 3, 5 }, i, x, y = 3,n,z;
	
	while (scanf("%d", &n)  ! = EOF){
		z = 0; 
		for (i = 3; i < n + 1; i += 2){
			for (x = 0; x < y; x++){
				if (i % sosuu[x] == 0){ break; }
				if (x + 1 == y){ sosuu[y] = i, y++;}
			}
		}
		for (i = 0; i < y; i++){ if (sosuu[i] > n)break; z++; }
		printf("%d\n", z);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:31: error: expected ')' before '!' token
    6 |         while (scanf("%d", &n)  ! = EOF){
      |               ~               ^ ~
      |                               )
Language: C

#include <stdio.h>

int main(void){
int n;
while(true){
scanf("%d",n);
if(n==EOF){
break;
}
int m;
bool check=true;
for(m=2;m<n-1;m++){
if(n%m==0){
check=false;
break;
}
}
if(check==true){
printf("%d",n);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:7: error: 'true' undeclared (first use in this function)
    5 | while(true){
      |       ^~~~
main.c:2:1: note: 'true' 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:5:7: note: each undeclared identifier is reported only once for each function it appears in
    5 | while(true){
      |       ^~~~
main.c:11:1: error: unknown type name 'bool'
   11 | bool check=true;
      | ^~~~
main.c:11:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:14:7: error: 'false' undeclared (first use in this function)
   14 | check=false;
      |       ^~~~~
main.c:14:7: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:21:1: error: expected declaration or statement at end of input
   21 | }
      | ^
main.c:21:1: error: expected declaration or statement at end of input
Language: C

#include <stdio.h>

int main(void){
int n;
while(true){
scanf("%d",n);
if(n==EOF){
break;
}
int m;
boolean check=true;
for(m=2;m<n-1;m++){
if(n%m==0){
check=false;
break;
}
}
if(check==true){
printf("%d",n);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:7: error: 'true' undeclared (first use in this function)
    5 | while(true){
      |       ^~~~
main.c:2:1: note: 'true' 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:5:7: note: each undeclared identifier is reported only once for each function it appears in
    5 | while(true){
      |       ^~~~
main.c:11:1: error: unknown type name 'boolean'
   11 | boolean check=true;
      | ^~~~~~~
main.c:14:7: error: 'false' undeclared (first use in this function)
   14 | check=false;
      |       ^~~~~
main.c:14:7: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:21:1: error: expected declaration or statement at end of input
   21 | }
      | ^
main.c:21:1: error: expected declaration or statement at end of input
Language: C

#include <stdio.h>

int main(void){
int n;
while(true){
scanf("%d",n);
if(n==EOF){
break;
}
int m;
bool check=true;
for(m=2;m<n-1;m++){
if(n%m==0){
check=false;
break;
}
}
if(check==true){
printf("%d",n);
}
}
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:7: error: 'true' undeclared (first use in this function)
    5 | while(true){
      |       ^~~~
main.c:2:1: note: 'true' 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:5:7: note: each undeclared identifier is reported only once for each function it appears in
    5 | while(true){
      |       ^~~~
main.c:11:1: error: unknown type name 'bool'
   11 | bool check=true;
      | ^~~~
main.c:11:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:14:7: error: 'false' undeclared (first use in this function)
   14 | check=false;
      |       ^~~~~
main.c:14:7: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
Language: C

#include <stdio.h>

int main(void){
int n;
while(true){
scanf("%d",n);
if(n==EOF){
break;
}
int m;
int check=1;
for(m=2;m<n-1;m++){
if(n%m==0){
check=0;
break;
}
}
if(check==1){
printf("%d",n);
}
}
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:7: error: 'true' undeclared (first use in this function)
    5 | while(true){
      |       ^~~~
main.c:2:1: note: 'true' 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:5:7: note: each undeclared identifier is reported only once for each function it appears in
    5 | while(true){
      |       ^~~~
Language: C

#include <stdio.h>

int main(void){
int n;
while(true){
scanf("%d",n);
if(n==-1){
break;
}
int m;
int check=1;
for(m=2;m<n-1;m++){
if(n%m==0){
check=0;
break;
}
}
if(check==1){
printf("%d",n);
}
}
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:7: error: 'true' undeclared (first use in this function)
    5 | while(true){
      |       ^~~~
main.c:2:1: note: 'true' 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:5:7: note: each undeclared identifier is reported only once for each function it appears in
    5 | while(true){
      |       ^~~~
Language: C++

#include<iostream>
using namespace std;
int n;
int a[1000000];
int sum[1000000];
int main(int argc, char const *argv[])
{
	for (int i = 2; i < 1000000; ++i)
	{
		if (!a[i])
		
			for (int j = i*2; j < 1000000; j+=i)
			 a[j]=1;
		}
		for (int i = 2; i <1000000 ; ++i) sum[i]=sum[i-1]+(a[i]==0?1:0);
			while (cin>>n)
				cout<<sum[n]<<endl;
				return 0;
			}
	
		
		
		
	    		
		
	}
	
	

	




Compiler output:
a.cc:26:9: error: expected declaration before '}' token
   26 |         }
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
#define maxPN 1000000
#define PNs  1000100
int countPN = 0, countPNs = 0;
long long PrimeNum[maxPN], temp;
bool PN[PNs];
 
bool IsPrimeNumber(long long x);
 
void PrimeN(){
    int i, j;
    PrimeNum[0] = 2;
    PN[2] = true;PrimeNum[countPN++] = 2;
    PN[3] = true;PrimeNum[countPN++] = 3;
//  PN[5] = true;PrimeNum[countPN++] = 5;
     
    for(i = 6; i  < PNs;i+=6){
        if(IsPrimeNumber(i-1)){
            PrimeNum[countPN++] = i-1;
            PN[i-1] = true;//cout<<i-1<<endl;
        }
        if(IsPrimeNumber(i+1)){
            PrimeNum[countPN++] = i+1;
            PN[i+1] = true;//cout<<i+1<<endl;
        }
        countPNs = i+1;//cout<<i-1<<" "<<PN[i-1]<<endl;
    }
}
 
bool IsPrimeNumber(long long x){
    //if(x == 2 || x == 3) return true;
    //if(x <= 4 || x%2 == 0 || x%3 == 0)   return false;
    //if(x < countPNs) return PN[x];
    for(long long i = 0; PrimeNum[i] * PrimeNum[i] <= x; i++)
        if(x%PrimeNum[i] == 0)return false;
    return true;
}
 
 
int main(){
    clock_t start, end;
    long long n = true, counta;
    start = clock();
    PrimeN();
//  cout<<PrimeNum[countPN-1]<<" "<<countPNs<<endl;
//  cout<<clock()-start<<"ms"<<endl;
     
    while(cin>>n){
        counta = 1;
         
         
        //cout<<(IsPrimeNumber(n)?"yes":"no")<<endl;
        start = clock();
        //cout<<IsPrimeNumber(n)<<endl;
        for(int i = 1; i <= n; i+=2){
            if(PN[i])counta++;
        //  cout<<i<<" "<<PN[i]<<endl;
        }
        if(n == 1) counta = 0;
        cout<<counta<<endl;
    //  cout<<clock()-start<<"ms"<<endl;
    }
    return 0;


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

import math
import sys

def prime_calc(n):
    rootN = math.floor(math.sqrt(n))
    prime = [2]
    data = [i + 1 for i in range(2,n,2)]
    while True:
        p = data[0]
        if rootN < p:
            return len(prime + data)
        prime.append(p)
        data = [e for e in data if e % p != 0]

def main():
    l = []

    for line in sys.stdin:
        l.append(line)        

    for line in l:
        print(prime_calc(line))

if __name__ == "__main__":
    main()


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import math
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

import math
import sys

def prime_calc(n):
    rootN = int(n**0.5)
    prime = [2]
    data = [i + 1 for i in range(2,n,2)]
    while True:
        p = data[0]
        if rootN <= p:
            return len(prime + data)
        prime.append(p)
        data = [e for e in data if e % p != 0]

def main():
    l = []

    for line in sys.stdin:
        l.append(line)        

    for line in l:
        print(prime_calc(line))

if __name__ == "__main__":
    main()


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import math
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

import math
import sys

def prime_calc(n):
    rootN = math.floor(math.sqrt(n))
    prime = [2]
    data = [i + 1 for i in range(2,n,2)]
    while True:
        p = data[0]
        if rootN <= p:
            return len(prime + data)

        prime.append(p)
        data = [e for e in data if e % p != 0]

def main():
    l = []

    for line in sys.stdin:
        l.append(line)        

    for line in l:
        print(prime_calc(line))

if __name__ == "__main__":
    main()


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import math
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<stdio.h>
int prime[1000000];
int main(){
    prime[0]=-1;
    prime[1]=-1;
    for(int i=2;i<1000000;i++){
        if(prime[i]==0){
            prime[i]=1;
            for(int j=i*2;j<1000000;j+=i)prime[j]=-1;
        }
    }
    int now;
    while(~scanf("%d",&now)){
        int ans=0;
        for(int i=1;i<now+1;i++)if(prime[i]==1)ans++;
        printf("%d\n",ans);
    }


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

#include <stdio.h>
#include <math.h>

int primes[78498], num_primes = 1;
int calculated = 2;
int count_pos(int n) {
	for (int i = 0; i < num_primes; i++) {
		if (primes[i] == n) {
			return i + 1;
		}
		else if (primes[i] > n) {
			return i;
		}
	}
	return num_primes;
}
int main() {
	primes[0] = 2;
	while (true) {
		int n;
		if (!scanf_s("%d", &n)) break;
		if (calculated+1 < n) {
			for (int i = calculated + 1; i < n + 1; i += 2) {
				bool is_prime = true;
				for (int w = 3; w < (int)(sqrt(i)) + 1; w += 2) {
					if (i%w == 0) {
						is_prime = false;
						break;
					}
				}
				if (is_prime) {
					primes[num_primes++] = i;
				}
			}
			calculated = n - (n % 2);
		}
		printf("%d\n", count_pos(n));
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:22: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   21 |                 if (!scanf_s("%d", &n)) break;
      |                      ^~~~~~~
      |                      scanf
Language: C++

int primes[78498], num_primes;
int calculated;
int count_pos(int n) {
	for (int i = 0; i < num_primes; i++) {
		if (primes[i] == n) {
			return i + 1;
		}
		else if (primes[i] > n) {
			return i;
		}
	}
	return num_primes;
}
int main() {
	primes[0] = 2;
	calculated = 2;
	num_primes = 1;
	while (true) {
		int n;
		if (!scanf_s("%d", &n)) break;
		if (calculated+1 < n) {
			for (int i = calculated + 1; i < n + 1; i += 2) {
				bool is_prime = true;
				int max = (int)(sqrt(i)) + 1;
				for (int j=1; primes[j] < max&&j<num_primes; j++) {
					if (i%primes[j] == 0) {
						is_prime = false;
						break;
					}
				}
				if (is_prime) {
					primes[num_primes++] = i;
				}
			}
			calculated = n - (n % 2);
		}
		printf("%d\n", count_pos(n));
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: 'scanf_s' was not declared in this scope
   20 |                 if (!scanf_s("%d", &n)) break;
      |                      ^~~~~~~
a.cc:24:49: error: 'sqrt' was not declared in this scope
   24 |                                 int max = (int)(sqrt(i)) + 1;
      |                                                 ^~~~
a.cc:37:17: error: 'printf' was not declared in this scope
   37 |                 printf("%d\n", count_pos(n));
      |                 ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int primes[78498], num_primes;
Language: C++

int primes[78498], num_primes;
int calculated;
int count_pos(int n) {
	for (int i = 0; i < num_primes; i++) {
		if (primes[i] == n) {
			return i + 1;
		}
		else if (primes[i] > n) {
			return i;
		}
	}
	return num_primes;
}
int main() {
	primes[0] = 2;
	calculated = 2;
	num_primes = 1;
	while (true) {
		int n;
		if (!scanf("%d", &n)) break;
		if (calculated+1 < n) {
			for (int i = calculated + 1; i < n + 1; i += 2) {
				bool is_prime = true;
				int max = (int)(sqrt(i)) + 1;
				for (int j=1; primes[j] < max&&j<num_primes; j++) {
					if (i%primes[j] == 0) {
						is_prime = false;
						break;
					}
				}
				if (is_prime) {
					primes[num_primes++] = i;
				}
			}
			calculated = n - (n % 2);
		}
		printf("%d\n", count_pos(n));
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: 'scanf' was not declared in this scope
   20 |                 if (!scanf("%d", &n)) break;
      |                      ^~~~~
a.cc:24:49: error: 'sqrt' was not declared in this scope
   24 |                                 int max = (int)(sqrt(i)) + 1;
      |                                                 ^~~~
a.cc:37:17: error: 'printf' was not declared in this scope
   37 |                 printf("%d\n", count_pos(n));
      |                 ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int primes[78498], num_primes;
Language: C++

#include<bits/stdc++.h>
bool f[1000005];
int tot[1000003];
int main()
{
    memset(f,true,sizeof(f));
    for(int i=2;i<=1000;i++)
    {
        if (f[i])
        {      
            for(int j=i+i;j<=1000000;j=j+i)
            {
                f[j]=false;
            }
        }
    }
    for(int i=2;i<=1000000;i++)
    {
        if(f[i])
        {
            tot[i]=tot[i-1]+1;
        }
        else tot[i]=tot[i-1];
    }
    int in;
    while(cin>>in) cout<<tot[in]<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:11: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   26 |     while(cin>>in) cout<<tot[in]<<endl;
      |           ^~~
      |           std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:26:20: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   26 |     while(cin>>in) cout<<tot[in]<<endl;
      |                    ^~~~
      |                    std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:26:35: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   26 |     while(cin>>in) cout<<tot[in]<<endl;
      |                                   ^~~~
      |                                   std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
/*int main(){
    
    ll n;
    while (cin>>n) {
        vector<ll> v;
        for(int i=0;i<n+1;i++){
            v.push_back(i);
        }
        ll b=v[v.size()-1];
        for(int i=2;i<=n;i++){
            ll j=2;
            while(i*j<=b){
                v[i*j]=0;
                j++;
            }
        }
        ll ans=0;
        for(int i=0;i<v.size();i++){
           // cout<<v[i]<<endl;
            if(v[i]!=0)ans++;
        }
        cout<<ans-1<<endl;
    }
    
    
    return 0;
}*/
int main(){
    
    ll n;
    while(cin>>n){
       /* ll ans=0;
        for(int i=3;i<=n;i+=2){
            int flag=0;
        for(int j=3;j<=sqrt(i);j+=2){
            if(i%j==0){
                flag=1;
                break;
            }
        }
            if(flag==0){
                ans++;
            }
    }
        cout<<ans+1<<endl;*/
        
        vector<bool> IsPrime;
        if(n+1>IsPrime.size()){
            IsPrime.resize(n+1,true);
        }
        IsPrime[0]=false;
        IsPrime[1]=false;
        for(int i=2;i<=sqrt(n);i++){
            if(IsPrime[I]){
                for(ll j=2;i*j<=n;++j){
                    IsPrime[i*j]=false;
}
        }
        
        }
        ll ans=0;
        for(int i=0;i<IsPrime.size();i++){
            if(IsPrime[i])ans++;
        }
        cout<<ans<<endl;
        }
    
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:70:24: error: 'I' was not declared in this scope
   70 |             if(IsPrime[I]){
      |                        ^
Language: C++

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

using namespace std;

vector<bool> prime(1000010, 1);

signed main(){
    prime[0] = 0; prime[1] = 0; prime[2] = ( const ) 1;
    int ret = 0;
    int n; scanf( "%d", &n );
    for( int i = 2; i * i <= n; i++ ){
        if( prime[i] ){
            for( int j = 1; ( j + 1 ) * i <= n; j++ ){
                prime[i * ( j + 1 )] = 0;
            }
        }
    }
    for( int i = 0; i <= n; i++ )
    {
        if( prime[i] )
        {
            ret++;
        }
    }
    printf( "%d\n", ret );
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:46: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
   10 |     prime[0] = 0; prime[1] = 0; prime[2] = ( const ) 1;
      |                                              ^~~~~
Language: C++

//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑

long long isp(long long n) {
	long longres;
	for (int i = 2; i <= sqrt(n); ++i) {
		if (n%i == 0) { ++res; }
	}
	return res;
}

int main() {
	long long n;
	while (cin >> n) { cout << isp(n) << endl; }
}


Compiler output:
a.cc: In function 'long long int isp(long long int)':
a.cc:41:35: error: 'res' was not declared in this scope
   41 |                 if (n%i == 0) { ++res; }
      |                                   ^~~
a.cc:43:16: error: 'res' was not declared in this scope
   43 |         return res;
      |                ^~~
Language: C++

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

int main(){
  int n,i;
i=0;
vector<int> an(1000000),as(1000000);
an[0]=2;
  for(int j=3;j<1000000;j++){
   for(int u=0;u<1000000;u++){
if(an[u]==0){
an[u]=j;
break;
}
if(j%an[u]==0){
break;
}
else{
continue;
}
}
}
   for(int u=1;u<1000000;u++){
if(u==an[i]){
as[u]=as[u-1]+1;
}
else{
as[u]=as[u-1];
}
}
for(int i=0;i<30;i++){
   cin>>n;
cout<<as[n]<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:34:2: error: expected '}' at end of input
   34 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<string>
#include<cmath>
typedef long long int ll;


using namespace std;
bool priN[1000000]={};
bool pri[1000000]={};

bool isPrime(int n){
	if(priN[n]==true)return pri[n];
	for(int i=3;i<=sqrt((double)n);i++){
		if(n%i==0){
			priN[n]=true;
			pri[n]=false;
			return false;
		}
	}
	priN[n]=true;
	pri[n]=true;
	return true;
}

int main(){
	while(1){
		int n;
		if( !(cin>>n) )break;
		ll sum=1;
		if n<2 sum--;
		for(int i=3;i<=n;i+=2){
			if(isPrime(i))sum++;
		}
		cout<<sum<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:20: error: expected '(' before 'n'
   34 |                 if n<2 sum--;
      |                    ^
      |                    (
Language: C++

#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
#define MAX 1000000
bool sosu[MAX]={false};
int main(){
  for(int i=3;i<MAX;i+=2){
    if(sosu[i])continue;
    for(int j=i*3;j<MAX;j+=i*2)
      sosu[j]=true;
  }
  for(int i=4;i<MAX;i+=2)
    sosu[i]=true;
  int in;
  while(cin>>in){
    int co=0;
    loop(i,2,in+1)if(!sosu[i])co++;
    cout<<co<<endl;
  }


}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: 'cin' was not declared in this scope
   25 |   while(cin>>in){
      |         ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include<cstdio>
  +++ |+#include <iostream>
    5 | #define loop(i,a,b) for(int i=a;i<b;i++)
a.cc:28:5: error: 'cout' was not declared in this scope
   28 |     cout<<co<<endl;
      |     ^~~~
a.cc:28:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:28:15: error: 'endl' was not declared in this scope
   28 |     cout<<co<<endl;
      |               ^~~~
a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    4 | #include<cstdio>
  +++ |+#include <ostream>
    5 | #define loop(i,a,b) for(int i=a;i<b;i++)
Language: C++

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

int count(int n);

int main(void){
	while (true){
		int n; cin >> n;
		if (!n){
			break;
		}
		cout << count(n) << endl;
	}
	return 0;
}

int count(int n){
	int ct = 0;
	int *prime = new int[n];
	for (int i = 0; i <= n;i++){
		prime[i] = 0;
	}
	prime[2] = 1;
	for (int i = 3; i <= n; i = i + 2){
		prime[i] = 1;
	}
	for (int i = 3; i <= sqrt(n); i = i + 2){
		if (prime[i] == 0) continue;
		for (int j = i * 2; j <= n; j = j + i){
			prime[j] = 0;
		}
	}
	for (int i = 3; i <= n; i = i + 2){
		if (prime[i] == 1) ct++;
	}
	ct++; //2を数えていない分
	return ct;
	delete[] prime;
}

Compiler output:
a.cc: In function 'int count(int)':
a.cc:28:30: error: 'sqrt' was not declared in this scope
   28 |         for (int i = 3; i <= sqrt(n); i = i + 2){
      |                              ^~~~
Language: C++

#include <iostream>
using namespace std;

int count(int n);

int main(void){
	while (true){
		int n; cin >> n;
		if (!n){
			break;
		}
		cout << count(n) << endl;
	}
	return 0;
}

int count(int n){
	int ct = 0;
	//bool *prime = new bool[n];
	bool prime[999999];
	for (int i = 0; i <= n;i++){
		prime[i] = 0;
	}
	prime[2] = 1;
	for (int i = 3; i <= n; i = i + 2){
		prime[i] = 1;
	}
	for (int i = 3; i <= sqrt(n); i = i + 2){
		if (prime[i] == 0) continue;
		for (int j = i * 2; j <= n; j = j + i){
			prime[j] = 0;
		}
	}
	for (int i = 3; i <= n; i = i + 2){
		if (prime[i] == 1) ct++;
	}
	ct++; //2を数えていない分
	return ct;
	//delete[] prime;
}

Compiler output:
a.cc: In function 'int count(int)':
a.cc:28:30: error: 'sqrt' was not declared in this scope
   28 |         for (int i = 3; i <= sqrt(n); i = i + 2){
      |                              ^~~~
Language: C++

#include <iostream>
using namespace std;

int count(int n);

int main(void){
	while (true){
		int n; cin >> n;
		if (!n){
			break;
		}
		cout << count(n) << endl;
	}
	return 0;
}

int count(int n){
	int ct = 0;
	bool *prime = new bool[n];
	//bool prime[999999];
	for (int i = 0; i <= n;i++){
		prime[i] = 0;
	}
	prime[2] = 1;
	for (int i = 3; i <= n; i = i + 2){
		prime[i] = 1;
	}
	for (int i = 3; i <= sqrt(n); i = i + 2){
		if (prime[i] == 0) continue;
		for (int j = i * 2; j <= n; j = j + i){
			prime[j] = 0;
		}
	}
	for (int i = 3; i <= n; i = i + 2){
		if (prime[i] == 1) ct++;
	}
	ct++; //2を数えていない分
	delete[] prime;
	return ct;
}

Compiler output:
a.cc: In function 'int count(int)':
a.cc:28:30: error: 'sqrt' was not declared in this scope
   28 |         for (int i = 3; i <= sqrt(n); i = i + 2){
      |                              ^~~~
Language: C++

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

int count(int n);

int main(void){
	while (true){
		int n; cin >> n;
		if (!n){
			break;
		}
		cout << count(n) << endl;
	}
	return 0;
}

int count(int n){
	int ct = 0;
	bool *prime = new bool[n];
	//bool prime[999999];
	for (int i = 0; i <= n;i++){
		prime[i] = 0;
	}
	prime[2] = 1;
	for (int i = 3; i <= n; i = i + 2){
		prime[i] = 1;
	}
	for (int i = 3; i <= sqrt(n); i = i + 2){
		if (prime[i] == 0) continue;
		for (int j = i * 2; j <= n; j = j + i){
			prime[j] = 0;
		}
	}
	for (int i = 3; i <= n; i = i + 2){
		if (prime[i] == 1) ct++;
	}
	ct++; //2を数えていない分
	return ct;
	delete[] prime;
}

Compiler output:
a.cc: In function 'int count(int)':
a.cc:29:30: error: 'sqrt' was not declared in this scope
   29 |         for (int i = 3; i <= sqrt(n); i = i + 2){
      |                              ^~~~
Language: C++

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

int count(int n);

int main(void){
	while (true){
		int n; cin >> n;
		if (!n){
			break;
		}
		cout << count(n) << endl;
	}
	return 0;
}

int count(int n){
	int ct = 0;
	bool *prime = new bool[n];
	//bool prime[999999];
	for (int i = 0; i <= n;i++){
		prime[i] = 0;
	}
	prime[2] = 1;
	for (int i = 3; i <= n; i = i + 2){
		prime[i] = 1;
	}
	for (int i = 3; i <= sqrt(n * 1.0); i = i + 2){
		if (prime[i] == 0) continue;
		for (int j = i * 2; j <= n; j = j + i){
			prime[j] = 0;
		}
	}
	for (int i = 3; i <= n; i = i + 2){
		if (prime[i] == 1) ct++;
	}
	ct++; //2を数えていない分
	return ct;
	delete[] prime;
}

Compiler output:
a.cc: In function 'int count(int)':
a.cc:29:30: error: 'sqrt' was not declared in this scope
   29 |         for (int i = 3; i <= sqrt(n * 1.0); i = i + 2){
      |                              ^~~~
Language: C++

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

int main()
{
	const int N = 1000000;
	vector<bool> vec(N, true);
	double limit = sqrt(N);
	for (int i = 2; i < limit; i++){
		for (int j = 2; i * j < N; j++){
			vec[i * j] = false;
		}
	}
	int n, cnt = 0;
	while (cin >> n){
		for (int i = 2; i <= n; i++){
			if (vec[i])cnt++;
		}
		cout << cnt << endl;
		cnt = 0;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:24: error: 'sqrt' was not declared in this scope
    9 |         double limit = sqrt(N);
      |                        ^~~~
Language: C++


#include<stdio.h>
#include<string.h>
#define range 999999
int total_added = 4;
struct primes{
	 int  key;
	 int  counts;
};
primes p[range];
bool is_prime(int key)
{
	int i;
	for (i = 2; i <= sqrt(key); i++)
	{
		if (key%i == 0)return false;
	}
	return true;
}
void init()
{
	p[0].key = 2;
	p[0].counts = 1;
	p[1].key = 3;
	p[1].counts = 2;
	p[2].key = 5;
	p[2].counts = 3;
	p[3].key = 7;
	p[3].counts = 4;
	int i;
	for (i = 8; i <= range; i++)
	{
		if (i % 2 != 0&&i%3!=0&&i%5!=0)
		{
			if (is_prime(i))
			{
				p[total_added].key = i;
				p[total_added].counts = p[total_added - 1].counts + 1;
				total_added++;
			}
		}
	}
}
int counting_result(int key)
{
	for (int i =total_added-1; i>=0; i--)
	{
		if (key >= p[i].key)
			return p[i].counts;
	}
	return 0;
}

int main()
{
	init();
	int i=0, n;
	while (i<30)
	{
		scanf("%d", &n);
		printf("%d\n",counting_result(n));
		i++;
	}

}

Compiler output:
a.cc: In function 'bool is_prime(int)':
a.cc:14:26: error: 'sqrt' was not declared in this scope
   14 |         for (i = 2; i <= sqrt(key); i++)
      |                          ^~~~
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>

using namespace std;


int main(){
    int j,s[1000000]=0;
    long i,n,d=0;
    
    for(i=3;i<1000000;i++){
        for(j=2;j*j<i;j+=2){
            if(j%i==0){
                d--;
                break;
            }
            if(j==2)
                j=1;
        }
        s[i] = ++d;
    }
    
    while(EOF != scanf("%d",&n)){
        printf("%d\n",&d);
    }
    
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:22: error: array must be initialized with a brace-enclosed initializer
   11 |     int j,s[1000000]=0;
      |                      ^
Language: C++

#include  <iostream >
    using  namespace  std;

    int  main()
    {
    	
    	for (int i=0; i<=30; i++)
    	{
    	
        int  N;
        cin  >>  N;
        
        
        int count = 0;
        for (int  i =  1;  i <= N;  ++i)
        {
            bool  isPrime  =  true ;
            for (int  j =  2;  j < i;  ++j)
            {
                if (i  % j ==  0)
                {
                    isPrime  =  false ;
                    break ;
                }
            }
            if (isPrime)
            {
                --N;
                count++;
                
            }
        }
    
        cout << count << endl;
		}
        return  0;
    }

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