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

<?php
$max=1000000;
$maxR=floor(sqrt($max));

$ch=[0,0,1,1];

for($i=4;$i<$max;$i+=2){$ch[]=0;$ch[]=1;}

for($i=3;$i<$maxR;$i+=2) if($ch[$i]) for($j=$i+$i;$j<$max;$j+=$i) $ch[$j]=0;

for($i=3;$i<$max;$i++) $ch[$i]+=$ch[$i-1];

while(fscanf(STDIN,"%d",$n)) printf("%d\n",$ch[$n]);

Compiler output:
a.cc:1:1: error: expected unqualified-id before '<' token
    1 | <?php
      | ^
a.cc:3:1: error: '$maxR' does not name a type
    3 | $maxR=floor(sqrt($max));
      | ^~~~~
a.cc:5:1: error: '$ch' does not name a type
    5 | $ch=[0,0,1,1];
      | ^~~
a.cc:7:1: error: expected unqualified-id before 'for'
    7 | for($i=4;$i<$max;$i+=2){$ch[]=0;$ch[]=1;}
      | ^~~
a.cc:7:10: error: '$i' does not name a type
    7 | for($i=4;$i<$max;$i+=2){$ch[]=0;$ch[]=1;}
      |          ^~
a.cc:7:18: error: '$i' does not name a type
    7 | for($i=4;$i<$max;$i+=2){$ch[]=0;$ch[]=1;}
      |                  ^~
a.cc:9:1: error: expected unqualified-id before 'for'
    9 | for($i=3;$i<$maxR;$i+=2) if($ch[$i]) for($j=$i+$i;$j<$max;$j+=$i) $ch[$j]=0;
      | ^~~
a.cc:9:10: error: '$i' does not name a type
    9 | for($i=3;$i<$maxR;$i+=2) if($ch[$i]) for($j=$i+$i;$j<$max;$j+=$i) $ch[$j]=0;
      |          ^~
a.cc:9:19: error: '$i' does not name a type
    9 | for($i=3;$i<$maxR;$i+=2) if($ch[$i]) for($j=$i+$i;$j<$max;$j+=$i) $ch[$j]=0;
      |                   ^~
a.cc:9:51: error: '$j' does not name a type
    9 | for($i=3;$i<$maxR;$i+=2) if($ch[$i]) for($j=$i+$i;$j<$max;$j+=$i) $ch[$j]=0;
      |                                                   ^~
a.cc:9:59: error: '$j' does not name a type
    9 | for($i=3;$i<$maxR;$i+=2) if($ch[$i]) for($j=$i+$i;$j<$max;$j+=$i) $ch[$j]=0;
      |                                                           ^~
a.cc:11:1: error: expected unqualified-id before 'for'
   11 | for($i=3;$i<$max;$i++) $ch[$i]+=$ch[$i-1];
      | ^~~
a.cc:11:10: error: '$i' does not name a type
   11 | for($i=3;$i<$max;$i++) $ch[$i]+=$ch[$i-1];
      |          ^~
a.cc:11:18: error: '$i' does not name a type
   11 | for($i=3;$i<$max;$i++) $ch[$i]+=$ch[$i-1];
      |                  ^~
a.cc:13:1: error: expected unqualified-id before 'while'
   13 | while(fscanf(STDIN,"%d",$n)) printf("%d\n",$ch[$n]);
      | ^~~~~
Language: C++

<?php
$max=1000000;
$maxR=floor(sqrt($max));

$ch=[0,0,1,1];

for($i=4;$i<$max;$i+=2){
  $ch[]=0;$ch[]=1;
}

for($i=3;$i<$maxR;$i+=2){
  if($ch[$i]){
    for($j=$i+$i;$j<$max;$j+=$i){
      $ch[$j]=0;
    }
  }
}

for($i=3;$i<$max;$i++){
  $ch[$i]+=$ch[$i-1];
}

while(fscanf(STDIN,"%d",$n)){
  printf("%d\n",$ch[$n]);
}

Compiler output:
a.cc:1:1: error: expected unqualified-id before '<' token
    1 | <?php
      | ^
a.cc:3:1: error: '$maxR' does not name a type
    3 | $maxR=floor(sqrt($max));
      | ^~~~~
a.cc:5:1: error: '$ch' does not name a type
    5 | $ch=[0,0,1,1];
      | ^~~
