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

#include <stdio.h>
 
#define MN 
 
int main(void)
{
    int n;
    int i, j;
	long LN = 1000001;
    int pn[1000001];
     
    for (i = 0; i < LN; i++){
        pn[i] = 1;
    }
     
    pn[0] = pn[1] = 0;
     
    for (i = 2; i * i < LN; i++){
        if (pn[i] == 1){
            for (j = i * i; j < LN; j += i){
                pn[j] = 0;
            }
        }
    }
     
    for (i = 1; i < LN - 1; i++){
        pn[i + 1] += pn[i];
    }
     
    while (cin >> n){
    	cout << pn[n] << endl;
    }
     
    return (0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:12: error: 'cin' was not declared in this scope
   30 |     while (cin >> n){
      |            ^~~
a.cc:31:9: error: 'cout' was not declared in this scope
   31 |         cout << pn[n] << endl;
      |         ^~~~
a.cc:31:26: error: 'endl' was not declared in this scope
   31 |         cout << pn[n] << endl;
      |                          ^~~~
Language: C++

#include <iostream>

using namespace std;

int main()
{
	int n;
	int count;
	while (1)
	{
		cin >> n;
		if (cin.fail()) break;

		bool *isPrime;
		isPrime = new bool[n + 1];
		memset(isPrime, true, sizeof(bool) * (n + 1));
		isPrime[0] = isPrime[1] = false;
		
		count = 0;
		for (int i = 2; i <= n; ++i)
		{
			for (int j = i + i; j <= n; j += i)
			{
				isPrime[j] = false;
			}
		}
		for (int i = 0; i <= n; ++i)
		{
			if (isPrime[i] == true)
				++count;
		}
		cout << count << endl;
		delete[] isPrime;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: 'memset' was not declared in this scope
   16 |                 memset(isPrime, true, 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<string>
using namespace std;
int main(){
	int n,a[9];
	a[0]=9592;
	a[1]=17984;
	a[2]=25997;
	a[3]=33860;
	a[4]=41538;
	a[5]=49098;
	a[6]=56543;
	a[7]=63951;
	a[8]=71274;
	while(cin>>n){
		int count=0;
		int i=0;
		while(true){
			if((i+1)*100000<=n)
				count=a[i];
			else
				break;
			i++;
		}
		if(n<100000){
			count=1;
			for(int j=3;j<=n;j++){
			bool t=false;
			for(int k=2;k<1+(double)sqrt((double)j);k++){
				if(j%k==0)
					t=true;
			}
			if(t==false)
				count++;
		    }
		}
		else{
		    for(int j=(i)*100000+1;j<=n;j++){
			    bool t=false;
			    for(int k=2;k<1+(double)sqrt((double)j);k++){
				    if(j%k==0)
				        t=true;
			    }
			    if(t==false)
				    count++;
		    }
		}
		cout<<count<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:49: error: 'sqrt' was not declared in this scope
   29 |                         for(int k=2;k<1+(double)sqrt((double)j);k++){
      |                                                 ^~~~
a.cc:40:53: error: 'sqrt' was not declared in this scope
   40 |                             for(int k=2;k<1+(double)sqrt((double)j);k++){
      |                                                     ^~~~
Language: C++

#include <iostream>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	int n, count,k;

	while(cin >> n){
		count = 1;
		k = 0;

		for(int i = 3; i <= n; i += 2){
			for(int j = 3; j <= sqrt((double)i); j += 2)
			{
				if(i%j == 0){
					k = 1;
					break;
				}
			}
			if(k == 0){
				count++;
			}
		}
		cout << count << endl;
	}

	return 0;
}

Compiler output:
a.cc:5:22: error: '_TCHAR' has not been declared
    5 | int _tmain(int argc, _TCHAR* argv[])
      |                      ^~~~~~
a.cc: In function 'int _tmain(int, int**)':
a.cc:14:45: error: 'sqrt' was not declared in this scope
   14 |                         for(int j = 3; j <= sqrt((double)i); j += 2)
      |                                             ^~~~
Language: C++

// PrimeNumber.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//

#include "stdafx.h"
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
	int n, count,k;

	while(cin >> n){
		count = 1;
		k = 0;

		for(int i = 3; i <= n; i += 2){
			for(int j = 3; j <= sqrt((double)i); j += 2)
			{
				if(i%j == 0){
					k = 1;
					break;
				}
			}
			if(k == 0){
				count++;
			}
		}
		cout << count << endl;
	}

	return 0;
}

Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++


#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
	int n, count,k;

	while(cin >> n){
		count = 1;
		k = 0;

		for(int i = 3; i <= n; i += 2){
			for(int j = 3; j <= sqrt((double)i); j += 2)
			{
				if(i%j == 0){
					k = 1;
					break;
				}
			}
			if(k == 0){
				count++;
			}
		}
		cout << count << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:15:45: error: 'sqrt' was not declared in this scope
   15 |                         for(int j = 3; j <= sqrt((double)i); j += 2)
      |                                             ^~~~
Language: C++


#include <iostream>

using namespace std;

int main()
{
	int n, count,k;

	while(cin >> n){
		count = 1;
		k = 0;

		for(int i = 3; i <= n; i += 2){
			for(int j = 3; j <= std::sqrt((double)i); j += 2)
			{
				if(i%j == 0){
					k = 1;
					break;
				}
			}
			if(k == 0){
				count++;
			}
		}
		cout << count << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:50: error: 'sqrt' is not a member of 'std'
   15 |                         for(int j = 3; j <= std::sqrt((double)i); j += 2)
      |                                                  ^~~~
Language: C++

#include <iostream>
#include <string>
#include <stack>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <vector>

using namespace std;
int sieve(int n);
int prime[1000000];
bool is_prime[1000000];

int main()
{

	int p = 0;
	for (int i = 0; i <= 999999; i++) {
		is_prime[i] = true;
	}
	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i <= 999999; i++) {
		if (is_prime[i]) {
			prime[p++] = i;
			for (int j = 2 * i; j <= 999999; j += i) {
				is_prime[j] = false;
			}
		}
	}
	int n;
	while (scanf_s("%d", &n) != EOF) {
		int i = 0;
		while (prime[i] <= n) {
			i++;
		}
		cout << i << endl;
	}
}

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

#include <iostream>
using namespace std;


int main(){
	int number,cnt=0;
	cin>>number;
	int* arr = new int[number+1];
	for (int i = 1; i <= number; i+=2)
	{
		arr[i-1]=0;
		arr[i]=1;
	}
	for (int i = 3; i < sqrt(number); i+=2)
		if (arr[i])
			for (int j = i+i; j <=number; j+=i)
				arr[j]=0;
	arr[2]=1;arr[1]=0;
	for (int i = 0; i < number; i++)
		if (arr[i])
			++cnt;
	cout<<cnt;
}

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


int main()
{
    bool num[1000000]={false};
    for(int i=2;i<1000;i++){
        if(!num[i]){
            for(int j=i*i;j<1000000;j+=i){
                num[j]=true;
            }
        }
    }
    int n;
    while(cin>>n){
        int ans=0;
        for(int i=2;i<=n;i++){
            if(!num[i])
                ans++;
        }
        cout<<ans<<endl;
    }
    return 0;
}

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

#include<iostream>
#include<stdio.h>
using namespace std;
typedef long long ll;
const ll MAX=1e6;
ll prime[MAX+2],mark[MAX+2],ans[MAX+2];
void Prime(){
    memset(mark,0,sizeof(mark));
    ll index=0;
    for(ll i=2;i<=MAX;i++){
        if(mark[i]) continue;
        else{
            prime[++index]=i;
            for(ll j=i*i;j<=MAX;j+=i){
                mark[j]=1;
            }
        }
    }
}
int main(){
    ll a;
    memset(ans,0,sizeof(ans));
    Prime();
    for(int i=2;i<=MAX-2;i++){
        if(mark[i]==0) ans[i]=ans[i-1]+1;
        else ans[i]=ans[i-1];
    }
    while(scanf("%I64d",&a)!=EOF){
        cout<<ans[a]<<endl;;
    }
    return 0;
}

Compiler output:
a.cc: In function 'void Prime()':
a.cc:8:5: error: 'memset' was not declared in this scope
    8 |     memset(mark,0,sizeof(mark));
      |     ^~~~~~
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 | #include<stdio.h>
a.cc: In function 'int main()':
a.cc:22:5: error: 'memset' was not declared in this scope
   22 |     memset(ans,0,sizeof(ans));
      |     ^~~~~~
a.cc:22:5: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
int main() {
  int n;
  vector<int> v;
  while (cin >> n) {
    if (v.size() > n) {
      cout << accmulate(v.begin(), v.end() - (v.size() - n), 0) << endl;
    }
    v.resize(n + 1);
    fill(v.begin(), v.end(), 1);
    v[0] = 0;
    v[1] = 0;
    for (int i = 0; i * i < v.size(); ++i) {
      while (v[i] == 0) ++i;
      for (int m = i + 1; m < v.size(); ++m) {
        if (m % i == 0) {
          v[m] = 0;
        }
      }
    }
    cout << accumulate(v.begin(), v.end(), 0) << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:15: error: 'accmulate' was not declared in this scope
   10 |       cout << accmulate(v.begin(), v.end() - (v.size() - n), 0) << endl;
      |               ^~~~~~~~~
Language: C++

/*
Volume0-0009
*/
//#include <iostream>
#include <stdio.h>
#include <stdlib.h>

#define N 1000000
#define TRUE (int)(0==0)
#define FALSE !TRUE
#define BUFLEN 1024
//using std;

int syserr(char *str)
{
  fputs(str, stderr);
  exit(-1);
}
int main(int argc, char *argv[]){
  int f[N];

  memset(f, TRUE, N);
  f[1]=FALSE;
  for (int i=3; i<N; i++){
    if (f[i] == TRUE ) {
      for (int j=i+i; j<N; j+=i){
	f[j] = FALSE;
      }
    }
  }

  for (int i=3; i<N; i+=2) {
    if (f[i/2-1]) {
      x = x + 1;
    }
    f[i/2-1]=x;
  }
  char buf[BUFLEN];
  while (fgets(buf, BUFLEN, stdin) != NULL){
    int n = atoi(buf);

    int m = 0;
    for (int i=1; i<=n; i++){
      if (f[i]){
	m++;
      }
    }

    printf("%d\n", m);
 
  exit(0);
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:22:3: error: 'memset' was not declared in this scope
   22 |   memset(f, TRUE, N);
      |   ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <stdlib.h>
  +++ |+#include <cstring>
    7 | 
a.cc:34:7: error: 'x' was not declared in this scope
   34 |       x = x + 1;
      |       ^
a.cc:36:14: error: 'x' was not declared in this scope
   36 |     f[i/2-1]=x;
      |              ^
a.cc:52:2: error: expected '}' at end of input
   52 | }
      |  ^
a.cc:19:33: note: to match this '{'
   19 | int main(int argc, char *argv[]){
      |                                 ^
Language: C++

/*
Volume0-0009
*/
#include <iostream>
#include <stdlib.h>
#include <string.h>

#define N 1000000
#define TRUE (int)(0==0)
#define FALSE !TRUE
#define BUFLEN 1024

using namespace std;

int main(int argc, char *argv[]){
  int f[N];

  //  memset(f, TRUE, N);
  f[0]=FALSE;
  f[1]=FALSE;
  for (int i=2; i<N; i++)
    f[i] = TRUE;

  for (int i=2; i<N; i++){
    if (f[i] == TRUE ) {
      for (int j=i+i; j<N; j+=i){
	f[j] = FALSE;
      }
    }
  }

  while (cin >> int n) != NULL){
    int m = 0;
    for (i=1; i<=n; i++){
      if (f[i]){
	m++;
      }
    }
    cout << m;
  }
 
  exit(0);
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:32:17: error: expected primary-expression before 'int'
   32 |   while (cin >> int n) != NULL){
      |                 ^~~
a.cc:32:16: error: expected ')' before 'int'
   32 |   while (cin >> int n) != NULL){
      |         ~      ^~~~
      |                )
a.cc:32:22: error: expected initializer before ')' token
   32 |   while (cin >> int n) != NULL){
      |                      ^
Language: C++

/*
Volume0-0009
*/
#include <iostream>
#include <stdlib.h>
#include <string.h>

#define N 1000000
#define TRUE (int)(0==0)
#define FALSE !TRUE

using namespace std;

int main(int argc, char *argv[]){
  int f[N];

  //  memset(f, TRUE, N);
  f[0]=FALSE;
  f[1]=FALSE;
  for (int i=2; i<N; i++)
    f[i] = TRUE;

  for (int i=2; i<N; i++){
    if (f[i] == TRUE ) {
      for (int j=i+i; j<N; j+=i){
	f[j] = FALSE;
      }
    }
  }
  int n;
  while (cin >> n) != NULL){
    int m = 0;
    for (i=1; i<=n; i++){
      if (f[i]){
	m++;
      }
    }
    cout << m;
  }
 
  exit(0);
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:31:20: error: expected primary-expression before '!=' token
   31 |   while (cin >> n) != NULL){
      |                    ^~
Language: C++

#include<stdio.h>
#include<Math.h>

int main(){
	int n;
	int a[10000];
	int b;
	int i, j, p;
	int c[30];
	p = 0;
	while (scanf("%d", &n) != EOF){
		b = (int)pow((double)n, 0.5);
		c[p] = 0;
		a[0] = -1;
		for (i = 2; i <= b; i++){
			for (j = 2; j <= n / i; j++){
				a[i*j - 1] = -1;
			}
		}
		for (i = 1; i <= n; i++){
			if (a[i - 1] != -1){ c[p]++; }
			a[i - 1] = 0;
		}
		p++;
	}
	for (i = 0; i < p; i++){
		printf("%d\n", c[i]);
	}
	return 0;
}

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

#include<stdio.h>
#include<Math.h>

int main(){
	int n;
	int a[1000];
	int b;
	int i, j, p;
	int c[30];
	p = 0;
	while (scanf("%d", &n) != EOF){
		b = (int)pow((double)n, 0.5);
		c[p] = 0;
		a[0] = -1;
		for (i = 2; i <= b; i++){
			for (j = 2; j <= n / i; j++){
				a[i*j - 1] = -1;
			}
		}
		for (i = 1; i <= n; i++){
			if (a[i - 1] != -1){ c[p]++; }
			a[i - 1] = 0;
		}
		p++;
	}
	for (i = 0; i < p; i++){
		printf("%d\n", c[i]);
	}
	return 0;
}

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

#include<stdio.h>
#include<Math.h>

int main(){
	int n;
	int a[100000];
	int b;
	int i, j, p;
	int c[30];
	p = 0;
	while (scanf("%d", &n) != EOF){
		b = (int)pow((double)n, 0.5);
		c[p] = 0;
		a[0] = -1;
		for (i = 2; i <= b; i++){
			for (j = 2; j <= n / i; j++){
				a[i*j - 1] = -1;
			}
		}
		for (i = 1; i <= n; i++){
			if (a[i - 1] != -1){ c[p]++; }
			a[i - 1] = 0;
		}
		p++;
	}
	for (i = 0; i < p; i++){
		printf("%d\n", c[i]);
	}
	return 0;
}

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

import numpy
def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break
def primesfrom3to(n):
    sieve = numpy.ones(int(n/2), dtype=numpy.bool)
    if n%2 != 0:
        sieve = numpy.append(sieve,n/2)
    for i in range(3,int(n**0.5)+1,2):
        if sieve[int(i/2)]:
            sieve[int(i*i/2)::int(i)] = False
    return 2*numpy.nonzero(sieve)[0][1::]+1
if __name__ == "__main__":
    array = list(get_input())
    for i in range(int(len(array))):
        primeList = list(primesfrom3to(int(array[i])))
        primeList.insert(0,2)
        #print(primeList)
        print(len(primeList))

Compiler output:
a.cc:5:19: error: empty character constant
    5 |             yield ''.join(input())
      |                   ^~
a.cc:21:10: error: invalid preprocessing directive #print
   21 |         #print(primeList)
      |          ^~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import numpy
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<iostream>
using namespace std;
int main(){
int a,i;
cin>>a;
for(int x=0;x<a;x++){
if(a%x){i++}
cout<<i<<endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:12: error: expected ';' before '}' token
    7 | if(a%x){i++}
      |            ^
      |            ;
Language: C++

#include<iostream>
using namespace std;
int main(){
int a,i;
cin>>a;
for(int x=2x<a;x++){
if(a%x==0){i++}
cout<<i<<endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:11: error: unable to find numeric literal operator 'operator""x'
    6 | for(int x=2x<a;x++){
      |           ^~
a.cc:6:19: error: expected ';' before ')' token
    6 | for(int x=2x<a;x++){
      |                   ^
      |                   ;
a.cc:7:15: error: expected ';' before '}' token
    7 | if(a%x==0){i++}
      |               ^
      |               ;
Language: C++

#include<iostream>
using namespace std;
int main(){
int a,i;
for(;;){
cin>>a;
for(int x=2x<a;x++){
if(a%x==0){i++}
cout<<i<<endl;
}
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:11: error: unable to find numeric literal operator 'operator""x'
    7 | for(int x=2x<a;x++){
      |           ^~
a.cc:7:19: error: expected ';' before ')' token
    7 | for(int x=2x<a;x++){
      |                   ^
      |                   ;
a.cc:8:15: error: expected ';' before '}' token
    8 | if(a%x==0){i++}
      |               ^
      |               ;
Language: C++

#include<iostream>
using namespace std;
int main(){
int a,i;
for(;;){
cin>>a;
for(int x=2x<a;x++){
if(a%x>0){i++}
cout<<i<<endl;
}
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:11: error: unable to find numeric literal operator 'operator""x'
    7 | for(int x=2x<a;x++){
      |           ^~
a.cc:7:19: error: expected ';' before ')' token
    7 | for(int x=2x<a;x++){
      |                   ^
      |                   ;
a.cc:8:14: error: expected ';' before '}' token
    8 | if(a%x>0){i++}
      |              ^
      |              ;
Language: C++

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

Int pn[1000002];

int main(){
int n, Count;
con.tie(0);
while(scanf("%d",&n)!=EOF){
Count=0;
memset(pn,0,n);
pn[0]=pn[1]=1;
for(int i=0;i<=n;i++) if(!pn[i]) for(int j=0;i*j<=n;j++) pn[i*j]=1;
Count=count(pn,pn+n,0);
count<<Count<<endl;
}
return 0;
}

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

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

Int pn[1000002];

int main(){
int n, Count;
con.tie(0);
while(scanf("%d",&n)!=EOF){
Count=0;
memset(pn,0,n);
pn[0]=pn[1]=1;
for(int i=0;i<=n;i++) if(!pn[i]) for(int j=0;i*j<=n;j++) pn[i*j]=1;
Count=count(pn,pn+n,0);
count<<Count<<endl;
}
return 0;
}

Compiler output:
a.cc:6:1: error: 'Int' does not name a type; did you mean 'int'?
    6 | Int pn[1000002];
      | ^~~
      | int
a.cc: In function 'int main()':
a.cc:10:1: error: 'con' was not declared in this scope
   10 | con.tie(0);
      | ^~~
a.cc:13:8: error: 'pn' was not declared in this scope; did you mean 'n'?
   13 | memset(pn,0,n);
      |        ^~
      |        n
a.cc:16:7: error: 'count' was not declared in this scope; did you mean 'Count'?
   16 | Count=count(pn,pn+n,0);
      |       ^~~~~
      |       Count
Language: C++

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

Int pn[1000002];

int main(){
int n, Count;
cin.tie(0);
while(scanf("%d",&n)!=EOF){
Count=0;
memset(pn,0,n);
pn[0]=pn[1]=1;
for(int i=2;i<=n;i++) if(!pn[i]) for(int j=1;i*j<=n;j++) pn[i*j]=1;
Count=count(pn,pn+n,0);
cout<<Count<<endl;
}
return 0;
}

Compiler output:
a.cc:6:1: error: 'Int' does not name a type; did you mean 'int'?
    6 | Int pn[1000002];
      | ^~~
      | int
a.cc: In function 'int main()':
a.cc:13:8: error: 'pn' was not declared in this scope; did you mean 'n'?
   13 | memset(pn,0,n);
      |        ^~
      |        n
a.cc:16:7: error: 'count' was not declared in this scope; did you mean 'Count'?
   16 | Count=count(pn,pn+n,0);
      |       ^~~~~
      |       Count
Language: C++

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

int pn[1000002];

int main(){
int n, Count;
cin.tie(0);
while(scanf("%d",&n)!=EOF){
Count=0;
memset(pn,0,n);
pn[0]=pn[1]=1;
for(int i=2;i<=n;i++) if(!pn[i]) for(int j=1;i*j<=n;j++) pn[i*j]=1;
Count=count(pn,pn+n,0);
cout<<Count<<endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:7: error: 'count' was not declared in this scope; did you mean 'Count'?
   16 | Count=count(pn,pn+n,0);
      |       ^~~~~
      |       Count
Language: C++

#include <iostream>
#include <vector>
#define pb(a) push_back(a) 
#define rep(i,a,n) for(int i=a; i<n; i++)
using namespace std;
 
int main() {
    int n = 1000000;
    vector<int> v;
    v.pb(2);
    for(int i=3;i<=n;i+=2) {
        bool add = true;
        rep(j,0,v.size()) {
            if(v[j] * v[j] > i) break;
            if(i % v[j] == 0) {
                add = false; 
                break;
            }
        }
        if(add) v.pb(i);
    }

    int m;
    while(cin >> m) {
        cout << upper_bound(v.begin(), v.end(), m) - v.begin() << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:17: error: 'upper_bound' was not declared in this scope
   25 |         cout << upper_bound(v.begin(), v.end(), m) - v.begin() << endl;
      |                 ^~~~~~~~~~~
Language: C++

import java.util.Scanner;
import java.io.*;
class Main{
    public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    int ans,n;
    while(sc.hasNext()){
    	n=sc.nextInt();
    	ans=0;
    	if(n==1)ans=-1;
    	for(int i=1;i<=n;i+=2){
    		int flag=0;
    		for(int j=3;j<=Math.sqrt(i);j+=2){
    			if(i%j==0){
    				flag=1;break;
    			}
    		}
    		if(flag==0)ans++;
    	}
    	System.out.println(ans);
    }
    }
}

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:2:1: error: 'import' does not name a type
    2 | import java.io.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:11: error: expected ':' before 'static'
    4 |     public static void main(String[] args){
      |           ^~~~~~~
      |           :
a.cc:4:29: error: 'String' has not been declared
    4 |     public static void main(String[] args){
      |                             ^~~~~~
a.cc:4:38: error: expected ',' or '...' before 'args'
    4 |     public static void main(String[] args){
      |                                      ^~~~
a.cc:23:2: error: expected ';' after class definition
   23 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:5:5: error: 'Scanner' was not declared in this scope
    5 |     Scanner sc =new Scanner(System.in);
      |     ^~~~~~~
a.cc:7:11: error: 'sc' was not declared in this scope
    7 |     while(sc.hasNext()){
      |           ^~
a.cc:13:32: error: 'Math' was not declared in this scope
   13 |                 for(int j=3;j<=Math.sqrt(i);j+=2){
      |                                ^~~~
a.cc:20:9: error: 'System' was not declared in this scope
   20 |         System.out.println(ans);
      |         ^~~~~~
Language: C++

#include<iostream>
using namespace std;
int main(){
	int a[999999]={0,0,1,2},n,k=0;count=2;
	for(int i=4;i<999999;i++){
		for(int j=2;j*j<=i;j++){
			if(i%j==0)k++;
		}
		if(k==1)count++;
		a[i]=count;
		k=0;
	}
	while(cin>>n)cout<<a[n]<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:39: error: 'count' was not declared in this scope
    4 |         int a[999999]={0,0,1,2},n,k=0;count=2;
      |                                       ^~~~~
Language: C++

#include&<iostream>
#include&<vector>
using namespace std;
int main(){
    int n,k,sum,check;
    int t=1;
    vector<int> prime;
    prime.push_back(0);
    prime.push_back(0);
    for(int i=2;i<1000000;i++){
        prime.push_back(1);
    }
    while(t<1000000){
        for(int j=t+1;j<=1000000;j++){
            if(prime[j]==1){
                t=j;
                for(k=2*j;k<=1000000;k+=j){
                    prime[k]=0;
                }
                break;
            }
            else if(j==1000000){
                t=1000000;
            }
        }
    }
    while(cin>>n){
        sum=0;
        for(check=1;check<=n;check++){
            if(prime[check]==1){
                sum+=1;
            }
        }
        cout << sum << endl;
    }
    return 0;
}

Compiler output:
a.cc:1:9: error: #include expects "FILENAME" or <FILENAME>
    1 | #include&<iostream>
      |         ^
a.cc:2:9: error: #include expects "FILENAME" or <FILENAME>
    2 | #include&<vector>
      |         ^
a.cc: In function 'int main()':
a.cc:7:5: error: 'vector' was not declared in this scope
    7 |     vector<int> prime;
      |     ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | #include&<iostream>
a.cc:7:12: error: expected primary-expression before 'int'
    7 |     vector<int> prime;
      |            ^~~
a.cc:8:5: error: 'prime' was not declared in this scope
    8 |     prime.push_back(0);
      |     ^~~~~
a.cc:27:11: error: 'cin' was not declared in this scope
   27 |     while(cin>>n){
      |           ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #include&<iostream>
a.cc:34:9: error: 'cout' was not declared in this scope
   34 |         cout << sum << endl;
      |         ^~~~
a.cc:34:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:34:24: error: 'endl' was not declared in this scope
   34 |         cout << sum << endl;
      |                        ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #include&<iostream>
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:6:23: error: array must be initialized with a brace-enclosed initializer
    6 |         bool num[N] = true;
      |                       ^~~~
Language: C++

#include<iostream>
using namespace std;
int main(){
	int n, cnt;
	int N = 1000000;
	bool prime[N] = false;
	prime[1] = true; //1???????????\
	
	while(cin >> n){
		// ??¨??????????????????????????????
		for(int j = 2; j*j <= n; j++){
			if(prime[j] == false){
				for(int k = j; k*j <= n; k++){
					prime[j*k] =true;
				}
			}
		}
		
		for(int i = 1; i <= n; i++){
			if(prime[i] == false) cnt++;
		}
		
		cout << cnt << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:25: error: array must be initialized with a brace-enclosed initializer
    6 |         bool prime[N] = false;
      |                         ^~~~~
Language: C++

#include<iostream>
using namespace std;
int main(){
	int n, cnt;
	bool prime[1000000] = false;
	prime[1] = true; //1???????????\
	
	while(cin >> n){
		// ??¨??????????????????????????????
		for(int j = 2; j*j <= n; j++){
			if(prime[j] == false){
				for(int k = j; k*j <= n; k++){
					prime[j*k] =true;
				}
			}
		}
		
		for(int i = 1; i <= n; i++){
			if(prime[i] == false) cnt++;
		}
		
		cout << cnt << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:31: error: array must be initialized with a brace-enclosed initializer
    5 |         bool prime[1000000] = false;
      |                               ^~~~~
Language: C++

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

int main()
{
  int n;
  int count=0;
  while(cin >> n){
    double nd=(double)n;
    int root=(int)sqrt(nd);
    
    for(int i=2;i<=n;i++){
      for(int j=2;j<=root;j++){
        if(i%j==0) break;
      }
      if(j==root) count++;
    }
    cout << count << endl;
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:10: error: 'j' was not declared in this scope
   17 |       if(j==root) count++;
      |          ^
Language: C++

$inputArray = array();
while (!feof(STDIN)) {
  $input = trim(fgets(STDIN));
  if (empty($input)) {
    break;
  }
  array_push($inputArray, $input);
}

foreach ($inputArray as $input) {
  $count = 0;
  for ($i = 2; $i <= $input; $i++) {
    if (isSosu($i)) {
      $count++;
    }
  }
  echo $count . "\n";
}

function isSosu($num) {
  $count = 0;
  for ($i = 2; $i < $num; $i++) {
    if ($num % $i == 0) {
      $count++;
    }
  }
  if ($count == 0) {
    return true;
  } else {
    return false;
  }
}

Compiler output:
a.cc:1:1: error: '$inputArray' does not name a type
    1 | $inputArray = array();
      | ^~~~~~~~~~~
a.cc:2:1: error: expected unqualified-id before 'while'
    2 | while (!feof(STDIN)) {
      | ^~~~~
a.cc:10:9: error: expected constructor, destructor, or type conversion before '(' token
   10 | foreach ($inputArray as $input) {
      |         ^
a.cc:20:1: error: 'function' does not name a type; did you mean 'union'?
   20 | function isSosu($num) {
      | ^~~~~~~~
      | union
Language: C++

int main() {
	bool isPrime[1000000] = {true};

	for (int i = 0; i < 1000000; i++) {
		isPrime[i] = true;
	}

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

		if (isPrime[i]) {
			int k = 2*i;
			while (k < 1000000) {
				isPrime[k] = false;
				k += i;
			}
		}
	}

	int n;
	while (cin >> n) {
		int sum = 0;
		for (int i = 2; i <= n; i++) {
			if (isPrime[i])
				sum++;
		}
		cout << sum << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:16: error: 'cin' was not declared in this scope
   23 |         while (cin >> n) {
      |                ^~~
a.cc:29:17: error: 'cout' was not declared in this scope
   29 |                 cout << sum << endl;
      |                 ^~~~
a.cc:29:32: error: 'endl' was not declared in this scope
   29 |                 cout << sum << endl;
      |                                ^~~~
Language: C++

???#include <iostream>

using namespace std;

int main()
{
	unsigned int  n;
	cin >> n;
	unsigned  int num, count = 0;
	for(int i = 0; i < n; i++)
	{
		cin >> num;
		for(int j = 2; j < num; j++)
		{
			if(num % j == 0)
			{
				break;
			}
			if(num - 1 == j)
			{
				count++;
			}
		}
		if(num == 2)
		{
			count++;
		}
	}
	cout << count << std::endl;
	return 0;
}

Compiler output:
a.cc:1:4: error: stray '#' in program
    1 | ???#include <iostream>
      |    ^
a.cc:1:1: error: expected unqualified-id before '?' token
    1 | ???#include <iostream>
      | ^
a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope
    8 |         cin >> n;
      |         ^~~
a.cc:29:9: error: 'cout' was not declared in this scope; did you mean 'count'?
   29 |         cout << count << std::endl;
      |         ^~~~
      |         count
a.cc:29:31: error: 'endl' is not a member of 'std'
   29 |         cout << count << std::endl;
      |                               ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | ???#include <iostream>
Language: C++

???#include <iostream>

using namespace std;

int main()
{
	unsigned int  n;
	cin >> n;
	unsigned  int num, count = 0;
	for(int i = 0; i < n; i++)
	{
		cin >> num;
		for(int j = 2; j <=num; j++)
		{
			if(num == j)count++;
			if(num % j == 0)
			{
				break;
			}
		}
	}
	cout << count << endl;
	return 0;
}

Compiler output:
a.cc:1:4: error: stray '#' in program
    1 | ???#include <iostream>
      |    ^
a.cc:1:1: error: expected unqualified-id before '?' token
    1 | ???#include <iostream>
      | ^
a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope
    8 |         cin >> n;
      |         ^~~
a.cc:22:9: error: 'cout' was not declared in this scope; did you mean 'count'?
   22 |         cout << count << endl;
      |         ^~~~
      |         count
a.cc:22:26: error: 'endl' was not declared in this scope
   22 |         cout << count << endl;
      |                          ^~~~
Language: C++

???#include <iostream>

using namespace std;

int main()
{
	unsigned int  n;
	cin >> n;
	unsigned int num, count = 0;
	for(int i = 0; i < n; i++)
	{
		cin >> num;
		for(int j = 2; j <=num; j++)
		{
			if(num == j)count++;
			if(num % j == 0)
			{
				break;
			}
		}
	}
	cout << count << endl;
	return 0;
}

Compiler output:
a.cc:1:4: error: stray '#' in program
    1 | ???#include <iostream>
      |    ^
a.cc:1:1: error: expected unqualified-id before '?' token
    1 | ???#include <iostream>
      | ^
a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope
    8 |         cin >> n;
      |         ^~~
a.cc:22:9: error: 'cout' was not declared in this scope; did you mean 'count'?
   22 |         cout << count << endl;
      |         ^~~~
      |         count
a.cc:22:26: error: 'endl' was not declared in this scope
   22 |         cout << count << endl;
      |                          ^~~~
Language: C++

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

using namespace std;

int main() {

	int n, count = 0;
	int a[9999] = { 0 };
	
	// ??¨???????????????????????????

	while (cin >> n){

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

		for (int i = 2; i < sqrt(n); i++) {
			if (a[i]) {
				for (int j = 0; i*(j + 2) <= n; j++) {
					a[i * (j + 2)] = 0;
				}
			}
		}

		for (int i = 2; i <= n; i++) {
			if (a[i] == 1)
				count++;
		}

		cout << count << endl;
		count = 0;
	}

	return 0;
}

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

#include<iostream>
#include<vector>
using namespace std;
#define MAX_N 100001
int main(){
	int n;
	while(cin >> n){
		vector<int> vec;
		vector<int>::iterator it =vec.begin();
		for(int i=2;i<=n;i++){
			int flag=0;
			it =vec.begin();
			while(it!= vec.end()){
				if(i% *it==0){
					flag=1;
					break;
				}
				it++;
			}
			if(!flag)vec.push_back(i);
		}
		it =vec.begin();
		//while(it!= vec.end()){
		//	cout<<*it<<endl;
		//	it++;
		//}
		cout << vec.size()<<endl;
	}

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

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstudio>
//ranker
using namespace std;

#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using psi = pair<string, int>;
using D = double;


const int Max=10000000;
bool prime[Max];
int main(void){
    int in;
    for(int i=0;i<Max;i++)prime[i]=true;
    prime[1]=false;
    for(int i=2;i<Max;i++){
        if(prime[i]){
            for(int s=i*2;s<=Max;s+=i)prime[s]=false;
        }
    }
    while(cin>>in){
        int cnt=0;
        for(int i=1;i<=in;i++){
            if(prime[i])cnt++;
        }
        cout << cnt << "\n";
    }
    return 0;
}

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

#include <iostream>
#include <string>
#include <array>

using namespace std;

int main(void){
  const int n = 1000000;
  bool* check_A = (bool*)malloc(sizeof(bool)*n);
  int*  num_A   = (int*)malloc(sizeof(int)*n);
  int N = 0, temp = 2;
  memset(check_A, true, n);
  check_A[0] = false;
  check_A[1] = false;
  num_A[0] = 0;
  num_A[1] = 0;
  for(int i = 0; i < n; i++){
    if(check_A[i]){
      for(;temp < i;temp++){
	num_A[temp] = N;
      }
      temp++;
      num_A[i] = ++N;
      for(int j = 2; i*j < n; j++){
	check_A[i*j] = false;
      }
    }
  }
  int s;
  while(cin >> s){
    cout << num_A[s] << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'memset' was not declared in this scope
   12 |   memset(check_A, true, n);
      |   ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <array>
  +++ |+#include <cstring>
    4 |
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main(void){
  const int n = 1000000;
  bool* check_A = (bool*)malloc(sizeof(bool)*n);
  int*  num_A   = (int*)malloc(sizeof(int)*n);
  int N = 0, temp = 2;
  memset(check_A, true, n);
  check_A[0] = false;
  check_A[1] = false;
  num_A[0] = 0;
  num_A[1] = 0;
  for(int i = 0; i < n; i++){
    if(check_A[i]){
      for(;temp < i;temp++){
	num_A[temp] = N;
      }
      temp++;
      num_A[i] = ++N;
      for(int j = 2; i*j < n; j++){
	check_A[i*j] = false;
      }
    }
  }
  int s;
  while(cin >> s){
    cout << num_A[s] << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'memset' was not declared in this scope
   11 |   memset(check_A, true, n);
      |   ^~~~~~
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 | #include <string>
Language: C++

#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

int main(void){
  const int n = 1000000;
  bool* check_A = (bool*)malloc(sizeof(bool)*n);
  int*  num_A   = (int*)malloc(sizeof(int)*n);
  int N = 0, temp = 2;
  memset(check_A, true, n);
  check_A[0] = false;
  check_A[1] = false;
  num_A[0] = 0;
  num_A[1] = 0;
  for(int i = 0; i < n; i++){
    if(check_A[i]){
      for(;temp < i;temp++){
	num_A[temp] = N;
      }
      temp++;
      num_A[i] = ++N;
      for(int j = 2; i*j < n; j++){
	check_A[i*j] = false;
      }
    }
  }
  int s;
  while(cin >> s){
    cout << num_A[s] << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'memset' was not declared in this scope
   12 |   memset(check_A, true, n);
      |   ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <cstdlib>
  +++ |+#include <cstring>
    4 |
Language: C++

def sieve_prime(n): # return prime numbers within [1, n]
  primes = []
  is_prime = [True] * (n+1) # [0, n]
  for i in range(2, n+1):
    if not is_prime[i]:
      continue # need only primes

    primes.append(i)
    for j in range(i*2, n+1, i): # range(i*2, n+1, i) = {i*2, i*3, ...}
      is_prime[j] = False

    """
    Compare the above code with the below one in the view of time complexity
    for j in range(i*2, n+1):
      if j % i == 0:
        is_prime[j] = False
    """
        
  return primes
      
while True:
  try:
    n = int(input())
    print(len(sieve_prime(n))) # because T <= 30, you can simply use sieve_prime every time
  except EOFError:
    break

Compiler output:
a.cc:1:21: error: stray '#' in program
    1 | def sieve_prime(n): # return prime numbers within [1, n]
      |                     ^
a.cc:3:29: error: stray '#' in program
    3 |   is_prime = [True] * (n+1) # [0, n]
      |                             ^
a.cc:6:16: error: stray '#' in program
    6 |       continue # need only primes
      |                ^
a.cc:9:34: error: stray '#' in program
    9 |     for j in range(i*2, n+1, i): # range(i*2, n+1, i) = {i*2, i*3, ...}
      |                                  ^
a.cc:12:7: warning: missing terminating " character
   12 |     """
      |       ^
a.cc:12:7: error: missing terminating " character
a.cc:17:7: warning: missing terminating " character
   17 |     """
      |       ^
a.cc:17:7: error: missing terminating " character
a.cc:24:32: error: stray '#' in program
   24 |     print(len(sieve_prime(n))) # because T <= 30, you can simply use sieve_prime every time
      |                                ^
a.cc:1:1: error: 'def' does not name a type
    1 | def sieve_prime(n): # return prime numbers within [1, n]
      | ^~~
a.cc:10:7: error: 'is_prime' does not name a type
   10 |       is_prime[j] = False
      |       ^~~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
using namespace std;

#define REP(i,f,n) for(int i=(f); i < (n); ++i)
#define PER(i,f,n) for(int i=(n-1); i >= f; --i)

//----------------------------------
//----------------------------------

constexpr int64_t CALCNUM = 2000000;

bool primes[CALCNUM];

signed main()
{
	for(int i = 0; i < CALCNUM; i++)
		primes[i] = true;
    ios::sync_with_stdio(false);
	vector<int> prime;

	for(int i = 2; i <CALCNUM ; i++)
	{
		if(primes[i])
		{
			prime.push_back(i);
			for(int j = 2 * i; j < CALCNUM; j += i)
				primes[j] = false;
		}
	}
	int n;
	while(cin >> n)
	{
		for(int i = 0; i < prime.size(); ++i)
			if(prime[i] > n){
				cout << i <<'\n'; break;

Compiler output:
a.cc: In function 'int main()':
a.cc:46:57: error: expected '}' at end of input
   46 |                                 cout << i <<'\n'; break;
      |                                                         ^
a.cc:45:41: note: to match this '{'
   45 |                         if(prime[i] > n){
      |                                         ^
a.cc:46:57: error: expected '}' at end of input
   46 |                                 cout << i <<'\n'; break;
      |                                                         ^
a.cc:43:9: note: to match this '{'
   43 |         {
      |         ^
a.cc:46:57: error: expected '}' at end of input
   46 |                                 cout << i <<'\n'; break;
      |                                                         ^
a.cc:26:1: note: to match this '{'
   26 | {
      | ^
Language: C++

#include <iostream>
using namespace std;
??
#define Max 1000000
??
int prime [10000000];
??
int main()
{
????????int n, out;
??
????????for (int i = 2; i * i < Max; i++){
????????????????if (prime[i] == 0){
????????????????????????for (int j = i; j < Max; j += i){
????????????????????????????????if (!(j == i)) prime[j] = 1;
????????????????????????}
????????????????}
????????}
??
????????while (cin >> n){
????????????????out = 0;
????????????????for (int i = 0; i <= n; i++){
????????????????????????if (prime[i] == 0) out++;
????????????????}
????????????????cout << out - 2 << endl;
????????}
????????return(0);
}

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

#include <iostream>
using namespace std;
??
#define Max 1000000
??
int prime [10000000];
	??
int main()
{
	????????int n, out;
	??
		????????for (int i = 2; i * i < Max; i++){
			????????????????if (prime[i] == 0){
				????????????????????????for (int j = i; j < Max; j += i){
					????????????????????????????????if (!(j == i)) prime[j] = 1;
					????????????????????????}
				????????????????}
			????????}
	??
		????????while (cin >> n){
			????????????????out = 0;
			????????????????for (int i = 0; i <= n; i++){
				????????????????????????if (prime[i] == 0) out++;
				????????????????}
			????????????????cout << out - 2 << endl;
			????????}
	????????return(0);
}

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

#include <iostream>
#include <cmath>
using namespace std;
int whether(int num);
int count(int num);
int main(){
    int n;
    while(cin >> n){
        cout << count(n)+1<<endl;
    }
    return 0;
}

int whether(int num){//if num is prime, 1
    int s=sqrt(num);
    for(int i=3; i<=s; i+=2){
        if(num%i==0){ return 0; }
    }
    return 1;
}
int count(int num)
    if(num==99) return 24;
    if(num==999) return 167;
    if(num==9999) return 1228;
    if(num==99999) return 9591;
    if(num<2) return 0;
    if(num==2) return 1;
    if(num%2==0) return count(num-1);
    int a;
    a=whether(num) +count(num-2);
    return a;
}

Compiler output:
a.cc:22:5: error: expected initializer before 'if'
   22 |     if(num==99) return 24;
      |     ^~
a.cc:23:5: error: expected unqualified-id before 'if'
   23 |     if(num==999) return 167;
      |     ^~
a.cc:24:5: error: expected unqualified-id before 'if'
   24 |     if(num==9999) return 1228;
      |     ^~
a.cc:25:5: error: expected unqualified-id before 'if'
   25 |     if(num==99999) return 9591;
      |     ^~
a.cc:26:5: error: expected unqualified-id before 'if'
   26 |     if(num<2) return 0;
      |     ^~
a.cc:27:5: error: expected unqualified-id before 'if'
   27 |     if(num==2) return 1;
      |     ^~
a.cc:28:5: error: expected unqualified-id before 'if'
   28 |     if(num%2==0) return count(num-1);
      |     ^~
a.cc:30:5: error: 'a' does not name a type
   30 |     a=whether(num) +count(num-2);
      |     ^
a.cc:31:5: error: expected unqualified-id before 'return'
   31 |     return a;
      |     ^~~~~~
a.cc:32:1: error: expected declaration before '}' token
   32 | }
      | ^
Language: C++

import sys


def prime(x):
    for i in p_list:
        if x % i == 0:
            return 0
    return 1


if __name__ == "__main__":
    a = 10000
    i = 2
    p_list = []
    while i < a:
        if prime(i):
            p_list.append(i)
        i += 1
    print(p_list)

    for i in sys.stdin:
        n = int(i)
        while 1:
            if n not in p_list:
                n -= 1
            else:
                print(p_list.index(n) + 1)

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

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

typedef int TInt;
typedef std::vector<TInt> TList;
bool IsPrime(TInt Value, const TList& Prime)
{
    TInt Max = std::sqrt(Value);
    for(TList::const_iterator It = Prime.begin();
        It != Prime.end() && *It <= Max;
        ++It)
    {
        if(Value % (*It) == 0) return false;
    }
    return true;
}
TList GetPrimeList(TInt Max)
{
    TList Prime;
    Prime.reserve(Max);
    Prime.push_back(2);
    for(TInt i = 3; i <= Max; i += 2){
        if(IsPrime(i, Prime)){
            Prime.push_back(i);
        }
    }
    return Prime;
}
int main()
{
    TList List = GetPrimeList(999999);
    while(true){
        int n;
        std::cin >> n;
        if(std::cin.eof()) break;
        TList::iterator It = std::upper_bound(List.begin(), List.end(), n);
        std::cout << std::distance(List.begin(), It) << std::endl;
        
    }
    return 0;
}

Compiler output:
a.cc: In function 'bool IsPrime(TInt, const TList&)':
a.cc:9:21: error: 'sqrt' is not a member of 'std'; did you mean 'sort'?
    9 |     TInt Max = std::sqrt(Value);
      |                     ^~~~
      |                     sort