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

#include<stdio.h>
#include<float.h>
#include<vector>


vector<int> primes;
int ref_max=2;

int makePrimenumbers(int a){
	if(a<ref_max)return 0;

	temp = ref_max;
	ref_max=a;
	int i,k,isp=1;

	for(k=temp;k<ref_max;k++){
		for(i=0;i<primes.size();i++){
			if(k%primes[i]==0){
				isp=0;
				break;
			}
		}
		if(isp==1){
			primes.push_back(k);
		}
		isp=1;
	}
	return 0;
}

int countprime(int a){
	int i;
	for(i=0;i<prime.size();i++)
		if(a<prime[i])
			break;
	return (i);
}

int main(void)
{
	int result;
	while(scanf("%d",&a)!=EOF){
		makePrimenumbers(a);
		result = countprime(a);
		printf("%d\n",result);
	}
  return 0;
}

Compiler output:
a.cc:6:1: error: 'vector' does not name a type
    6 | vector<int> primes;
      | ^~~~~~
a.cc: In function 'int makePrimenumbers(int)':
a.cc:12:9: error: 'temp' was not declared in this scope; did you mean 'tempnam'?
   12 |         temp = ref_max;
      |         ^~~~
      |         tempnam
a.cc:17:27: error: 'primes' was not declared in this scope
   17 |                 for(i=0;i<primes.size();i++){
      |                           ^~~~~~
a.cc:24:25: error: 'primes' was not declared in this scope
   24 |                         primes.push_back(k);
      |                         ^~~~~~
a.cc: In function 'int countprime(int)':
a.cc:33:19: error: 'prime' was not declared in this scope
   33 |         for(i=0;i<prime.size();i++)
      |                   ^~~~~
a.cc: In function 'int main()':
a.cc:42:27: error: 'a' was not declared in this scope
   42 |         while(scanf("%d",&a)!=EOF){
      |                           ^
Language: C++

#include<stdio.h>
#include<float.h>
#include<vector>



int makePrimenumbers(int a){
	int temp;
	
	if(a<ref_max)return 0;

	temp = ref_max;
	ref_max=a;
	int i,k,isp=1;

	for(k=temp;k<ref_max;k++){
		for(i=0;i<primes.size();i++){
			if(k%primes[i]==0){
				isp=0;
				break;
			}
		}
		if(isp==1){
			primes.push_back(k);
		}
		isp=1;
	}
	return 0;
}

int countprime(int a){
	int i;
	for(i=0;i<prime.size();i++)
		if(a<prime[i])
			break;
	return (i);
}

int main(void)
{
	vector<int> primes;
	int ref_max=2;
	int result;
	int a;
	while(scanf("%d",&a)!=EOF){
		makePrimenumbers(a);
		result = countprime(a);
		printf("%d\n",result);
	}
  return 0;
}

Compiler output:
a.cc: In function 'int makePrimenumbers(int)':
a.cc:10:14: error: 'ref_max' was not declared in this scope
   10 |         if(a<ref_max)return 0;
      |              ^~~~~~~
a.cc:12:16: error: 'ref_max' was not declared in this scope
   12 |         temp = ref_max;
      |                ^~~~~~~
a.cc:17:27: error: 'primes' was not declared in this scope
   17 |                 for(i=0;i<primes.size();i++){
      |                           ^~~~~~
a.cc:24:25: error: 'primes' was not declared in this scope
   24 |                         primes.push_back(k);
      |                         ^~~~~~
a.cc: In function 'int countprime(int)':
a.cc:33:19: error: 'prime' was not declared in this scope
   33 |         for(i=0;i<prime.size();i++)
      |                   ^~~~~
a.cc: In function 'int main()':
a.cc:41:9: error: 'vector' was not declared in this scope
   41 |         vector<int> primes;
      |         ^~~~~~
a.cc:41:9: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:41:16: error: expected primary-expression before 'int'
   41 |         vector<int> primes;
      |                ^~~
Language: C++

#include<stdio.h>
#include<float.h>
#include<vector>



int makePrimenumbers(int a, int ref_max, vector<int> primes){
	int temp;
	
	if(a<ref_max)return 0;

	temp = ref_max;
	ref_max=a;
	int i,k,isp=1;

	for(k=temp;k<ref_max;k++){
		for(i=0;i<primes.size();i++){
			if(k%primes[i]==0){
				isp=0;
				break;
			}
		}
		if(isp==1){
			primes.push_back(k);
		}
		isp=1;
	}
	return 0;
}

int countprime(int a, voctor<int> primes){
	int i;
	for(i=0;i<prime.size();i++)
		if(a<prime[i])
			break;
	return (i);
}

int main(void)
{
	vector<int> primes;
	int ref_max=2;
	int result;
	int a;
	while(scanf("%d",&a)!=EOF){
		makePrimenumbers(a, max_ref, primes);
		result = countprime(a, primes);
		printf("%d\n",result);
	}
  return 0;
}

Compiler output:
a.cc:7:42: error: 'vector' has not been declared
    7 | int makePrimenumbers(int a, int ref_max, vector<int> primes){
      |                                          ^~~~~~
a.cc:7:48: error: expected ',' or '...' before '<' token
    7 | int makePrimenumbers(int a, int ref_max, vector<int> primes){
      |                                                ^
a.cc: In function 'int makePrimenumbers(int, int, int)':
a.cc:17:27: error: 'primes' was not declared in this scope
   17 |                 for(i=0;i<primes.size();i++){
      |                           ^~~~~~
a.cc:24:25: error: 'primes' was not declared in this scope
   24 |                         primes.push_back(k);
      |                         ^~~~~~
a.cc: At global scope:
a.cc:31:23: error: 'voctor' has not been declared
   31 | int countprime(int a, voctor<int> primes){
      |                       ^~~~~~
a.cc:31:29: error: expected ',' or '...' before '<' token
   31 | int countprime(int a, voctor<int> primes){
      |                             ^
a.cc: In function 'int countprime(int, int)':
a.cc:33:19: error: 'prime' was not declared in this scope
   33 |         for(i=0;i<prime.size();i++)
      |                   ^~~~~
a.cc: In function 'int main()':
a.cc:41:9: error: 'vector' was not declared in this scope
   41 |         vector<int> primes;
      |         ^~~~~~
a.cc:41:9: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:41:16: error: expected primary-expression before 'int'
   41 |         vector<int> primes;
      |                ^~~
a.cc:46:37: error: 'max_ref' was not declared in this scope
   46 |                 makePrimenumbers(a, max_ref, primes);
      |                                     ^~~~~~~
a.cc:46:46: error: 'primes' was not declared in this scope
   46 |                 makePrimenumbers(a, max_ref, primes);
      |                                              ^~~~~~
Language: C++

#include <iostream>
using namespace std;

int main(){
	int n;
	int a=0;
	cin >> n)
		for(int i = 0; i < n; ++i){
			for(int j = 2; j <= i; ++j){

				if(i%j == 0){
				if(i==j){
					++a;
				}else{
					break;
				}
				}
		}
	
	}
		cout << a << '\n';
}

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

#include<iostream>

bool sieve[1000000];

void makesieve();

int main()
{
	makesieve();
	while(1)
	{
		int n,ans=0;
		std::cin>>n;
		if(std::cin.eof())break;
		for(int i=0;i<n;i++)
		{
			ans+=sieve[i]?1:0;
		}
		std::cout<<ans<<std::endl;
	}
	return 0;
}

void makesieve()
{
	memset(sieve,-1,sizeof(sieve));
	sieve[0]=false;sieve[1]=false;
	for(int i=2;i<1000000;i++)
	{
		for(int j=i*2;j<1000000;j+=i)
		{
			sieve[j]=false;
		}
	}
}

Compiler output:
a.cc: In function 'void makesieve()':
a.cc:26:9: error: 'memset' was not declared in this scope
   26 |         memset(sieve,-1,sizeof(sieve));
      |         ^~~~~~
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++

import java.util.Scanner;

public class Main
{

	public static void main(String arg[])
	{
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int count=0;
		for (int i=2; i<=n; i++)
		{
			if(prim(i))
				count++;
		}		
		System.out.println(count);
	}

	public static boolean prim(int a)
	{
		if(a<2)
			return false;
		else if (a==2)
			return true;
		
		for(int j = 2; j<a; j++)
		{
			if(a%j==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:3:1: error: expected unqualified-id before 'public'
    3 | public class Main
      | ^~~~~~
Language: C++

#include<stdio.h>
#define max 1000001;

int main(void)
{
	int *d, f1, f2, n, cnt;
	d = new int [max];
	for(f1 = 0; f1 < max; f1++)
	{
		d[f1] = 1;
	}
	for(f1 = 2; f1 *f1 < max; f1++)
	{
		if(d[f1] == 1)
		{
			for(f2 = 2 * f1; f2 < max; f2 += f1)
			{
				d[f2] = 0;
			}
		}
	}
	while (scanf("%d",&n) != EOF)
	{
		cnt=  0;
		for(f1 = 2; f1 >= n; f1++)
		{
			if(d[f1] == 1)
				cnt++;
		}
		printf("%d\n",cnt);
	}
	return 0;
}
	

Compiler output:
a.cc: In function 'int main()':
a.cc:2:20: error: expected ']' before ';' token
    2 | #define max 1000001;
      |                    ^
a.cc:7:22: note: in expansion of macro 'max'
    7 |         d = new int [max];
      |                      ^~~
a.cc:7:25: error: expected primary-expression before ']' token
    7 |         d = new int [max];
      |                         ^
a.cc:8:29: error: expected primary-expression before ';' token
    8 |         for(f1 = 0; f1 < max; f1++)
      |                             ^
a.cc:8:29: error: expected ')' before ';' token
    8 |         for(f1 = 0; f1 < max; f1++)
      |            ~                ^
a.cc:8:35: error: expected ';' before ')' token
    8 |         for(f1 = 0; f1 < max; f1++)
      |                                   ^
      |                                   ;
a.cc:12:33: error: expected primary-expression before ';' token
   12 |         for(f1 = 2; f1 *f1 < max; f1++)
      |                                 ^
a.cc:12:33: error: expected ')' before ';' token
   12 |         for(f1 = 2; f1 *f1 < max; f1++)
      |            ~                    ^
a.cc:12:39: error: expected ';' before ')' token
   12 |         for(f1 = 2; f1 *f1 < max; f1++)
      |                                       ^
      |                                       ;
Language: C++

#include<iostream>
#include<math.h>
main(){int i,j,n,p[1000000];std::cin>>n;for(i=2;i<=n;i++)p[i]=1;for(i=2;i<n;i++)if(p[i])for(j=2;i*j<=n;j++)p[i*j]=0;j=0;for(i=2;i<=n;i++)j+=p[i];std::cout<<j<<lend;}

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){int i,j,n,p[1000000];std::cin>>n;for(i=2;i<=n;i++)p[i]=1;for(i=2;i<n;i++)if(p[i])for(j=2;i*j<=n;j++)p[i*j]=0;j=0;for(i=2;i<=n;i++)j+=p[i];std::cout<<j<<lend;}
      | ^~~~
a.cc: In function 'int main()':
a.cc:3:160: error: 'lend' was not declared in this scope
    3 | main(){int i,j,n,p[1000000];std::cin>>n;for(i=2;i<=n;i++)p[i]=1;for(i=2;i<n;i++)if(p[i])for(j=2;i*j<=n;j++)p[i*j]=0;j=0;for(i=2;i<=n;i++)j+=p[i];std::cout<<j<<lend;}
      |                                                                                                                                                                ^~~~
Language: C++

main(){int i,j,n;char p[1000000];while(scanf("%d",&n)!=-1){for(i=2;i<=n;i++)p[i]=1;for(i=2;i<n;i++)for(j=2;i*j<=n;j++)p[i*j]=0;j=0;for(i=2;i<=n;i++)j+=p[i];printf("%d\n",j);}}

Compiler output:
a.cc:1:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    1 | main(){int i,j,n;char p[1000000];while(scanf("%d",&n)!=-1){for(i=2;i<=n;i++)p[i]=1;for(i=2;i<n;i++)for(j=2;i*j<=n;j++)p[i*j]=0;j=0;for(i=2;i<=n;i++)j+=p[i];printf("%d\n",j);}}
      | ^~~~
a.cc: In function 'int main()':
a.cc:1:40: error: 'scanf' was not declared in this scope
    1 | main(){int i,j,n;char p[1000000];while(scanf("%d",&n)!=-1){for(i=2;i<=n;i++)p[i]=1;for(i=2;i<n;i++)for(j=2;i*j<=n;j++)p[i*j]=0;j=0;for(i=2;i<=n;i++)j+=p[i];printf("%d\n",j);}}
      |                                        ^~~~~
a.cc:1:157: error: 'printf' was not declared in this scope
    1 | main(){int i,j,n;char p[1000000];while(scanf("%d",&n)!=-1){for(i=2;i<=n;i++)p[i]=1;for(i=2;i<n;i++)for(j=2;i*j<=n;j++)p[i*j]=0;j=0;for(i=2;i<=n;i++)j+=p[i];printf("%d\n",j);}}
      |                                                                                                                                                             ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | main(){int i,j,n;char p[1000000];while(scanf("%d",&n)!=-1){for(i=2;i<=n;i++)p[i]=1;for(i=2;i<n;i++)for(j=2;i*j<=n;j++)p[i*j]=0;j=0;for(i=2;i<=n;i++)j+=p[i];printf("%d\n",j);}}
Language: C++

#include<stdio.h>
#include<stdlib.h>
 
int main(void)
{
 _Bool *list;
 int n,i,j,cnt;
 
 while(scanf("%d",&n) != EOF)
 {
  cnt = 0;
  list = (int*)calloc(n+1,sizeof(int));
  for(i = 2; i <= n; i++)
  {
   if(list[i] != 1) /*prime number:0 no prime numbers:1*/
   { 
    cnt++;
    for(j = i+i; j <= n; j+=i) list[j] = 1;
   }
  }
  printf("%d\n",cnt);
  free(list);
 } 
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:2: error: '_Bool' was not declared in this scope
    6 |  _Bool *list;
      |  ^~~~~
a.cc:6:9: error: 'list' was not declared in this scope
    6 |  _Bool *list;
      |         ^~~~
Language: C++

#include <iostream>
#include <cmath>
using namespace std;
#define N 1000000

int main()
{
	bool prm[N];
	for(int i=0; i<N; i++)
	{
		prm[i]=true;
         }
		int upto= (int) sqrt(N);
		for(int i=2;i<= upto; i++)
		{
			if(prm[i])
				for(int j=2; j*i<N; j++)
				{
				    prm[i*j]=false;
				}
		}
		int n;
		while(cin>>n)
		{
			int count=0;
			for(int i=2; i<=n; i++)
			{
				if(prm[i])
					count++;
			}
			cout<<count<<endl;
		}
	}
	return 0;
}

Compiler output:
a.cc:34:9: error: expected unqualified-id before 'return'
   34 |         return 0;
      |         ^~~~~~
a.cc:35:1: error: expected declaration before '}' token
   35 | }
      | ^
Language: C++

#include <iostream>
#include <cmath>
using namespace std;
#define N 1000000

int main()
{
	bool prm[N];
	for(int i=0; i<N; i++)
	{
		prm[i]=true;
         }
		int upto= (int) sqrt(N);
		for(int i=2;i<= upto; i++)
		{
			if(prm[i])
{
				for(int j=2; j*i<N; j++)
				{
				    prm[i*j]=false;
				}
}
		}
		int n;
		while(cin>>n)
		{
			int count=0;
			for(int i=2; i<=n; i++)
			{
				if(prm[i])
					count++;
			}
			cout<<count<<endl;
		}
	}
	return 0;
}

Compiler output:
a.cc:36:9: error: expected unqualified-id before 'return'
   36 |         return 0;
      |         ^~~~~~
a.cc:37:1: error: expected declaration before '}' token
   37 | }
      | ^
Language: C++

#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;

int main(void){
  int n;
  while(cin >> n){
    if(n < 3){
      if(n < 2){
	cout << 0 << endl;
      }else{
	cout << 1 << endl;
      }
    }
    for(int i = 3; i <= n; i += 2){
      bool flag = true;
      for(int j = 3; j <= sqrt(i); j += 2){
	if(i % j == 0){
	  flag = false;
	}
      }
      if(flag)
	ans++;
    }
    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |         ans++;
      |         ^~~
      |         abs
a.cc:26:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   26 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C++

#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;

int main(void){
  int n;
  bool p[1000000];
  p[0] = p[1] = 0;
  p[2] = 1;
  int ans = 0;
  bool flag;
  for(int i = 0; i < 1000000; i++)
    p[i] = false;
  p[2] = true;
  for(int i = 3; i <= 1000000; i += 2){
    flag = true;
    for(int j = 3; j * j <= i; j += 2){
      if(i % j == 0){
	flag = false;
	break;
      }
    }
    if(flag)
      p[i] = true;
  }
  // cout << "end" << endl;
  while(cin >> n){
    int ans = 0;
    for(int i = 2; i < n; i++){
      if(p[i])
	ans++;
    }
    cout << ansi << endl;
  }
  return 0;
}

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

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

int main(){
int n;
cin >> n;
int a[n+1];
int b;
int c;
b=1;
while(b<n+1){
a[b]=0;
b=b+1;}
a[1]=1;
b=2;
while(b<n+1){
if(a[b]=0){ c=2; while(1){if(c*b>n){break;} a[c*b]=1; c=c+1;}
b=b+1;}

int d;
d=0;
b=1;
while(b<n+1){
if(a[b]=0){d=d+1;}
b=b+1;}
cout << d;


}

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

int main(){
int n;
while(cin >> n){
int a[n+1];
int b;
int c;
b=1;
while(b<n+1){
a[b]=0;
b=b+1;}
a[1]=1;
int d;
d=0;
b=2;
while(b<n+1){
if(a[b]==0){d=d+1; c=2; while(1){if(c*b>n){break;} a[c*b]=1; c=c+1;}}
b=b+1;}
cout << d;}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:7: error: 'cin' was not declared in this scope
    3 | while(cin >> n){
      |       ^~~
a.cc:18:1: error: 'cout' was not declared in this scope
   18 | cout << d;}
      | ^~~~
a.cc:18:12: error: expected '}' at end of input
   18 | cout << d;}
      |            ^
a.cc:1:11: note: to match this '{'
    1 | int main(){
      |           ^
Language: C++

#include<stdio.h>
#include<math.h>
int gurobal[1000001]={0};
int main(void)
{
	int n=0;
	int i=0,j=0;
	int heihoukon=0;
	int count=0;
	while(scanf("%d",&n)!=EOF)
	{
		count=0;
		gurobal[1]=0;
		for (i=2;i<=n;i++)
		{
			gurobal[i]=1;
		}
		(int)heihoukon=sqrt((double)n);
		for (i=2;i<=heihoukon;i++)
		{
			if (gurobal[i]!=0)
			{
				for (j=i*2;j<=n;j+=i)
				{
					gurobal[j]=0;
				}
			}
		}
		for (i=2;i<=n;i++)
		{
			if (gurobal[i]!=0)
			{
				count++;
			}
		}
		printf("%d\n",count);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: lvalue required as left operand of assignment
   18 |                 (int)heihoukon=sqrt((double)n);
      |                 ^~~~~~~~~~~~~~
Language: C++

#include<stdio.h>
#include<math.h>
int gurobal[100000001]={0};
int main(void)
{
	int n=0;
	int i=0,j=0;
	int heihoukon=0;
	int count=0;
	while(scanf("%d",&n)!=EOF)
	{
		count=0;
		gurobal[1]=0;
		for (i=2;i<=n;i++)
		{
			gurobal[i]=1;
		}
		(int)heihoukon=sqrt((double)n);
		for (i=2;i<=heihoukon;i++)
		{
			if (gurobal[i]!=0)
			{
				for (j=i*2;j<=n;j+=i)
				{
					gurobal[j]=0;
				}
			}
		}
		for (i=2;i<=n;i++)
		{
			if (gurobal[i]!=0)
			{
				count++;
			}
		}
		printf("%d\n",count);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: lvalue required as left operand of assignment
   18 |                 (int)heihoukon=sqrt((double)n);
      |                 ^~~~~~~~~~~~~~
Language: C++

package util;
import java.util.Scanner;

public class Main{
    boolean isPrime[];

    void run(){
	isPrime = new boolean[1000000];
	for(int i=0;i<1000000;i++) isPrime[i] = true;

	isPrime[0] = false;
	isPrime[1] = false;

	for(int i=2;i<=1000000;i++){
	    if(!isPrime[i]) continue;
	    for(int j=i+i;j<=1000000;j+=i){
		isPrime[j] = false;
	    }
	}


	Scanner sc = new Scanner(System.in);
	while(sc.hasNext()){
	    int n=sc.nextInt();
	    int count = 0;
	    for(int i=0;i<=n;i++){
		if(isPrime[i]) count++;
	    }
	    System.out.println(count);
	}
    }

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

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

#include <iostream>
using namespace std;
void solve(int n);

int main() {
	int n;
	while (cin >> n) {
		if (n<=1) cout << 0 << endl;
		solve(n);
	}
	return 0;
}
void solve(int n) {
	int prime[n];
	int i=0;j=0;
	for (i=2; i<=n; i++) {
		prime[j] = i;
		j++;
	}

	int p;
	for (i=0; i<n; i++) {
		p = prime[i];
		if (p == -1) continue;
		
		for (int k=i+1; k<n; k++) {
			if (prime[k]%p == 0)
				prime[k] = -1;
		}
	}
	int count = 0;
	for (int i=0; i<n; i++)
		if (prime[i] != -1) count++;
	cout << count << endl;
}

Compiler output:
a.cc: In function 'void solve(int)':
a.cc:15:17: error: 'j' was not declared in this scope
   15 |         int i=0;j=0;
      |                 ^
Language: C++

#include<iostream>

int a,n[40],c[40];
int main (){
	for(int i=2;i<31;i++){
		n[i]=1;
		for(int j=2;j<i;j++){
		if(i%j==0){
			n[i]=0;
			j=i;
		}
		}
	}

	for(int i=1;i<31;i++){
		c[i]=c[i-1]+n[i];
	}
	while(scanf("%d"a)^){
		printf("%d",c[a]);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:21: error: unable to find string literal operator 'operator""a' with 'const char [3]', 'long unsigned int' arguments
   18 |         while(scanf("%d"a)^){
      |                     ^~~~~
a.cc:18:28: error: expected primary-expression before ')' token
   18 |         while(scanf("%d"a)^){
      |                            ^
Language: C++

#include<iostream>
#include<vector>

#define LIM 1000000
using namespace std;

void prime();

vector<int> prime_map;

int main(){
  int num, i=0,j=0;
  vector<int> count;
  prime();
  cout<<"plese"<<endl;
  while(cin){
    cin>>num;
    i=0;
    while(prime_map[i]<=num){
      i=i+1;
    }
    count.push_back(i);
    j++;
  }

  i=0;
  while(i<j){
    cout<< count[i]<<endl;
    i++;
  }
}

void prime(){
  bool judge;
  for(int i = 2; i <= LIM;i++){
    judge=1;
    for(int j= 2; j < i/2; j++){
      if(i%j == 0)judge = 0 break;
    }
    if(judge == 1)prime_map.push_back(i);
  }
}

Compiler output:
a.cc: In function 'void prime()':
a.cc:38:28: error: expected ';' before 'break'
   38 |       if(i%j == 0)judge = 0 break;
      |                            ^~~~~~
      |                            ;
Language: C++

#include<iostream>

#define LIM 1000000
using namespace std;

int main(){
  bool num_map[LIM];
  int in_num,prime_count;
  for(int i=0;i<LIM;i++){
    num_map[i]=1;
  }
  
  for(int i=2;i<LIM;i++){
    if(num_map[i]==1)
      for(int j=i*2;j<LIM;j+=i){
	num_map[j]=cout<<in_num<<endl<<endl;
    for(int i=2;i<=in_num;i++){
      if(num_map[i]==1)
	prime_count++;
    }
    cout<<prime_count<<endl;  
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:38: error: cannot convert 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'bool' in assignment
   16 |         num_map[j]=cout<<in_num<<endl<<endl;
      |                    ~~~~~~~~~~~~~~~~~~^~~~~~
      |                                      |
      |                                      std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_ios.h:121:16: note: explicit conversion function was not considered
  121 |       explicit operator bool() const
      |                ^~~~~~~~
a.cc:24:2: error: expected '}' at end of input
   24 | }
      |  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
vector<int> prime;
void init(){
	for(int i=2;i<999999;i++){
		bool isprime=true;
		for(vector::iterator p(prime.begin());p!=prime.end();p++){
			if(i%*p==0){
				isprime=false;
				break;
			}
		}
		if(isprime){
			prime.push_back(i);
		}
	}
}
int main(){
	int n;
	init();
	while(cin>>n){
		cout<<lower_bound(prime.begin(),prime.end(),n)-prime.begin()+1<<endl;
	}
	return 0;
}

Compiler output:
a.cc:4:1: error: 'vector' does not name a type
    4 | vector<int> prime;
      | ^~~~~~
a.cc: In function 'void init()':
a.cc:8:21: error: 'vector' has not been declared
    8 |                 for(vector::iterator p(prime.begin());p!=prime.end();p++){
      |                     ^~~~~~
a.cc:8:55: error: 'p' was not declared in this scope
    8 |                 for(vector::iterator p(prime.begin());p!=prime.end();p++){
      |                                                       ^
a.cc:8:58: error: 'prime' was not declared in this scope; did you mean 'isprime'?
    8 |                 for(vector::iterator p(prime.begin());p!=prime.end();p++){
      |                                                          ^~~~~
      |                                                          isprime
a.cc:15:25: error: 'prime' was not declared in this scope; did you mean 'isprime'?
   15 |                         prime.push_back(i);
      |                         ^~~~~
      |                         isprime
a.cc: In function 'int main()':
a.cc:23:35: error: 'prime' was not declared in this scope
   23 |                 cout<<lower_bound(prime.begin(),prime.end(),n)-prime.begin()+1<<endl;
      |                                   ^~~~~
Language: C++

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
vector<int> prime;
void init(){
	for(int i=2;i<999999;i++){
		bool isprime=true;
		for(vector::iterator p(prime.begin());p!=prime.end();p++){
			if(i%*p==0){
				isprime=false;
				break;
			}
		}
		if(isprime){
			prime.push_back(i);
		}
	}
}
int main(){
	int n;
	init();
	while(cin>>n){
		cout<<lower_bound(prime.begin(),prime.end(),n)-prime.begin()+1<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'void init()':
a.cc:9:38: error: qualified-id in declaration before 'p'
    9 |                 for(vector::iterator p(prime.begin());p!=prime.end();p++){
      |                                      ^
a.cc:9:37: error: expected ';' before 'p'
    9 |                 for(vector::iterator p(prime.begin());p!=prime.end();p++){
      |                                     ^~
      |                                     ;
a.cc:9:38: error: 'p' was not declared in this scope
    9 |                 for(vector::iterator p(prime.begin());p!=prime.end();p++){
      |                                      ^
a.cc:9:69: error: expected ')' before ';' token
    9 |                 for(vector::iterator p(prime.begin());p!=prime.end();p++){
      |                    ~                                                ^
      |                                                                     )
a.cc:9:70: error: 'p' was not declared in this scope
    9 |                 for(vector::iterator p(prime.begin());p!=prime.end();p++){
      |                                                                      ^
Language: C++

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
vector<int> prime;
void init(){
	for(int i=2;i<999999;i++){
		bool isprime=true;
		for(vector<int>::iterator p(prime.begin());p!=prime.end();p++){
			if(p*p>i)break;
			if(i%*p==0){
				isprime=false;
				break;
			}
		}
		if(isprime){
			prime.push_back(i);
		}
	}
}
int main(){
	int n;
	init();
	while(cin>>n){
		cout<<lower_bound(prime.begin(),prime.end(),n)-prime.begin()+1<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'void init()':
a.cc:10:29: error: no match for 'operator*' (operand types are 'std::vector<int>::iterator' and 'std::vector<int>::iterator')
   10 |                         if(p*p>i)break;
      |                            ~^~
      |                            | |
      |                            | __normal_iterator<[...],[...]>
      |                            __normal_iterator<[...],[...]>
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
                 from /usr/include/c++/14/vector:62,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:1090:7: note: candidate: '__gnu_cxx::__normal_iterator<_Iterator, _Container>::reference __gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*() const [with _Iterator = int*; _Container = std::vector<int>; reference = int&]'
 1090 |       operator*() const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1090:7: note:   candidate expects 0 arguments, 1 provided
Language: C++


def generate (n)
    $P = Array.new(n, false)
    i = 3
    until i > n
        $P[i] = true
        i += 2
    end
    i = 3
    $P[2] = true
    until i > n
        if ! $P[i]
            i += 2
            next
        end
        j = i + i
        until j > n do
            $P[j] = false
            j += i
        end
        i += 2
    end
end

def is_prime (n)
    return $P[n] ? 1 : 0
end

def solve (n)
    return ->() {
        res = 0
        (n+1).times {|v| res += is_prime(v) }
        res
    }.call
end

generate 1000000 
while s = gets do
    n = s.to_i
    p solve n
end

Compiler output:
a.cc:2:1: error: 'def' does not name a type
    2 | def generate (n)
      | ^~~
a.cc:34:6: error: expected unqualified-id before '.' token
   34 |     }.call
      |      ^
Language: C++

#include <iostream>
using namespace std;
#define thefor(i,end) for (i=0;i<end;i++)
bool isprime(int n)
{
	if(n==1)return false;
	if(n==2)return true;
	for (int i=3;i<n;i++)
	{
		if (n%i==0)return false;
	}
	if (i==n)
		return true;		
	else
		return false;
}
int main()
{
	bool prime[1000010];
	memset(prime,1,1000010);
	prime[0]=prime[1]=0;
	int i,j,n,sum;
	for (i=2;i<1000000;i++)
	{
		if (prime[i])
		{
			for (j=2;i*j<1000000;j++)
			{
				prime[i*j]=false;
			}
		}
	}
	while(cin>>n)
	{
		sum=0;
		for(i=2;i<=n;i++)
		{
			sum+=prime[i];
		}
		cout<<sum<<endl;

	}	
	return 0;
}

Compiler output:
a.cc: In function 'bool isprime(int)':
a.cc:12:13: error: 'i' was not declared in this scope
   12 |         if (i==n)
      |             ^
a.cc: In function 'int main()':
a.cc:20:9: error: 'memset' was not declared in this scope
   20 |         memset(prime,1,1000010);
      |         ^~~~~~
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 | using namespace std;
a.cc: In function 'bool isprime(int)':
a.cc:16:1: warning: control reaches end of non-void function [-Wreturn-type]
   16 | }
      | ^
Language: C++

#include <iostream>
using namespace std;
int main()
{
	bool prime[1000010];
	memset(prime,1,1000010);
	prime[0]=prime[1]=0;
	int i,j,n,sum;
	for (i=2;i<1000000;i++)
	{
		if (prime[i])
		{
			for (j=2;i*j<1000000;j++)
			{
				prime[i*j]=false;
			}
		}
	}
	while(cin>>n)
	{
		sum=0;
		for(i=2;i<=n;i++)
		{
			sum+=prime[i];
		}
		cout<<sum<<endl;

	}	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'memset' was not declared in this scope
    6 |         memset(prime,1,1000010);
      |         ^~~~~~
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 | using namespace std;
Language: C++

#include<iostream>
using namespace std;
main(){
	while(cin>>n){
		cout<<n<<endl;
	}
}

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:4:20: error: 'n' was not declared in this scope
    4 |         while(cin>>n){
      |                    ^
Language: C++

#include <iostream>

int main()
{
    bool *table = new bool[1000000];
    while (true) {
        int n;
        std::cin >> n;
        if (std::cin.eof()) break;

        memset(table, 1, sizeof(bool) * (n + 1));
        for (int i = 2; i * i <= n; ++i)
            for (int j = 2; i * j <= n; ++j)
                table[i * j] = false;

        int cnt = 0;
        for (int i = 2; i <= n; ++i) cnt += table[i];
        std::cout << cnt << std::endl;
    }
    delete[] table;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'memset' was not declared in this scope
   11 |         memset(table, 1, sizeof(bool) * (n + 1));
      |         ^~~~~~
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<math.h>

using namespace std;

int main(){
	int n,i,j,buf,cnt;
	bool flag;

	while(cin >> n){
		if(n == 1){
			cout << "0" << endl;
			continue;
		}

		cnt = 1;

		for(i=3;i<=n;i+=2){
			flag = false;
			buf = (int)sqrt((double)i);

			for(j=3;j<=buf;j+=2){
				if((i % j) == 0){
					flag = true;
					break;
				}
			}

			if(flag == false;){
				cnt++;
			}
		}

		cout << cnt << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:42: error: expected primary-expression before ')' token
   29 |                         if(flag == false;){
      |                                          ^
Language: C++

#include<stdio.h>
#include<math.h>
int gurobal[1000001]={0};
int main(void)
{
	int n=0;
	int i=0,j=0;
	int heihoukon=0;
	int count=0;
	while(scanf("%d",&n)!=EOF)
	{
		count=0;
		gurobal[1]=0;
		for (i=2;i<=n;i++)
		{
			gurobal[i]=1;
		}
		(int)heihoukon=sqrt((double)n);
		for (i=2;i<=heihoukon;i++)
		{
			if (gurobal[i]!=0)
			{
				for (j=i*2;j<=n;j+=i)
				{
					gurobal[j]=0;
				}
			}
		}
		for (i=2;i<=n;i++)
		{
			if (gurobal[i]!=0)
			{
				count++;
			}
		}
		printf("%d\n",count);
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: lvalue required as left operand of assignment
   18 |                 (int)heihoukon=sqrt((double)n);
      |                 ^~~~~~~~~~~~~~
Language: C++

#include<stdio.h>
#include<math.h>
int gurobal[999999]={0};
int main(void)
{
	int n=0;
	int i=0,j=0;
	int heihoukon=0;
	int count=0;
	while(scanf("%d",&n)!=EOF)
	{
		count=0;
		gurobal[1]=0;
		for (i=2;i<=n;i++)
		{
			gurobal[i]=1;
		}
		(int)heihoukon=sqrt((double)n);
		for (i=2;i<=heihoukon;i++)
		{
			if (gurobal[i]!=0)
			{
				for (j=i*2;j<=n;j+=i)
				{
					gurobal[j]=0;
				}
			}
		}
		for (i=2;i<=n;i++)
		{
			if (gurobal[i]!=0)
			{
				count++;
			}
		}
		printf("%d\n",count);
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: lvalue required as left operand of assignment
   18 |                 (int)heihoukon=sqrt((double)n);
      |                 ^~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <bitset>
#include <cmath>
using namespace std;

int main()
{
	int count=0,n;
	prime[0]=1;
	prime[1]=1;

	while(cin>>n)
	{
		int prime[1000001]={0};
		for(int i=2;i<=sqrt(n);i++)
			if(prime[i]==0)
				for(int j=i+1;j<=n;j++)
					if(i%j==0)
						prime[j]=1;
		for(int i=2;i<=n;i++)
			if(prime[i]==0)
				count++;
		cout<<count<<endl;
		count=0;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'prime' was not declared in this scope
    9 |         prime[0]=1;
      |         ^~~~~
Language: C++

#include<iostream>
using namespace std;

int main()
{
	bool is_prime[1000000];
	memset(is_prime,false,sizeof(is_prime));
	for(int i=2;i<1000000;i++){
		if(!is_prime[i]){
//			cout<<i<<endl;
			for(int m=i*2;m<1000000;m+=i){
				is_prime[m]=true;
			}
		}
	}
	int n;
	while(cin>>n){
		int ans=0;
		for(int i=2;i<=n;i++){
			if(!is_prime[i]) ans++;
		}
		cout<<ans<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'memset' was not declared in this scope
    7 |         memset(is_prime,false,sizeof(is_prime));
      |         ^~~~~~
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 | using namespace std;
Language: C++

#include <stdio.h>
#include <string.h>
int main(void){
    int n=999999,a,b,c;
    char x[1000000];
    memset(x,0,sizeof(x));
    for(a=2,c=0;a<=n;a++){
        if(x[a]){x[a]=c;continue;}
        x[a]=++c;
        for(b=a*2;b<=n;b+=a)x[b]=-1;
    }
    while(~scanf("%d",&n)){
        printf("%d\n",x[n]);
    }
    return 0;

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

#include <iostream>
#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(cin >> n)
        cout << prime[n] << endl;
    
    return 0;
}

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 >> n)
      |           ^~~
      |           std::cin
In file included 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:27:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   27 |         cout << prime[n] << 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:27:29: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   27 |         cout << prime[n] << endl;
      |                             ^~~~
      |                             std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

const int N = 100000

int main(void)
{
    bool a[N+1];
    int prime[N], n;
    rep(i,N+1)
    {
        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(cin >> n)
        cout << prime[n] << endl;
    
    return 0;
}

Compiler output:
a.cc:7:1: error: expected ',' or ';' before 'int'
    7 | int main(void)
      | ^~~
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef vector <int> vi;
vi primes;

int get_primes(int max){
	int n = (max+1)/2;
	int root = (int)(pow(n, 0.5));
	vector <bool> numbers(n, true);
	numbers[0]=false;

	if (max>1) primes.push_back(2);
	for (int i=1; i<root; i++){
		int tmp = i*2+1;
		if (numbers[i]){
			primes.push_back(tmp);
			for (int j=i+tmp; j<n+1; j+=tmp){
				numbers[j]=false;
			}
		}
	}
	for (int i=root; i<n+1; i++){
		if(numbers[i]){
			primes.push_back(2*i+1);
		}
	}
	return 0;
}

int main(void){
	vi n;
	int nmax=0;
	while (true){
		int tmp;
		cin>>tmp;
		if (cin.eof()) break;

		n.push_back(tmp);
		if (tmp>nmax) nmax=tmp;
	}

	get_primes(nmax);
	for (int i=0; i<n.size(); i++){
		cout<<upper_bound(primes.begin(), primes.end(), n[i]) - primes.begin()<<endl;
	}
	return 0;
} 

Compiler output:
a.cc: In function 'int get_primes(int)':
a.cc:10:26: error: 'pow' was not declared in this scope
   10 |         int root = (int)(pow(n, 0.5));
      |                          ^~~
Language: C++

#include <iostream>
using namespace std;

bool isprime(int &num)
{
    static int i;
    i = 2;
    for(;i< num; i++)
        if(num%i==0) return false;
    return true;
}

int countprime(int &num)
{
    static int i;
    static int count;
    count = 0;
    i = 2;
    for(;i<=num;i++)
        if(isprime(i)) count++;
    return count;
}

int main()
{
    int num[30];
    for(int i = 0; i < 30; i++)
        cin >> num[i];

    for(int i = 0; i < 30; i++)
        cout << countprime(int num[i]) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:28: error: expected primary-expression before 'int'
   31 |         cout << countprime(int num[i]) << endl;
      |                            ^~~
Language: C++

#include <iostream>
using namespace std;

int main(){

	const int N_MAX=1000000;
	int i,j,n[32],ni,soi,max;
	int so[N_MAX],count[N_MAX];
	
	for(i=0;i<N_MAX;i++)
		count[i]=so[i]=0;
	ni=0;
	max=0;
	while(cin>>n[ni])
		if(n[ni++]>max)
			max=n[ni-1];
	int sq_max = (int)sqrt(max);
	so[0]=so[1]=1;
	for(soi=0,i=2;i<=sq_max;i++){
		if(so[i]>0)continue;
		for(j=i*2;j<=max;j+=i)
			so[j]=1;
	}
	for(i=2;i<=max;i++){
		count[i] = count[i-1]+1-so[i];
	}
	for(i=0;i<ni;i++)
		cout << count[n[i]] << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:27: error: 'sqrt' was not declared in this scope
   17 |         int sq_max = (int)sqrt(max);
      |                           ^~~~
Language: C++

#include <iostream>
using namespace std;

int main(){

	const int N_MAX=100000;
	int i,j,n[32],ni,soi,max;
	int so[N_MAX],count[N_MAX];
	
	for(i=0;i<N_MAX;i++)
		count[i]=so[i]=0;
	ni=0;
	max=0;
	while(cin>>n[ni])
		if(n[ni++]>max)
			max=n[ni-1];
	int sq_max = (int)sqrt(max);
	so[0]=so[1]=1;
	for(soi=0,i=2;i<=sq_max;i++){
		if(so[i]>0)continue;
		for(j=i*2;j<=max;j+=i)
			so[j]=1;
	}
	for(i=2;i<=max;i++){
		count[i] = count[i-1]+1-so[i];
	}
	for(i=0;i<ni;i++)
		cout << count[n[i]] << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:27: error: 'sqrt' was not declared in this scope
   17 |         int sq_max = (int)sqrt(max);
      |                           ^~~~
Language: C++

#include <iostream>
using namespace std;

int main(){

	const int N_MAX=100;
	int i,j,n[32],ni,soi,max;
	int so[N_MAX],count[N_MAX];
	
	for(i=0;i<N_MAX;i++)
		count[i]=so[i]=0;
	ni=0;
	max=0;
	while(cin>>n[ni])
		if(n[ni++]>max)
			max=n[ni-1];
	int sq_max = (int)sqrt(max);
	so[0]=so[1]=1;
	for(soi=0,i=2;i<=sq_max;i++){
		if(so[i]>0)continue;
		for(j=i*2;j<=max;j+=i)
			so[j]=1;
	}
	for(i=2;i<=max;i++){
		count[i] = count[i-1]+1-so[i];
	}
	for(i=0;i<ni;i++)
		cout << count[n[i]] << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:27: error: 'sqrt' was not declared in this scope
   17 |         int sq_max = (int)sqrt(max);
      |                           ^~~~
Language: C++

#include <iostream>
using namespace std;

int main(){

	const int N_MAX=1000000;
	int i,j,n[32],ni,max;
	int count[N_MAX];
	bool so[N_MAX];
	
	for(i=0;i<N_MAX;i++)
		so[i]=true;
	ni=0;
	max=0;
	while(cin>>n[ni])
		if(n[ni++]>max)
			max=n[ni-1];
	so[0]=so[1]=0;
	for(soi=0,i=2;i<=1000;i++){
		if(so[i]==0)continue;
		for(j=i*2;j<=max;j+=i)
			so[j]=false;
	}
	for(i=2;i<=max;i++){
		count[i] = count[i-1]+so[i];
	}
	for(i=0;i<ni;i++)
		cout << count[n[i]] << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: error: 'soi' was not declared in this scope; did you mean 'so'?
   19 |         for(soi=0,i=2;i<=1000;i++){
      |             ^~~
      |             so
Language: C++

#include<iostream>
#include<conio.h>
#include<cmath>    

using namespace std;

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

     for (int i=2; i<n; i++)
        for (int j=2; j*j<=i; j++)
        {
            if (i % j == 0)
                break;
            else if (j+1 > sqrt(i)) {
                cout << i << endl;
            }
        }

     return 0;
 }

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

int main(void)
{
	int data,i,j,k=0,l=0,kai[100]={0},s[100000]={0};

	while(scanf("%d",&data) != EOF)
	{
		if(data<=1)
		   kai[k]=0;
		else
		{
			for(i=2;i<=data;i++)s[i]=i;

		    i=2;
			while(i*2<data)
			{
			  if(s[i] != 0)
			  {  
				j=2;
				while(j*i<=data)
				{
					s[j*i]=0;
					j+=1;
				}
			  }
			  i+=1;
			}

			
			for(i=2;i<=data;i++)
			{	
				if(s[i]!=0)
				{
					kai[k]+=1;
				}
			}
		}
		k+=1;
	}

  for(j=0;j<k;j++)
    printf("%d\n",kai[j]);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:15: error: 'scanf' was not declared in this scope
    5 |         while(scanf("%d",&data) != EOF)
      |               ^~~~~
a.cc:5:36: error: 'EOF' was not declared in this scope
    5 |         while(scanf("%d",&data) != EOF)
      |                                    ^~~
a.cc:1:1: note: 'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main(void)
a.cc:41:5: error: 'printf' was not declared in this scope
   41 |     printf("%d\n",kai[j]);
      |     ^~~~~~
a.cc:41:5: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include<stdio.h>

int main(void)
{
	int data,i,j,k=0,l=0,kai=0,s[100000]={0};

	while(scanf("%d",&data) != EOF)
	{
		if(data<=1)
		   kai[k]=0;
		else
		{
			for(i=2;i<=data;i++)s[i]=i;

		    i=2;
			while(i*2<data)
			{
			  if(s[i] != 0)
			  {  
				 j=2;
				while(j*i<=data)
				{
					s[j*i]=0;
					j+=1;
				}
			  }
			  i+=1;
			}

			
			for(i=2;i<=data;i++)
			{	
				if(s[i]!=0)
				{
					kai+=1;
				}
			}
		}
		printf("%d",kai);
		kai=0;
	}

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:23: error: invalid types 'int[int]' for array subscript
   10 |                    kai[k]=0;
      |                       ^
Language: C++

#include<stdio.h>

int main(void)
{
	int data=1,i,j,s[1000000],x;

	while((scanf("%d\n",&data)) != EOF)
	{
		for(i=0;i<=data;i++){
			s[i]=1;}
		x=0;
		if(data<=1){
			printf("%d\n",0);}
		else
		{
			for(i=2;i<=data/2;i++){
			  if(s[i]!=0){
				for(j=i*2;j<data;j+=i)
				    s[j]=0;
			  }
		for(i=0;i<data;i++)
			x+=s[i];
		printf("%d\n",x);
		}
	}
  return 0;
}

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


int main(void)
{
	int d=2,i,j,s[10000],x;

	while(scanf("%d",d)!=EOF)
	{
		for(i=0;i<=d;i++){
			s[i]=1;}
		x=0;
		if(d<=1){
			printf("%d\n",0);}
		else
		{
			for(i=2;i<=d/2;i++){
			  if(s[i]!=0){
				for(j=i*2;j<d;j+=i)
				    s[j]=0;
			  }
			}
		for(i=0;i<d;i++)
			x+=s[i];
		printf("%d\n",x);
		}
	}
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:15: error: 'scanf' was not declared in this scope
    6 |         while(scanf("%d",d)!=EOF)
      |               ^~~~~
a.cc:6:30: error: 'EOF' was not declared in this scope
    6 |         while(scanf("%d",d)!=EOF)
      |                              ^~~
a.cc:1:1: note: 'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | 
a.cc:12:25: error: 'printf' was not declared in this scope
   12 |                         printf("%d\n",0);}
      |                         ^~~~~~
a.cc:12:25: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:23:17: error: 'printf' was not declared in this scope
   23 |                 printf("%d\n",x);
      |                 ^~~~~~
a.cc:23:17: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
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:
a.cc:42:1: error: expected unqualified-id before numeric constant
   42 | 04:57:02 ~/programming/AOJ
      | ^~