a.cc:7:1: error: expected unqualified-id before 'for'
    7 | for($i=4;$i<$max;$i+=2){
      | ^~~
a.cc:7:10: error: '$i' does not name a type
    7 | for($i=4;$i<$max;$i+=2){
      |          ^~
a.cc:7:18: error: '$i' does not name a type
    7 | for($i=4;$i<$max;$i+=2){
      |                  ^~
a.cc:11:1: error: expected unqualified-id before 'for'
   11 | for($i=3;$i<$maxR;$i+=2){
      | ^~~
a.cc:11:10: error: '$i' does not name a type
   11 | for($i=3;$i<$maxR;$i+=2){
      |          ^~
a.cc:11:19: error: '$i' does not name a type
   11 | for($i=3;$i<$maxR;$i+=2){
      |                   ^~
a.cc:19:1: error: expected unqualified-id before 'for'
   19 | for($i=3;$i<$max;$i++){
      | ^~~
a.cc:19:10: error: '$i' does not name a type
   19 | for($i=3;$i<$max;$i++){
      |          ^~
a.cc:19:18: error: '$i' does not name a type
   19 | for($i=3;$i<$max;$i++){
      |                  ^~
a.cc:23:1: error: expected unqualified-id before 'while'
   23 | while(fscanf(STDIN,"%d",$n)){
      | ^~~~~
Language: C++

#include <iostream>
int main(){
    int i,j,ch[1000000];

    for(i=0;i<1000000;i+=2){ch[i]=0;ch[i+1]=1;}

    ch[1]=0;
    ch[2]=1;

    for(i=3;i<1000;i+=2) if(ch[i]) for(j=i<<1;j<1000000;j+=i) ch[j]=0;

    for(i=3;i<1000000;i++) ch[i]+=ch[i-1];

    while(cin>>i) cout<<ch[i]<<endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:11: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   14 |     while(cin>>i) cout<<ch[i]<<endl;
      |           ^~~
      |           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:14:19: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   14 |     while(cin>>i) cout<<ch[i]<<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:14:32: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   14 |     while(cin>>i) cout<<ch[i]<<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 _USE_MATH_DEFINES
#include <math.h>
#define MAX_N 100000

void q9() {
	bool IsPrime[MAX_N];
	memset(IsPrime, 1, sizeof(IsPrime));
	IsPrime[0] = false;
	IsPrime[1] = false;
	for (int i = 0; i < sqrt(MAX_N); i++) {
		if (!IsPrime[i]) continue;
		for (int j = i * 2; j < MAX_N; j += i) {
			IsPrime[j] = false;
		}
	}

	int NofP[MAX_N];
	NofP[0] = 0;
	for (int i = 1; i < MAX_N; i++) {
		NofP[i] = NofP[i - 1] + IsPrime[i];
	}

	int n;
	for (; cin >> n;) {
		cout << NofP[n] << endl;
	}
}

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

Compiler output:
a.cc: In function 'void q9()':
a.cc:8:9: error: 'memset' was not declared in this scope
    8 |         memset(IsPrime, 1, sizeof(IsPrime));
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <math.h>
  +++ |+#include <cstring>
    4 | #define MAX_N 100000
a.cc:25:16: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   25 |         for (; 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:26:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   26 |                 cout << NofP[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:26:36: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   26 |                 cout << NofP[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>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#define MAX_N 100000

void q9() {
	bool IsPrime[MAX_N];
	memset(IsPrime, 1, sizeof(IsPrime));
	IsPrime[0] = false;
	IsPrime[1] = false;
	for (int i = 0; i < sqrt(MAX_N); i++) {
		if (!IsPrime[i]) continue;
		for (int j = i * 2; j < MAX_N; j += i) {
			IsPrime[j] = false;
		}
	}

	int NofP[MAX_N];
	NofP[0] = 0;
	for (int i = 1; i < MAX_N; i++) {
		NofP[i] = NofP[i - 1] + IsPrime[i];
	}

	int n;
	for (; cin >> n;) {
		cout << NofP[n] << endl;
	}
}

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

Compiler output:
a.cc: In function 'void q9()':
a.cc:26:16: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   26 |         for (; 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:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   27 |                 cout << NofP[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:36: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   27 |                 cout << NofP[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++

import sys
import math as mas

def sieve(n):
	p=[True for i in range(n+1)]
	p[0]=p[1]=False
	end=int(n**0.5)
	for i in range(2,end+1):
		if p[i]:
			for j in range(i*i,n+1,i):
				p[j]=False
	return p
	
sosu=sieve(1000010)
for i in sys.stdin:
	t=int(i)
	if t<2:print(0)
	elif t==2:print(1)
	else:print(1+sum(sosu[t] for t in range(3,int(i)+1,2)))

#	a,b=map(int,i.split())
#	print(gcd(a,b),lcm(a,b))

Compiler output:
a.cc:21:9: error: invalid preprocessing directive #a
   21 | #       a,b=map(int,i.split())
      |         ^
a.cc:22:9: error: invalid preprocessing directive #print
   22 | #       print(gcd(a,b),lcm(a,b))
      |         ^~~~~
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 <cmath>

int prime[1000000];


bool isPrime(int n) {
  int x = sqrt(static_cast<double>n);
  for (int i = 3; i <= x; i += 2) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}


void get_prime(int max_num) {
  int primecount = 1;
  prime[2] = primecount;
  for (int i = 3; i <= max_num; i += 2) {
    if (isPrime(i))
      prime[i] = ++primecount;
    else
      prime[i] = primecount;
  }
}


int main () {
  int ns[31];
  int i = 0, max_num;
  while (std::cin >> ns[i]) {
    max_num = std::max(max_num, ns[i]);
    if (ns[i] % 2 == 0)
      ns[i] --;
    i ++;
  }
  get_prime(max_num);
  for (int j = 0; j < i; j ++) {
    std::cout << prime[ns[j]] << std::endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'bool isPrime(int)':
a.cc:8:35: error: expected '(' before 'n'
    8 |   int x = sqrt(static_cast<double>n);
      |                                   ^
      |                                   (
a.cc:8:37: error: expected ')' before ';' token
    8 |   int x = sqrt(static_cast<double>n);
      |               ~                     ^
      |                                     )
Language: C++

#include <stdio.h>
int main()
{
    int low, high, i, flag,c=0,s;
    while(scanf("%d",&high)==!EOF)
       {
           int start = 2;

            while (start <= high)
            {
                flag = 0;
                s = sqrt(start);


                    for(i = 2; i <= start/2; i++)
                    {

                        if(start % i == 0)
                        {
                            flag = 1;
                            break;
                        }
                    }

                    if (flag == 0)
                    {
                          c++;

                    }
                    start++;

            }
                printf("%d\n",c); c=0;



       }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:21: error: 'sqrt' was not declared in this scope
   12 |                 s = sqrt(start);
      |                     ^~~~
Language: C++

#include<bits/stdc++.h>
int main()
{
    long long int low, high, i, flag,c, s ;
    while(scanf("%lld",  &high)!=EOF){
    long long int start = 2;

    c = 0;


    while (start <= high)
    {
        flag = 0;
        s = sqrt(start);
        for(i = 2; i <= s; i++)
        {
            if(start% i == 0)
            {
                flag = 1;
                break;
            }
        }

        if (flag == 0)
        {
              c++;
        }
        start++;

    }
    printf("%lld\n",c);

    }

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

#include<iostream>
using namespace std;
int main(int argv,int* argv[]){
unsigned x[30];
int count=0;
for(int i=0;i<argv;i++){
cin>>x[i];
}
for(int i=0;i<argv;i++){
for(int j=1;j<x[i];j++){
if(x[i]%j!=0)
count++;
}
cout<<count<<endl;
count=0;
}
return 0;
}

Compiler output:
a.cc:3:24: error: conflicting declaration 'int** argv'
    3 | int main(int argv,int* argv[]){
      |                   ~~~~~^~~~~~
a.cc:3:14: note: previous declaration as 'int argv'
    3 | int main(int argv,int* argv[]){
      |          ~~~~^~~~
Language: C++

#include<iostream>
using namespace std;
int main(int argv,char* argv[]){
unsigned x[30];
int count=0;
for(int i=0;i<argv;I++){
cin>>x[i];
}
for(int i=0;i<argv;i++){
for(int j=1;j<x[i];j++){
if(x[i]%j!=0)
count++;
}
cout<<count<<endl;
count=0;
}
return 0;
}

Compiler output:
a.cc:3:25: error: conflicting declaration 'char** argv'
    3 | int main(int argv,char* argv[]){
      |                   ~~~~~~^~~~~~
a.cc:3:14: note: previous declaration as 'int argv'
    3 | int main(int argv,char* argv[]){
      |          ~~~~^~~~
a.cc: In function 'int main(...)':
a.cc:6:20: error: 'I' was not declared in this scope
    6 | for(int i=0;i<argv;I++){
      |                    ^
Language: C++

#include<iostream>
using namespace std;
int main(int argc,char* argv[]){
unsigned x[30];
int count=0;
for(int i=0;i<argc;I++){
cin>>x[i];
}
for(int i=0;i<argc(i++){
for(int j=1;j<x[i];j++){
if(x[i]%j!=0)
count++;
}
cout<<count<<endl;
count=0;
}
return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:6:20: error: 'I' was not declared in this scope
    6 | for(int i=0;i<argc;I++){
      |                    ^
a.cc:9:19: error: 'argc' cannot be used as a function
    9 | for(int i=0;i<argc(i++){
      |               ~~~~^~~~~
a.cc:9:24: error: expected ';' before '{' token
    9 | for(int i=0;i<argc(i++){
      |                        ^
      |                        ;
a.cc:9:24: error: expected primary-expression before '{' token
a.cc:9:24: error: expected ')' before '{' token
    9 | for(int i=0;i<argc(i++){
      |    ~                   ^
      |                        )
Language: C++

#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
 
int main(void){
int unti[1000002] = {0};
fill(unti,unti + 1000001;n++)
{
if(unti[n] == 0)
{
for(int a = 2;(a * n) < 1000001;a++)
{
    if((a * n  ) < 1000001 ) unti[a * n]++;
}
}
}
int b;
for(int i;i <= 31;i++){
cin >> b

int cnt = (count(unti,unti+b+1,0) - 2);
cout << cnt << endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:25: error: expected ')' before ';' token
    8 | fill(unti,unti + 1000001;n++)
      |     ~                   ^
      |                         )
a.cc:8:26: error: 'n' was not declared in this scope
    8 | fill(unti,unti + 1000001;n++)
      |                          ^
a.cc:20:9: error: expected ';' before 'int'
   20 | cin >> b
      |         ^
      |         ;
   21 | 
   22 | int cnt = (count(unti,unti+b+1,0) - 2);
      | ~~~      
a.cc:23:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
   23 | cout << cnt << endl;
      |         ^~~
      |         int
Language: C++

#include<iostream>
#include<stdio.h>
#include<windows.h>
#include<conio.h>
#include<String>
#include<time.h>
#include<math.h>

using namespace std;

int main() {

	int c = 0;
	int i = 1;
	unsigned long long a = 0;
	unsigned long long b = 0;
	unsigned long long sosuu[100000] = { 0 };
	char fire = 0;
	int pattara = 0;
	cin >> c;
	cout << 2;
	/*while(i>-1)*/for(int i=0;i<c;i++){
		/*for (int z = 0; z < a;z++){*/
		for (int q = 1; q <= sqrt(i); q++) {
			sosuu[pattara] = i;
			if (sosuu[pattara] % 2 == 0) {
				break;
			}
			if (sosuu[pattara] % q == 0) {
				b += 1;
			}

		}

		/*if (b == 1) {
			fire = _getch();
			pattara++;
			cout << sosuu[pattara - 1] << " " << pattara << endl;

		}*/
		b = 0;
		/*i++;*/
		if (pattara == c){
			break;
		}
	}
	cout << pattara << endl;


	/*system("pause");
	return 0;*/
}

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

#include<iostream>
#include<vector>

using namespace std;

#define MAX 1000000

int main(void){

  int n;
  cin >> n;
  int num = 0;

  vector<long int> array(MAX,0);

  array[0] = 2; count++;
  array[1] = 3; count++;

  for(int i = 5 i < n ; i+=2){
    int flag = 0;
    for(int j = 0; array[j]*array[j] <= n;j++){
      if(n % array[i] == 0){
        flag = 1;
        break;
      }
    }
    if(!flag){
      count++;
    }

  }

  cout << count << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: 'count' was not declared in this scope
   16 |   array[0] = 2; count++;
      |                 ^~~~~
a.cc:19:16: error: expected ';' before 'i'
   19 |   for(int i = 5 i < n ; i+=2){
      |                ^~
      |                ;
Language: C++

import math

def isPrime(n):
	if n==1: return False
	if n==2: return True
	for i in range(2,int(math.sqrt(n))+2):
		if n%i==0: return False
	return True

while True:
	a = input()
	if a=='EOF': break
	sum = 0
	for i in range(1,a+1):
		if isPrime(i)==True:
			sum+=1
	print sum

Compiler output:
a.cc:12:15: warning: multi-character character constant [-Wmultichar]
   12 |         if a=='EOF': break
      |               ^~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import math
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#coding:utf-8
import time
import math
import numpy as np

def flatten(L):
    if isinstance(L, list):
        if L == []:
            return []
        else:
            return flatten(L[0]) + flatten(L[1:])
    else:
        return [L]

def Eratos(data):

    p_list = [] # ????????????
    tmp = []
    num = int(math.sqrt(len(data)))+1
    for i in data:
        i=data[0]
        if i>num:
            break
        else:
            p_list.append(i)
            for j in data:
                if j%i == 0:
                    data.remove(j)
        
    p_list.append(data)
    return p_list

x = int(input())

r_list = list(range(2,(x+1)))
ans = []
ans = Eratos(r_list)

print("prime numbers is ")

print(len(flatten(ans)))

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #coding
    1 | #coding:utf-8
      |  ^~~~~~
a.cc:17:17: error: stray '#' in program
   17 |     p_list = [] # ????????????
      |                 ^
a.cc:2:1: error: 'import' does not name a type
    2 | import time
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<iostream>
#include<stdio.h>
#include<windows.h>
#include<conio.h>
#include<String>
#include<time.h>
#include<math.h>

using namespace std;
int c = 0;
int i = 1;
unsigned long long a = 0;
unsigned long long b = 0;
unsigned long long sosuu[100000] = { 0 };
char fire = 0;
int pattara = 0;

int sub(int c) {

	
	
	/*while(i>-1)*/
	for (int i = 2; i<=c; i++){
		/*for (int z = 0; z < a;z++){*/
		for (int q = 1; q <= sqrt(i); q++) {
			sosuu[pattara] = i;
			if (sosuu[pattara] % 2 == 0 && sosuu[pattara]!= 2) {
				break;
			}
			if (sosuu[pattara] % q == 0) {
				b += 1;
			}

		}

		if (b == 1) {
			/*fire = _getch();*/
			pattara++;
			
		}
		b = 0;
		/*i++;*/
	}

	
	return 0;
}


int main(){
	while (scanf("%d", &c) != EOF){

		sub(c);
		cout << pattara << endl;
		pattara = 0;
	}


}

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

#include<iostream>
#include<stdio.h>
#include<windows.h>
#include<conio.h>
#include<String>
#include<time.h>
#include<math.h>

using namespace std;
int c = 0;
int i = 1;
unsigned long long a = 0;
unsigned long long b = 0;
unsigned long long sosuu[100000] = { 0 };
char fire = 0;
int pattara = 0;

int sub(int c) {

	
	
	/*while(i>-1)*/
	for (int i = 2; i<=c; i++){
		/*for (int z = 0; z < a;z++){*/
		for (int q = 1; q <= sqrt(i); q++) {
			sosuu[pattara] = i;
			if (sosuu[pattara] % 2 == 0 && sosuu[pattara]!= 2) {
				break;
			}
			if (sosuu[pattara] % q == 0) {
				b += 1;
			}

		}

		if (b == 1) {
			/*fire = _getch();*/
			pattara++;
			
		}
		b = 0;
		/*i++;*/
	}

	
	return 0;
}


int main(){
	while (scanf("%d", &c) != EOF){

		sub(c);
		cout << pattara << endl;
		pattara = 0;
		
	}

	return 0;
}

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

#include<iostream>
#include<stdio.h>
#include<windows.h>
#include<conio.h>
#include<String>
#include<time.h>
#include<math.h>

using namespace std;
int c = 0;
int i = 1;
unsigned long long a = 0;
unsigned long long b = 0;
unsigned long long sosuu[100000] = { 0 };
char fire = 0;
int pattara = 0;

int sub(int c) {

	
	
	
	for (int i = 2; i<=c; i++){
		
		for (int q = 1; q <= sqrt(i); q++) {
			sosuu[pattara] = i;
			if (sosuu[pattara] % 2 == 0 && sosuu[pattara]!= 2) {
				break;
			}
			if (sosuu[pattara] % q == 0) {
				b += 1;
			}

		}

		if (b == 1) {
			
			pattara++;
			
		}
		b = 0;
		
	}

	
	return 0;
}


int main(){
	while (scanf("%d", &c) != EOF){

		sub(c);
		cout << pattara << endl;
		pattara = 0;
		
	}

	return 0;
}

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

#include<stdio.h>
int main(void)
{
    int n,i,j,z,x;
	
    scanf("%d",&n);
	for(n!=1){
		for(i=2;i<=n;i++){
			z=0;
			for(j=2;j<=i;j++){
				if(i%j==0 && i!=j){
					z++;
					break;
				}
			}
			if(z==0){
				x++;
			}
		}
		printf("%d\n",x);
		scanf("%d",&n);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:17: error: expected ';' before ')' token
    7 |         for(n!=1){
      |                 ^
      |                 ;
a.cc:23:9: error: expected primary-expression before 'return'
   23 |         return 0;
      |         ^~~~~~
a.cc:22:10: error: expected ';' before 'return'
   22 |         }
      |          ^
      |          ;
   23 |         return 0;
      |         ~~~~~~
a.cc:23:9: error: expected primary-expression before 'return'
   23 |         return 0;
      |         ^~~~~~
a.cc:22:10: error: expected ')' before 'return'
   22 |         }
      |          ^
      |          )
   23 |         return 0;
      |         ~~~~~~
a.cc:7:12: note: to match this '('
    7 |         for(n!=1){
      |            ^
Language: C++

#include<iostream>
using namespace std;

int main()
{
	bool is_prime[100000]:
	
	is_prime[0]=is_prime[1]=false;
	for(int i=2;i<1000000;i<i++){
		is_prime[i]=true;
	}
	
	for(int i=2;i*i<1000000;i++){
		if(is_prime[i]){
			for(int j=i*i;j<1000000;j+=i){
				is_primej]=false;
			}
		}
	}
	
	int n_prime[1000000];
	
	int cnt=0;
	for(int i=0;i<1000000;i++){
		if(is_prime[i]){
			cnt++;
		}
		
		n_prime[i]=cnt;
	}
	
	while(true){
		int n;
		cin>>n;
		if(cin.eof())
			break;
		
		cout<<n_prime[n]<<endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:30: error: expected initializer before ':' token
    6 |         bool is_prime[100000]:
      |                              ^
a.cc:10:17: error: 'is_prime' was not declared in this scope
   10 |                 is_prime[i]=true;
      |                 ^~~~~~~~
a.cc:14:20: error: 'is_prime' was not declared in this scope
   14 |                 if(is_prime[i]){
      |                    ^~~~~~~~
a.cc:16:33: error: 'is_primej' was not declared in this scope
   16 |                                 is_primej]=false;
      |                                 ^~~~~~~~~
a.cc:25:20: error: 'is_prime' was not declared in this scope; did you mean 'n_prime'?
   25 |                 if(is_prime[i]){
      |                    ^~~~~~~~
      |                    n_prime
Language: C++

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

static const long MAX = 1000000L;
 
int main() {
    vector<long> prime;
    bool isPrime;
    long n;
 
    long i, len = sqrt(MAX) + 1;
    long j, lenJ;
    long k;
     
    prime.push_back(2);

    for (i = 3; i <= len; i += 2) {
        isPrime = true;
        lenJ = prime.size();
        k = sqrt(i) + 1;
        for (j = 0; j < lenJ; j++) {
            if (k <= prime[j]) break;

            if (i % prime[j] == 0) {
                isPrime = false;

                break;
            }

        if (isPrime) prime.push_back(i);
    }

    lenJ = prime.size();
     
    while (cin >> n) {
        counter = 1;

        if (n < 2) counter = 0;
         
        for (i = 3; i <= n; i += 2) {
            isPrime = true;

            k = sqrt(i) + 1;
            for (j = 0; j < lenJ; j++) {
                if (k <= prime[j]) break;

                if (i % prime[j] == 0) {
                    isPrime = false;

                    break;
                }
            }

            if (isPrime) counter++;
        }
         
        cout << counter << endl;
    }
 
    return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:8:5: error: 'vector' was not declared in this scope
    8 |     vector<long> prime;
      |     ^~~~~~
a.cc:8:12: error: expected primary-expression before 'long'
    8 |     vector<long> prime;
      |            ^~~~
a.cc:12:19: error: 'sqrt' was not declared in this scope
   12 |     long i, len = sqrt(MAX) + 1;
      |                   ^~~~
a.cc:16:5: error: 'prime' was not declared in this scope; did you mean 'isPrime'?
   16 |     prime.push_back(2);
      |     ^~~~~
      |     isPrime
a.cc:36:12: error: 'cin' was not declared in this scope
   36 |     while (cin >> n) {
      |            ^~~
a.cc:37:9: error: 'counter' was not declared in this scope
   37 |         counter = 1;
      |         ^~~~~~~
a.cc:58:9: error: 'cout' was not declared in this scope
   58 |         cout << counter << endl;
      |         ^~~~
a.cc:58:28: error: 'endl' was not declared in this scope
   58 |         cout << counter << endl;
      |                            ^~~~
a.cc:62:2: error: expected '}' at end of input
   62 | }
      |  ^
a.cc:7:12: note: to match this '{'
    7 | int main() {
      |            ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
	int n,S;
while(cin>>n)
{
	S=0;
	if(n==1)
	{
		cout<<0<<endl;
	}
	else if(n>=2)
	{
		S++;
	}
	else if
	{
	for(int i=2;i<=n;i++)
	{
		for(int j=i-1;j>1;j--)
		{
			if(i%j==0)
			{
				break;
			}
			if(j==2)
		{
			S++;
		}
		}	
			
	}

	cout<<S<<endl;
}
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: expected '(' before '{' token
   18 |         {
      |         ^
      |         (
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:5:17: error: expected ';' before 'for'
    5 |         cin >> N
      |                 ^
      |                 ;
    6 |         for(int x=2;x<=N;x++){
      |         ~~~      
a.cc:6:21: error: 'x' was not declared in this scope
    6 |         for(int x=2;x<=N;x++){
      |                     ^
Language: C++

#include<iostream>
using namespace std;
int main(k<30){
	int N,count=0,k;
	while(){
		cin >> N;
		count = 0;
		if(N<0)	break;
	for(int x=2;x<=N;x++){
		int flag = 0;
		for(int y=2;y<x;y++){
			if((x%y)==0)	flag = 1;
		}
		if(flag == 0)	count++;
	}
	cout << count << endl;
		k++;
	}
	return 0;
}

Compiler output:
a.cc:3:5: error: cannot declare '::main' to be a global variable
    3 | int main(k<30){
      |     ^~~~
a.cc:3:10: error: 'k' was not declared in this scope
    3 | int main(k<30){
      |          ^
Language: C++

#include<iostream>
using namespace std;
int main(){
	long long int N,count[1000000];
		count[1] = 1;
		if(N<0)	break;
	for(int x=2;x<=1000000;x++){
		int flag = 0;
		for(int y=2;y<x;y++){
			if((x%y)==0)	flag = 1;
		}
		if(flag == 0)	count[i] = count[i-1]+1;
	}
	while(cin >> N){
		cout << count[N] << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:25: error: break statement not within loop or switch
    6 |                 if(N<0) break;
      |                         ^~~~~
a.cc:12:39: error: 'i' was not declared in this scope
   12 |                 if(flag == 0)   count[i] = count[i-1]+1;
      |                                       ^
Language: C++

#include<iostream>
using namespace std;
int main(){
	long long int N,count[1000000];
		count[1] = 1;
	for(int x=2;x<=1000000;x++){
		int flag = 0;
		for(int y=2;y<x;y++){
			if((x%y)==0)	flag = 1;
		}
		if(flag == 0)	count[i] = count[i-1]+1;
	}
	while(cin >> N){
		cout << count[N] << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:39: error: 'i' was not declared in this scope
   11 |                 if(flag == 0)   count[i] = count[i-1]+1;
      |                                       ^
Language: C++

import math

def check_prime(goal):
    true_or_false=False
    for i in range(2,int(math.sqrt(goal))+1):
        if goal%i==0:
             true_or_false=True
    if true_or_false==False:
        return True
    else:
        return False
anss=[]
while True:
    try:
        num=int(input())
        num_of_prime=0
        for i in range(2,num+1):
           if check_prime(i):
               num_of_prime+=1
        anss.append(num_of_prime)
    except:
        break

for ans in anss:
    print(ans)

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

#include<iostream>
using namespace std;

int Era(int N) {
	int prime_num = 0;
	int* array = new int[N + 1];
	for (int i = 2; i < N + 1; i++) {
		array[i] = 1;
	}
	for (int i = 2; i <= sqrt(N); i++) {
		if (array[i]) {
			for (int j = 0; i*(j + 2) <= N; j++) {
				array[i*(j + 2)] = 0;
			}
		}
	}
	for (int i = 2; i < N + 1; i++) {
		if (array[i])prime_num++;
	}
	return prime_num;
}

int main() {
	int num;
	while (cin >> num) {
		cout << Era(num) << endl;
	}
	return 0;
}

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

#include<iostream>
using namespace std;

int Era(int N) {
	int prime_num = 0;
	int* array = new int[N + 1];
	for (int i = 2; i < N + 1; i++) {
		array[i] = 1;
	}
	for (int i = 2; i < sqrt(N); i++) {
		if (array[i]) {
			for (int j = 0; i*(j + 2) <= N; j++) {
				array[i*(j + 2)] = 0;
			}
		}
	}
	for (int i = 2; i < N + 1; i++) {
		if (array[i])prime_num++;
	}
	return prime_num;
}

int main() {
	int num;
	while (cin >> num) {
		cout << Era(num) << endl;
	}
	return 0;
}

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

#include <iostream>

const bool isPrime(const int p)
{
    if(p == 2)
    {
        return true;
    }

    if(p < 2 || p % 2 == 0)
    {
        return false;
    }

    for(int i = 3; i <= sqrt(p); i += 2)
    {
        if(p % i == 0)
        {
            return false;
        }
    }

    return true;
}

int main(void)
{
    bool p[1000000];

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

    int n;

    while(std::cin >> n)
    {
        int result = 0;

        for(int i = 0; i <= n; ++i)
        {
            result += p[i];
        }

        std::cout << result << std::endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'const bool isPrime(int)':
a.cc:15:25: error: 'sqrt' was not declared in this scope
   15 |     for(int i = 3; i <= sqrt(p); i += 2)
      |                         ^~~~
Language: C++

#include<stdio.h>
int main(void){
   int s[10000], l, m, n, i, sum;
   sum = 0;
   for ( i = 1; i <= 1000000; i++ ) {
      s[i] = 0;
   }
   for ( k = 2; k <= 1000000; k++ ){
      if (s[k] == 0) {
         for ( l = 2; l <= 100000 / k; l++ ) {
            s[k * l] = 1;
         }
      }
   }
   while(scanf("%d", &n) != EOF){
      for(i = 1; i <= n; i++){
         if(s[i] == 0){
            sum++;
         }
      }
   }
   printf("%d", sum);
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: 'k' was not declared in this scope
    8 |    for ( k = 2; k <= 1000000; k++ ){
      |          ^
Language: C++

#include <iostream>
#include <cmath>
#include <time.h>     // for clock()
using namespace std;

/*
1???2 ?????? n ?????§?????´??°???????????????
2??????????????£???????????°????????§???????°?????????????????????? p ??¨?????????????????????????????????????????°?????? p ??¨?????????
p ??\?????? p ????????°?????¨????¶????????????????
3???2??????????????°?????????????????????p ??? ???n ????¶??????????????????????????????????????????£?????????????´???°???
*/
// ??¨????????????????????????
int SieveOfEratosthenes(int num) {
	
	if (num < 2) {
		return 0;
	}
	// num???????´???°?????°
	int count = 0;
	bool fl[1000001];
	memset(fl, true, sizeof(fl));
	for (int i = 2; i <= sqrt(num); i++) {
		if (fl[i]) {
			for (int j = 2; j*i <= num; j++) {
				fl[i*j] = false;
			}
		}
	}
	for (int i = 2; i <= num; i++) {
		if (fl[i]) {
			count++;
		}
	}
	return count;
}

int main() {

	int num = 0;
	while (cin >> num) {
		//clock_t start = clock();    // ??????????????????
		cout << SieveOfEratosthenes(num) << endl;
		//clock_t end = clock();     // ????????????
		//std::cout << "duration = " << (double)(end - start) / CLOCKS_PER_SEC << "sec.\n";
	}
	return 0;
}

Compiler output:
a.cc: In function 'int SieveOfEratosthenes(int)':
a.cc:21:9: error: 'memset' was not declared in this scope
   21 |         memset(fl, true, sizeof(fl));
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <cmath>
  +++ |+#include <cstring>
    3 | #include <time.h>     // for clock()
Language: C++

#include <iostream>
#include <cmath>
#include <cstdio>
#include <time.h>     // for clock()
using namespace std;

/*
1???2 ?????? n ?????§?????´??°???????????????
2??????????????£???????????°????????§???????°?????????????????????? p ??¨?????????????????????????????????????????°?????? p ??¨?????????
p ??\?????? p ????????°?????¨????¶????????????????
3???2??????????????°?????????????????????p ??? ???n ????¶??????????????????????????????????????????£?????????????´???°???
*/
// ??¨????????????????????????
int SieveOfEratosthenes(int num) {
	
	if (num < 2) {
		return 0;
	}
	// num???????´???°?????°
	int count = 0;
	bool fl[1000001];
	memset(fl, true, sizeof(fl));
	for (int i = 2; i <= sqrt(num); i++) {
		if (fl[i]) {
			for (int j = 2; j*i <= num; j++) {
				fl[i*j] = false;
			}
		}
	}
	for (int i = 2; i <= num; i++) {
		if (fl[i]) {
			count++;
		}
	}
	return count;
}

int main() {

	int num = 0;
	while (cin >> num) {
		//clock_t start = clock();    // ??????????????????
		cout << SieveOfEratosthenes(num) << endl;
		//clock_t end = clock();     // ????????????
		//std::cout << "duration = " << (double)(end - start) / CLOCKS_PER_SEC << "sec.\n";
	}
	return 0;
}

Compiler output:
a.cc: In function 'int SieveOfEratosthenes(int)':
a.cc:22:9: error: 'memset' was not declared in this scope
   22 |         memset(fl, true, sizeof(fl));
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <cstdio>
  +++ |+#include <cstring>
    4 | #include <time.h>     // for clock()
Language: C++

#include <iostream>
#include <cmath>
//#include <ctime>
#define Even(n) n%2
using namespace std;

void count_Prime(int n);
bool IsPrime(int num);


int main()
{
	int Data = 0;
//	clock_t start, end;
	while (cin >> Data)
	{
//		start = clock();
		count_Prime(Data);
//		end = clock();

		cout << (double)(end - start) / CLOCKS_PER_SEC << "sec" << endl;
	}

	return 0;
}

void count_Prime(int n)
{
	int counter = 0,  i = 0;
	for (i = 2; i <= n; ++i)
	{
		if (IsPrime(i))
			counter++;
	}

	cout << counter << endl;

}

bool IsPrime(int num)
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // ??¶??°????????????????????????

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// ?´???°??§?????????
			return false;
		}
	}

	// ?´???°??§??????
	return true;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:40: error: 'start' was not declared in this scope
   21 |                 cout << (double)(end - start) / CLOCKS_PER_SEC << "sec" << endl;
      |                                        ^~~~~
Language: C++

#include<iostream>
#include<iomanip>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include <sstream>
using namespace std;
int main(void){
    int n,ans,i;
    while(cin >> n){
        ans = 0;
        if(n < 2){
            cout << 0;
            continue;
        }else if(n == 2){
            cout << 1;
        }else{
            ans++;
        }
        for(i = 3; i <= n; i += 2){
            if(ceil(sqrti) == floor(sqrti)){
                continue;
            }
            ans++;
        }
        cout << ans << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:21: error: 'sqrti' was not declared in this scope; did you mean 'sqrtl'?
   27 |             if(ceil(sqrti) == floor(sqrti)){
      |                     ^~~~~
      |                     sqrtl
Language: C++

#include <iostream>
using namespace std;
const int MAX_V = 1000000; // 100????????§?´???°??¨?????????
const int prime[MAX_V+1]; // 1????´???°???0????´???°??§?????? 
const pcount[MAX_V+1];
int main() {
    int i, k,a,sum=0;
    for(i = 2; i <= MAX_V; i++) {
        prime[i] = 1; // 2??\????´???°??¨??????
    } 
    for(i = 2; i*i <= MAX_V; i++) {
        if(prime[i]) {
            for(k = 2 * i; k <= MAX_V; k += i) {
                prime[k] = 0; // ?´???°2?????\????????°?´???°??§?????? 
            }
            
        } 
        
    }
    pcount[0]=0;
    pcount[1]=0;
    for(i=2;i<MAX_V;i++){
        if(prime[i]){
            sum++;
        }
        pcount[i]=sum;
    }
    for(i=0;i<30;i++){
        scanf("%d",&a);
        printf("%d\n",pcount[a]);
    } 

    return 0; 
    
}

Compiler output:
a.cc:4:11: error: uninitialized 'const prime' [-fpermissive]
    4 | const int prime[MAX_V+1]; // 1????´???°???0????´???°??§??????
      |           ^~~~~
a.cc:5:7: error: 'pcount' does not name a type
    5 | const pcount[MAX_V+1];
      |       ^~~~~~
a.cc: In function 'int main()':
a.cc:9:18: error: assignment of read-only location 'prime[i]'
    9 |         prime[i] = 1; // 2??\????´???°??¨??????
      |         ~~~~~~~~~^~~
a.cc:14:26: error: assignment of read-only location 'prime[k]'
   14 |                 prime[k] = 0; // ?´???°2?????\????????°?´???°??§??????
      |                 ~~~~~~~~~^~~
a.cc:20:5: error: 'pcount' was not declared in this scope
   20 |     pcount[0]=0;
      |     ^~~~~~
Language: C++

include <stdio.h>
const int MAX_V = 1000000;
int prime[MAX_V+1],sum[MAX_V+2]={0};
int main(){
  int n;
  for(int i = 2;i <= MAX_V;i++){
    prime[i] = 1;
  }
  for(int i = 2;i * i <= MAX_V;i++){
    if(prime[i]){
      for(int k = 2* i;k <= MAX_V;k += i)
      prime[k]=0;
    }
  }
  for(int i = 2;i < MAX_V;i++){
    sum[i] +=sum[i-1]+prime[i];
  }
  while(scanf("%d",&n)!=EOF){
    printf("%d\n",sum[n]);
  }
  return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <stdio.h>
      | ^~~~~~~
a.cc:3:11: error: 'MAX_V' was not declared in this scope
    3 | int prime[MAX_V+1],sum[MAX_V+2]={0};
      |           ^~~~~
a.cc:3:24: error: 'MAX_V' was not declared in this scope
    3 | int prime[MAX_V+1],sum[MAX_V+2]={0};
      |                        ^~~~~
a.cc: In function 'int main()':
a.cc:6:22: error: 'MAX_V' was not declared in this scope
    6 |   for(int i = 2;i <= MAX_V;i++){
      |                      ^~~~~
a.cc:7:5: error: 'prime' was not declared in this scope
    7 |     prime[i] = 1;
      |     ^~~~~
a.cc:9:26: error: 'MAX_V' was not declared in this scope
    9 |   for(int i = 2;i * i <= MAX_V;i++){
      |                          ^~~~~
a.cc:10:8: error: 'prime' was not declared in this scope
   10 |     if(prime[i]){
      |        ^~~~~
a.cc:15:21: error: 'MAX_V' was not declared in this scope
   15 |   for(int i = 2;i < MAX_V;i++){
      |                     ^~~~~
a.cc:16:5: error: 'sum' was not declared in this scope
   16 |     sum[i] +=sum[i-1]+prime[i];
      |     ^~~
a.cc:16:23: error: 'prime' was not declared in this scope
   16 |     sum[i] +=sum[i-1]+prime[i];
      |                       ^~~~~
a.cc:18:9: error: 'scanf' was not declared in this scope
   18 |   while(scanf("%d",&n)!=EOF){
      |         ^~~~~
a.cc:18:25: error: 'EOF' was not declared in this scope
   18 |   while(scanf("%d",&n)!=EOF){
      |                         ^~~
a.cc:1:1: note: 'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | include <stdio.h>
a.cc:19:19: error: 'sum' was not declared in this scope
   19 |     printf("%d\n",sum[n]);
      |                   ^~~
a.cc:19:5: error: 'printf' was not declared in this scope
   19 |     printf("%d\n",sum[n]);
      |     ^~~~~~
a.cc:19:5: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include <stdio.h>
#include <iostream>

const int MAX_V = 10000;
int prime[MAX_V+1];

void init(){
    int i, k, v;
    for(i=2; i<=MAX_V; i++){
        prime[i] = 1;
    }
    for(i=2; i*i<=MAX_V; i++){
        if(prime[i]){
            for(k=2*i; k<=MAX_V; k+=i){
                prime[k]=0;
            }
        }
    }   
}

int isprime(int n){
    return prime[n];
}

int main(){
    init();
    int num;
    // while(1){
    while(cin >> num){
        int count=0;
        // scanf("%d", &num);
        for(int i=2; i<=num; i++){
            if(isprime(i)==1)
                count++;
        }
    printf("%d\n", count);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:11: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   29 |     while(cin >> num){
      |           ^~~
      |           std::cin
In file included from a.cc:2:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
Language: C++

import math

while True:
    try:
        n = int(input())
        c = [1 for i in range(n)]
        c[0] = 0
        i = 2
        while i**2 <= n:
            j = i*2
            while j <= n:
                c[j - 1] = 0
                j += i
            i += 1
        print(sum(c))
    except:
        break

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

#include<iostream>
using namespace std;

int get_num_of_under_n(int n) {
	bool* numbers = new bool[n + 1];
	for (int i = 2; i < n + 1; i++) {
		numbers[i] = true;
	}
	for (int i = 2; i < sqrt(n); i++) {
		if (numbers[i] == true) {
			for (int j = 0; i*(j + 2) <= n; j++) {
				numbers[i*(j + 2)] = false;
			}
		}
	}
	int ans = 0;
	for (int i = 2; i < n + 1; i++) {
		if (numbers[i] == true)ans++;
	}
	return ans;
}
int main() {
	int n;
	while (cin>>n) {
		cout << get_num_of_under_n(n)<<endl;
	}
}

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

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

bool isPrime(int x) {
    if (x==2) {
        return true;
    }
    if (x<2 || x%2==0) {
        return false;
    }
    i=3;
    while (i*i<=x) {
        if (x%i==0) {
            return false;
        }
        i+=2;
    }
    /*for (int i=3; i*i<=x; i+=2) {
     if (x%i==0) {
     return false;
     }
     }*/
    return true;
}
int main() {
    int n;
    int cnt;
    while (cin >> n) {
        cnt=0;
        for (int i=0; i<=n; i++) {
            if (isPrime(i)) {
                cnt++;
            }
        }
        printf("%d\n",cnt);
    }
    return 0;
}

Compiler output:
a.cc: In function 'bool isPrime(int)':
a.cc:12:5: error: 'i' was not declared in this scope
   12 |     i=3;
      |     ^
Language: C++

include <iostream>
using namespace std;
 
int main(){
   bool is_prime[1000000];
   is_prime[0]=is_prime[1]=false;
   for(int i=2;i<1000000;i++)
      is_prime[i]=true;
   for(int i=2;i*i<1000000;i++){
      if(is_prime[i]){
         for(int j=i*i;j<1000000;j+=i){
            is_prime[j]=false;
         }
      }
   }
   int n[1000000];
   int count=0;
   for(int i=0;i<1000000;i++){
      if(is_prime[i])
         count++;
      n[i]=count;
   }
   while(true){
      int x;
      cin >> x;
      if(cin.eof())
         break;
      cout << n[x] << endl;
   }
    
   return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:25:7: error: 'cin' was not declared in this scope
   25 |       cin >> x;
      |       ^~~
a.cc:28:7: error: 'cout' was not declared in this scope; did you mean 'count'?
   28 |       cout << n[x] << endl;
      |       ^~~~
      |       count
a.cc:28:23: error: 'endl' was not declared in this scope
   28 |       cout << n[x] << endl;
      |                       ^~~~
Language: C++

#include<iostream>
using namespace std;
int sushu(int a)
{
	int flag = 1;
	for (int i = 2; i < sqrt(a)+1; i++)
	{
		if (a%i == 0)
		{
			flag = 0;
			break;
		}
	}
	return flag;
}
int main()
{
	int n;
	while (cin >> n)
	{
		int ans = 0, flag = 1;
		if (n == 1)
			cout << ans << endl;
		else
		{
			for (int i = 2; i <= n; i++)
			{
				flag = sushu(i);
				if (flag)
					ans++;
			}
			cout << ans+1 << endl;
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'int sushu(int)':
a.cc:6:29: error: 'sqrt' was not declared in this scope
    6 |         for (int i = 2; i < sqrt(a)+1; i++)
      |                             ^~~~