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

#include <iostream>
//#include <vector>
//#include <math.h>
//#include <string>
//#include <cmath>

int main(void);
int count_prime_number(int n);

int main(){
	int n;
	int cnt = 0;
	int result[30];

	//while (cnt < 3){
		//std::cin >> n;
	while (std::cin >> n){
		result[cnt] = count_prime_number(n);
		cnt++;
	}

	for (int i = 0; i < cnt; i++){
		std::cout << result[i] << std::endl;
	}

	//while (1);
	return 0;
}


//0..nまでの素数の個数を出力する
//args:数値
//return:素数の個数
int count_prime_number(int n){
	int rtn = 0;

	//2だけ個別チェック
	if (n >= 2){
		rtn++;
	}

	for (int i = 3; i <= n; i+= 2)
	{
		bool is_prime_num = true;
		for (int j = 3; j <= sqrt(i); j+= 2)		//ルートi以上のiの約数はルートi以下のiの約数と対になっているので範囲はルートiまででいい
		{
			if (i % j == 0)
			{
				is_prime_num = false;
				break;
			}
		}

		if (is_prime_num){
			rtn++;

			//デバッグ
			//std::cout << i << std::endl;
		}
	}

	return rtn;
}


Compiler output:
a.cc: In function 'int count_prime_number(int)':
a.cc:45:38: error: 'sqrt' was not declared in this scope
   45 |                 for (int j = 3; j <= sqrt(i); j+= 2)            //ルートi以上のiの約数はルートi以下のiの約数と対になっているので範囲はルートiまででいい
      |                                      ^~~~
Language: C++

#include <cassert>
#include <iostream>

using namespace std;

constexpr int ceil_sqrt(int x) {
  int ans = 0;
  while (ans*ans < x) { ++ans; }
  return ans;
}

template<int size>
struct Sieve {
  constexpr Sieve(): factor(), primes() {
    factor[0] = factor[1] = 1;
    for (int p = 2; p < size; ++p) {
      primes[p] = primes[p-1] + (factor[p]?0:1);
      if (factor[p]) { continue; }
      for (int n = 2*p; n < size; n += p) {
        factor[n] = p;
      }
    }
  }
  constexpr bool is_prime(int n) const {
    assert(n < size);
    return !(factor[n]);
  }
  int factor[size];
  int primes[size];
};

constexpr int NMAX = 1200000;
constexpr auto sieve = Sieve<NMAX>();

int main() {
  int N = 0;
  while (cin >> N) {
    cout << sieve.primes[N] << endl;
  }
  return 0;
}



Compiler output:
a.cc:33:36:   in 'constexpr' expansion of 'Sieve<1200000>()'
a.cc:19:7: error: 'constexpr' loop iteration count exceeds limit of 262144 (use '-fconstexpr-loop-limit=' to increase the limit)
   19 |       for (int n = 2*p; n < size; n += p) {
      |       ^~~
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
const int len 200000
int prime[len];
int a; 
bool mark[len];

void f()
{
    a=0;
    long long int i,j;
    for( i=0; i<len; i++)
    {
        mark[i]=false;
    }
    for( i=2; i<len; i++)
    {
        if(mark[i]==1)  
            continue;
        else
        {
            prime[a++]=i;
            for( j=i*i; j<len; j+=i)
            {
                mark[j]=true;
            }
        }
    }
}


int main()
{
    f();
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        printf("%d\n",prime[n-1]);
    }
    return 0;
}


Compiler output:
a.cc:4:15: error: expected initializer before numeric constant
    4 | const int len 200000
      |               ^~~~~~
a.cc:7:11: error: 'len' was not declared in this scope; did you mean 'mblen'?
    7 | bool mark[len];
      |           ^~~
      |           mblen
a.cc: In function 'void f()':
a.cc:13:17: error: 'len' was not declared in this scope; did you mean 'mblen'?
   13 |     for( i=0; i<len; i++)
      |                 ^~~
      |                 mblen
a.cc:15:9: error: 'mark' was not declared in this scope
   15 |         mark[i]=false;
      |         ^~~~
a.cc:17:17: error: 'len' was not declared in this scope; did you mean 'mblen'?
   17 |     for( i=2; i<len; i++)
      |                 ^~~
      |                 mblen
a.cc:19:12: error: 'mark' was not declared in this scope
   19 |         if(mark[i]==1)
      |            ^~~~
a.cc:23:13: error: 'prime' was not declared in this scope
   23 |             prime[a++]=i;
      |             ^~~~~
a.cc: In function 'int main()':
a.cc:39:23: error: 'prime' was not declared in this scope
   39 |         printf("%d\n",prime[n-1]);
      |                       ^~~~~
Language: C++

#include<iostream>
#include<vector>
#define MAX 1000000
using namespace std;
int main(){
    vector<int> v(MAX);
    for(int i = 0;i<MAX;i++)
      v[i]=true;

      v[0]=false;
      v[1]=false;
    for(int i = 2;i<MAX;i++){
      if(v[i]==true){
        for(long long int  = (long long int)i*i;j<MAX;j=j*j){
         v[j]=false;
       }
      }
    }
    for(int i = 2;i<MAX;i++)v[i]+=v[i-1];
    while(true){
      int a;
      cin >> a;
      if(cin.eof())return 0;
      cout << v[a]<<endl;
    }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:14:28: error: expected unqualified-id before '=' token
   14 |         for(long long int  = (long long int)i*i;j<MAX;j=j*j){
      |                            ^
a.cc:14:26: error: expected ';' before '=' token
   14 |         for(long long int  = (long long int)i*i;j<MAX;j=j*j){
      |                          ^ ~
      |                          ;
a.cc:14:28: error: expected primary-expression before '=' token
   14 |         for(long long int  = (long long int)i*i;j<MAX;j=j*j){
      |                            ^
a.cc:14:49: error: 'j' was not declared in this scope
   14 |         for(long long int  = (long long int)i*i;j<MAX;j=j*j){
      |                                                 ^
a.cc:14:54: error: expected ')' before ';' token
   14 |         for(long long int  = (long long int)i*i;j<MAX;j=j*j){
      |            ~                                         ^
a.cc:14:55: error: 'j' was not declared in this scope
   14 |         for(long long int  = (long long int)i*i;j<MAX;j=j*j){
      |                                                       ^
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<1000000i++){
    is_prime[i] = true;
  }

  for(int i=2;i*i<1000000;i++){
    if(is_prime[i]){
      for(int j=i*i;j<1000000;j=j+i){
        is_prime[j] = 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:8:25: error: lvalue required as increment operand
    8 |   for(int i=2;i<1000000i++){
      |                         ^~
a.cc:8:27: error: expected ';' before ')' token
    8 |   for(int i=2;i<1000000i++){
      |                           ^
      |                           ;
Language: C++

#include <iostream>
using namespace std;

bool IsPrime(int n) {
    for(int i = 2; i*i <= n; i++) {
        if(n % i == 0) {
            return false;
        }
    }
    return true;
}

int main(void){
	int count = 0;
	int n;
	cin >> n;
	for(int i=0; i<n; i++){
		int p;
		cin >> p;
		if(IsPrime(p)){
			count++;
		}
	}
	count << count << endl;
	return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:24:24: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   24 |         count << count << endl;
      |         ~~~~~~~~~~~~~~~^~~~~~~
Language: C++

#include <iostream>
using namespace std;

bool IsPrime(int x) {
  return true;  /* ダミー: 全て素数と判定 */
}

int main(void){
   int count = 0, n;
   cin >> n; /* n個整数を読む */
   for(int i = 0; i < n; i++) {
       int p;
       cin >> p;
       if(IsPrime(p)) {
         bool IsPrime(int n) {
    for(int i = 2; i*i <= n; i++) {
        if(n % i == 0) {
            return false;
        }
    }
    return true;
}


       }
   }
   cout << count << endl;
   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:30: error: a function-definition is not allowed here before '{' token
   15 |          bool IsPrime(int n) {
      |                              ^
Language: C++

#include <iostream>

bool IsPrime(int n) {
    for(int i = 2; i*i <= n; i++) {
        if(n % i == 0) {
            return false;
        }
    }
    return true;
}

int main() {
	// your code goes here

	int n;
	while(1){
		cin >> n;
		if(cin.eof()){
			break;
		}
		int count = 0;
		for(int i=2;i<=n;i++){
			if(IsPrime(i)){
				count++;
			}
		}
		cout << count << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   17 |                 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 << count << 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:34: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   27 |                 cout << count << 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>
using namespace std;

int main(){
  bool is_prime[1000000];

  is_prime[0]=is_prime[1]=false;
  for(int i=2;i<1000000i++){
    is_prime[i] = true;
  }

  for(int i=2;i*i<1000000;i++){
    if(is_prime[i]){
      for(int j=i*i;j<1000000;j=j+i){
        is_prime[j] = 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:8:25: error: lvalue required as increment operand
    8 |   for(int i=2;i<1000000i++){
      |                         ^~
a.cc:8:27: error: expected ';' before ')' token
    8 |   for(int i=2;i<1000000i++){
      |                           ^
      |                           ;
Language: C++

#include <iostream>
using namespace std;
 
 bool IsPrime(int n){
    for(int i=2;i*i<=n;i++){
        if(n%i == 0){return false;}
    }
    return true;
}
 
 
int main(void) {
    int n;
 
    while(cin >> n){
    	for(i=2;i<=n;i++){
 　　		if(IsPrime(i)) count++;
 　	}
    	cout << count << endl;
    }
    
    return 0;
}


Compiler output:
a.cc:17:2: error: extended character 　 is not valid in an identifier
   17 |  　　           if(IsPrime(i)) count++;
      |  ^
a.cc:17:2: error: extended character 　 is not valid in an identifier
a.cc:18:2: error: extended character 　 is not valid in an identifier
   18 |  　     }
      |  ^
a.cc: In function 'int main()':
a.cc:16:13: error: 'i' was not declared in this scope
   16 |         for(i=2;i<=n;i++){
      |             ^
a.cc:17:2: error: '\U00003000\U00003000' was not declared in this scope
   17 |  　　           if(IsPrime(i)) count++;
      |  ^~~~
a.cc:18:2: error: '\U00003000' was not declared in this scope
   18 |  　     }
      |  ^~
a.cc:19:17: error: 'count' was not declared in this scope
   19 |         cout << count << endl;
      |                 ^~~~~
Language: C++

#include <iostream>
using namespace std;
int main(){
	int n,k,kk;
	while(cin>>n){
		kk=0;
		for(int j=3;j<=n;j+=2){
			k=0;
			for(int i=3;i<=sqrt(j);i+=2){
				if(j%i==0)k++;
		        }
		     if(k==1)kk++;
		   }
		if(n==1)cout<<"0"<<endl;
		else if(n==2)cout<<"1"<<endl;
		else cout<<kk+1<<endl;
	   }
	return 0;
	}


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

std::vector<bool> IsPrime;

void sieve(size_t max){
    if(max+1 > IsPrime.size()){     
        IsPrime.resize(max+1,true); 
    } 
    IsPrime[0] = false;
    IsPrime[1] = false;

    for(size_t i=2; i*i<=max; ++i)
        if(IsPrime[i]) 
            for(size_t j=2; i*j<=max; ++j) 
                IsPrime[i*j] = false;      
}




Compiler output:
a.cc:1:6: error: 'vector' in namespace 'std' does not name a template type
    1 | std::vector<bool> IsPrime;
      |      ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | std::vector<bool> IsPrime;
a.cc:3:6: error: variable or field 'sieve' declared void
    3 | void sieve(size_t max){
      |      ^~~~~
a.cc:3:12: error: 'size_t' was not declared in this scope
    3 | void sieve(size_t max){
      |            ^~~~~~
a.cc:1:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
  +++ |+#include <cstddef>
    1 | std::vector<bool> IsPrime;
Language: C++

#include<stdio.h> int main(void){ int a,b,r,ans,a1,b1; double c; while(scanf("%d %d",&a,&b)!=EOF){ a1=a,b1=b; while(1){ r=a%b; if(r==0){ ans=b; break; }else{ a=b; b=r; } } c=(double)(a1)*(double)(b1)/(double)(ans); printf("%d %.0f\n",ans,c); } return 0; } 


Compiler output:
a.cc:1:19: warning: extra tokens at end of #include directive
    1 | #include<stdio.h> int main(void){ int a,b,r,ans,a1,b1; double c; while(scanf("%d %d",&a,&b)!=EOF){ a1=a,b1=b; while(1){ r=a%b; if(r==0){ ans=b; break; }else{ a=b; b=r; } } c=(double)(a1)*(double)(b1)/(double)(ans); printf("%d %.0f\n",ans,c); } return 0; }
      |                   ^~~
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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


Compiler output:
a.cc:1:19: warning: extra tokens at end of #include directive
    1 | #include<stdio.h> int prime[1000000]; int main(){ prime[0]=-1; prime[1]=-1; for(int i=2;i<1000000;i++){ if(prime[i]==0){ prime[i]=1; for(int j=i*2;j<1000000;j+=i)prime[j]=-1; } } int now; while(~scanf("%d",&now)){ int ans=0; for(int i=1;i<now+1;i++)if(prime[i]==1)ans++; printf("%d\n",ans); } }
      |                   ^~~
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#define _USE_MATH_DEFINES
#include <iostream> 
#include <math.h>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std; 
int main(){
	int N;
	while(cin >> N)
	double p = std::log2(N);
	while (cin >> N){
		int sum =0;
		cout << N*p << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:27: error: 'p' was not declared in this scope
   14 |                 cout << N*p << endl;
      |                           ^
Language: C++

#define _USE_MATH_DEFINES
#include <iostream> 
#include <math.h>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std; 
int main(){
	int N;
	while(cin >> N)
	double p = log2(N);
	while (cin >> N){
		int sum =0;
		cout << N*p << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:27: error: 'p' was not declared in this scope
   14 |                 cout << N*p << endl;
      |                           ^
Language: C++

import sys

def prime_calc(n):
    if n < 2:
        return False
    else:
        i = 2
        while n > i:
            if n % i == 0:
                return False
            else:
                i += 1
    return True

def prime(n):
    cnt = 0
    for i in range(0, n+1):
        ans = prime_calc(i)
        if ans is True:
            cnt = cnt + 1
    return cnt

def main():
    a = []

    for line in sys.stdin:
        a.append(int(line))

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

if __name__ == "__main__":
    main()



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>
#define MAX 1000000

using namespace std;

bool prime[MAX+1];
int T[MAX];

void eratos( int n ){
    for ( int i = 0; i < n; i++ ) prime[i] = false;
    for ( int i = 3; i <= n; i += 2 ) prime[i] = true;
    prime[2] = true;
    for ( int i = 3, limit = (int)sqrt(n); i <= limit; i += 2 ) {
	if ( !prime[i] ) continue;
	for ( int j = i * i, k = i * 2; j <= n; j += k ) prime[j] = false;
    }
}

void initialize(){
    eratos( MAX );
    for ( int i = 0; i < MAX; i++ ){
	T[i] = T[i - 1];
	if ( prime[i] ) T[i]++;
    }
}

main(){
    initialize();
    int n;
    while ( cin >> n ) cout << T[n] << endl;
}

Compiler output:
a.cc: In function 'void eratos(int)':
a.cc:13:35: error: 'sqrt' was not declared in this scope
   13 |     for ( int i = 3, limit = (int)sqrt(n); i <= limit; i += 2 ) {
      |                                   ^~~~
a.cc: At global scope:
a.cc:27:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   27 | main(){
      | ^~~~
Language: C++

#include <stdio.h>
main(n){
	int b[100000],i,j;
	while(~scanf("%d",&n)){
		n++;
		for(i=2;i<n;i++)b[i]=1;
		for(i=2;i<n;i++)for(j=i*2;j<n;j+=i)b[j]=0;
		for(i=2,j=0;i<n;i++)j+=b[i]?1:0;
		printf("%d\n",j);
	}
}

Compiler output:
a.cc:2:5: error: expected constructor, destructor, or type conversion before '(' token
    2 | main(n){
      |     ^
Language: C++

#include <iostream>
using namespace std;
int main(){
  const int NUM = 1000000;
  bool prime[NUM];
  prime[0] = false;prime[1] = false;
  for(int i=2;i<NUM;i++)
    prime[i] = true;
  for(int i=2;i*i<NUM;i++)
    for(int k=2;i*k<NUM;k++)
      prime[i*k]=false;
  int n,c=0,i=0;
  for(cin>>n;i<n;i++)if(prime[i})count++;
  cout<<c<<endl;
  return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:32: error: expected ']' before '}' token
   13 |   for(cin>>n;i<n;i++)if(prime[i})count++;
      |                                ^
      |                                ]
a.cc:13:32: error: expected ')' before '}' token
   13 |   for(cin>>n;i<n;i++)if(prime[i})count++;
      |                        ~       ^
      |                                )
a.cc:13:32: error: expected primary-expression before '}' token
a.cc: At global scope:
a.cc:13:33: error: expected unqualified-id before ')' token
   13 |   for(cin>>n;i<n;i++)if(prime[i})count++;
      |                                 ^
a.cc:14:3: error: 'cout' does not name a type
   14 |   cout<<c<<endl;
      |   ^~~~
a.cc:15:3: error: expected unqualified-id before 'return'
   15 |   return 0;}
      |   ^~~~~~
a.cc:15:12: error: expected declaration before '}' token
   15 |   return 0;}
      |            ^
Language: C++

import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	void run(){
		sc=new Scanner(System.in);
		for(;;){
			if(!sc.hasNext())
				break;
			int n=sc.nextInt();
			int a=0;
			for(int i=2; i<=n; i++)
				if(isPrime(i))
					a++;
			println(""+a);
		}
		sc.close();
	}

	boolean isPrime(int n){
		int m=(int)sqrt(n);
		if(n==2)
			return true;
		if(n%2==0)
			return false;
		for(int i=3; i<=m; i++)
			if(n%i==0)
				return false;
		return true;
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

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

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.lang.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.math.*;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.io.*;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
    6 | import static java.lang.Math.*;
      | ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
    7 | import static java.util.Arrays.*;
      | ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:9:1: error: expected unqualified-id before 'public'
    9 | public class Main{
      | ^~~~~~
Language: C++

#include<iostream>
#include<string>
int main(){for(int m,n,o,c,d,e,i;!(std::cin>>n).eof();){if(n<3)e=n>1;else{bool*v=new bool[c=(n&1?n:--n)/2+1];memset(v,1,c);for(i=m=e=1;i<c;i++){for(m=i;m<c&&!v[m];)m++;if(m==c)break;e++;for(d=o=m*2+1;d<n+1;d+=o*2)v[d/2]=0;if(n<o*o)break;}for(i=1;i<c;)e+=v[i++];delete[]v;}printf("%d\n",e);}}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:110: error: 'memset' was not declared in this scope
    3 | int main(){for(int m,n,o,c,d,e,i;!(std::cin>>n).eof();){if(n<3)e=n>1;else{bool*v=new bool[c=(n&1?n:--n)/2+1];memset(v,1,c);for(i=m=e=1;i<c;i++){for(m=i;m<c&&!v[m];)m++;if(m==c)break;e++;for(d=o=m*2+1;d<n+1;d+=o*2)v[d/2]=0;if(n<o*o)break;}for(i=1;i<c;)e+=v[i++];delete[]v;}printf("%d\n",e);}}
      |                                                                                                              ^~~~~~
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<new>
int main(){for(int m,n,o,c,d,e,i;!(std::cin>>n).eof();){if(n<3)e=n>1;else{bool*v=new bool[c=(n&1?n:--n)/2+1];memset(v,1,c);for(i=m=e=1;i<c;i++){for(m=i;m<c&&!v[m];)m++;if(m==c)break;e++;for(d=o=m*2+1;d<n+1;d+=o*2)v[d/2]=0;if(n<o*o)break;}for(i=1;i<c;)e+=v[i++];delete[]v;}printf("%d\n",e);}}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:110: error: 'memset' was not declared in this scope
    4 | int main(){for(int m,n,o,c,d,e,i;!(std::cin>>n).eof();){if(n<3)e=n>1;else{bool*v=new bool[c=(n&1?n:--n)/2+1];memset(v,1,c);for(i=m=e=1;i<c;i++){for(m=i;m<c&&!v[m];)m++;if(m==c)break;e++;for(d=o=m*2+1;d<n+1;d+=o*2)v[d/2]=0;if(n<o*o)break;}for(i=1;i<c;)e+=v[i++];delete[]v;}printf("%d\n",e);}}
      |                                                                                                              ^~~~~~
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>
int main(){for(int m,n,o,c,d,e,i;!(std::cin>>n).eof();){if(n<3)e=n>1;else{bool*v=new bool[c=(n&1?n:--n)/2+1];std::memset(v,1,c);for(i=m=e=1;i<c;i++){for(m=i;m<c&&!v[m];)m++;if(m==c)break;e++;for(d=o=m*2+1;d<n+1;d+=o*2)v[d/2]=0;if(n<o*o)break;}for(i=1;i<c;)e+=v[i++];delete[]v;}printf("%d\n",e);}}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:115: error: 'memset' is not a member of 'std'; did you mean 'wmemset'?
    3 | int main(){for(int m,n,o,c,d,e,i;!(std::cin>>n).eof();){if(n<3)e=n>1;else{bool*v=new bool[c=(n&1?n:--n)/2+1];std::memset(v,1,c);for(i=m=e=1;i<c;i++){for(m=i;m<c&&!v[m];)m++;if(m==c)break;e++;for(d=o=m*2+1;d<n+1;d+=o*2)v[d/2]=0;if(n<o*o)break;}for(i=1;i<c;)e+=v[i++];delete[]v;}printf("%d\n",e);}}
      |                                                                                                                   ^~~~~~
      |                                                                                                                   wmemset
Language: C++

#include <iostream>

using namespace std;

typedef long long ll;

int main()
{
    int prime_num[1000001];
    memset(prime_num, 0, 1000001);
    prime_num[2] = 1;
    int ans = 1;
    for(int i = 3; i <= 1000000; i++) {
        if(i % 2 == 0) { 
            prime_num[i] = prime_num[i-1];
            continue;
        }
        bool is_prime = true;
        for(int j = 3; j*j <= i; j++) {
            if(i % j == 0) {
                is_prime = false;
                break;
            }
        }
        if(is_prime) {
            prime_num[i] = prime_num[i-1] + 1;
        } else {
            prime_num[i] = prime_num[i-1];
        }
    }
    int n;
    while(cin >> n) {
        cout << prime_num[n] << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'memset' was not declared in this scope
   10 |     memset(prime_num, 0, 1000001);
      |     ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 |
Language: C++

#include <iostream>
#include <math>

using namespace std;

int main() {
  int lim;
  int i,n;
  int count=1;
  bool isPrime=true;
  
  scanf("%d",&n);
  
  for(lim=2;lim<=n;lim++) {
  for(i=2;i<(int)(sqrt(lim)+1.0);i++) {
    if((lim%i)==0) {
      isPrime=false;
      count++;
      break;
    }
  }
  }
  printf("%d",n-count);
  return 0;
}

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

#include<cstdio>
#include<cstring>
int main(){
 int n,cnt=0;
 scanf("%d",&n);
 int a[n+1];
 memset(a,-1,sizeof(int)*(n+1));
 for(int i=2;i<=n;i++){
 if(a[i]==-1){ con++;
 for(int j=i;j<=n;j=j+i) a[j]=0;}
}
return 0;
}

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

#include <cstdio>
int NUM = 1000000;
bool prime[NUM];
int main(){
  prime[0] = false;prime[1] = false;
  for(int i=2;i<NUM;i++)prime[i] = true;
  for(int i=2;i*i<NUM;i++)
    for(int k=2;i*k<NUM;k++)
      prime[i*k]=false;

	int primeNum[NUM];
	for(int i=0,c=0;i<NUM;i++){
		prime[i]&&c++;
		primeNum[i] = c;
	}
	for(int n;scanf("%d",&n)+1;printf("%d",primeNum[n]));
}

Compiler output:
a.cc:3:12: error: size of array 'prime' is not an integral constant-expression
    3 | bool prime[NUM];
      |            ^~~
Language: C++

#include <cstdio>
const int N = 1000000;
int p[NUM],int pN[NUM];
main(){p[0]=0;p[1]=0;int i,k,n,c;
for(i=2;i<N;i++)prime[i]=1;for(i=2;i*i<N;){for(k=2;i*k<N;k++)p[i*k]=0;do{i++;}while(!p[i]);}for(i=0,c=0;i<N;i++){p[i]&&c++;pN[i] = c;}for(;scanf("%d",&n)+1;printf("%d\n",pN[n]));}

Compiler output:
a.cc:3:7: error: 'NUM' was not declared in this scope
    3 | int p[NUM],int pN[NUM];
      |       ^~~
a.cc:3:12: error: expected unqualified-id before 'int'
    3 | int p[NUM],int pN[NUM];
      |            ^~~
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){p[0]=0;p[1]=0;int i,k,n,c;
      | ^~~~
a.cc: In function 'int main()':
a.cc:4:8: error: 'p' was not declared in this scope
    4 | main(){p[0]=0;p[1]=0;int i,k,n,c;
      |        ^
a.cc:5:17: error: 'prime' was not declared in this scope
    5 | for(i=2;i<N;i++)prime[i]=1;for(i=2;i*i<N;){for(k=2;i*k<N;k++)p[i*k]=0;do{i++;}while(!p[i]);}for(i=0,c=0;i<N;i++){p[i]&&c++;pN[i] = c;}for(;scanf("%d",&n)+1;printf("%d\n",pN[n]));}
      |                 ^~~~~
a.cc:5:124: error: 'pN' was not declared in this scope; did you mean 'N'?
    5 | for(i=2;i<N;i++)prime[i]=1;for(i=2;i*i<N;){for(k=2;i*k<N;k++)p[i*k]=0;do{i++;}while(!p[i]);}for(i=0,c=0;i<N;i++){p[i]&&c++;pN[i] = c;}for(;scanf("%d",&n)+1;printf("%d\n",pN[n]));}
      |                                                                                                                            ^~
      |                                                                                                                            N
a.cc:5:171: error: 'pN' was not declared in this scope; did you mean 'N'?
    5 | for(i=2;i<N;i++)prime[i]=1;for(i=2;i*i<N;){for(k=2;i*k<N;k++)p[i*k]=0;do{i++;}while(!p[i]);}for(i=0,c=0;i<N;i++){p[i]&&c++;pN[i] = c;}for(;scanf("%d",&n)+1;printf("%d\n",pN[n]));}
      |                                                                                                                                                                           ^~
      |                                                                                                                                                                           N
Language: C++

#include <cstdio>
const int N = 1000000;
int p[N],int pN[N];
main(){p[0]=0;p[1]=0;int i,k,n,c;
for(i=2;i<N;i++)prime[i]=1;for(i=2;i*i<N;){for(k=2;i*k<N;k++)p[i*k]=0;do{i++;}while(!p[i]);}for(i=0,c=0;i<N;i++){p[i]&&c++;pN[i] = c;}for(;scanf("%d",&n)+1;printf("%d\n",pN[n]));}

Compiler output:
a.cc:3:10: error: expected unqualified-id before 'int'
    3 | int p[N],int pN[N];
      |          ^~~
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){p[0]=0;p[1]=0;int i,k,n,c;
      | ^~~~
a.cc: In function 'int main()':
a.cc:5:17: error: 'prime' was not declared in this scope
    5 | for(i=2;i<N;i++)prime[i]=1;for(i=2;i*i<N;){for(k=2;i*k<N;k++)p[i*k]=0;do{i++;}while(!p[i]);}for(i=0,c=0;i<N;i++){p[i]&&c++;pN[i] = c;}for(;scanf("%d",&n)+1;printf("%d\n",pN[n]));}
      |                 ^~~~~
a.cc:5:124: error: 'pN' was not declared in this scope; did you mean 'p'?
    5 | for(i=2;i<N;i++)prime[i]=1;for(i=2;i*i<N;){for(k=2;i*k<N;k++)p[i*k]=0;do{i++;}while(!p[i]);}for(i=0,c=0;i<N;i++){p[i]&&c++;pN[i] = c;}for(;scanf("%d",&n)+1;printf("%d\n",pN[n]));}
      |                                                                                                                            ^~
      |                                                                                                                            p
a.cc:5:171: error: 'pN' was not declared in this scope; did you mean 'p'?
    5 | for(i=2;i<N;i++)prime[i]=1;for(i=2;i*i<N;){for(k=2;i*k<N;k++)p[i*k]=0;do{i++;}while(!p[i]);}for(i=0,c=0;i<N;i++){p[i]&&c++;pN[i] = c;}for(;scanf("%d",&n)+1;printf("%d\n",pN[n]));}
      |                                                                                                                                                                           ^~
      |                                                                                                                                                                           p
Language: C++

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

int prime[MAX];


int main(){
	prime[0]=1;
	prime[1]=1;
	prime[2]=0;
	prime[3]=0;
	for(int i=0;i*i<=MAX;i++) {
		if(prime[i]==1) continue;

		for(int t = i*2;t<MAX;t+=i)
			prime[i]=1;
	}

	while(cin.eof()){
		int m = 0;
		cin >> N;
		for(int i =0;i<=N;i++)
			if(prime[i]==0)
				m++;

		cout << m << endl;
	}

	return 0;
}

Compiler output:
a.cc:3:20: error: expected ']' before ';' token
    3 | #define MAX 1000000;
      |                    ^
a.cc:6:11: note: in expansion of macro 'MAX'
    6 | int prime[MAX];
      |           ^~~
a.cc:6:14: error: expected unqualified-id before ']' token
    6 | int prime[MAX];
      |              ^
a.cc: In function 'int main()':
a.cc:10:9: error: 'prime' was not declared in this scope
   10 |         prime[0]=1;
      |         ^~~~~
a.cc:14:29: error: expected primary-expression before ';' token
   14 |         for(int i=0;i*i<=MAX;i++) {
      |                             ^
a.cc:14:29: error: expected ')' before ';' token
   14 |         for(int i=0;i*i<=MAX;i++) {
      |            ~                ^
a.cc:14:30: error: 'i' was not declared in this scope
   14 |         for(int i=0;i*i<=MAX;i++) {
      |                              ^
Language: C++

#include <iostream>
using namespace std;

int main(){
  int a;
  int i, j;
  int past=1, a_sqrt;
  int count;
  bool chk[1000000];

  for(i=1; i<1000000; i++) chk[i]=true;
  while(cin>>a){
    count=0;
    if(past>=a){
      for(i=1; i<=a; i++){
        if(chk[i]) count++;
      }
      printf("%d\n", count);
    }
    else {
      a_sqrt=a^0.5;
      for(i=2; i<=a_sqrt; i++){
        for(j=past+1; j<=a; j++){
          if(j%i==0) chk[j]=false;
        }
      }
      past=a;
      for(i=1; i<=a; i++){
        if(chk[i]) count++;
      }
      printf("%d\n", count);
    }
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:15: error: invalid operands of types 'int' and 'double' to binary 'operator^'
   21 |       a_sqrt=a^0.5;
      |              ~^~~~
      |              | |
      |              | double
      |              int
Language: C++

#include <iostream>
using namespace std;

int main(){
  int a;
  int i, j;
  int past=1, a_sqrt;
  int count;
  bool chk[1000000];

  for(i=1; i<1000000; i++) chk[i]=true;
  while(cin>>a){
    count=0;
    if(past>=a){
      for(i=1; i<=a; i++){
        if(chk[i]) count++;
      }
      printf("%d\n", count);
    }
    else {
      a_sqrt=(int)sqrt(a);
      for(i=2; i<=a_sqrt; i++){
        for(j=past+1; j<=a; j++){
          if(j%i==0) chk[j]=false;
        }
      }
      past=a;
      for(i=1; i<=a; i++){
        if(chk[i]) count++;
      }
      printf("%d\n", count);
    }
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:19: error: 'sqrt' was not declared in this scope; did you mean 'a_sqrt'?
   21 |       a_sqrt=(int)sqrt(a);
      |                   ^~~~
      |                   a_sqrt
Language: C++

#include <iostream>
using namespace std;

int main(){
  int a;
  int i, j;
  int past=1, a_sqrt;
  int count;
  bool chk[1000000];

  for(i=1; i<1000000; i++) chk[i]=true;
  while(cin >> a){
    count=0;
    if(past>=a){
      for(i=1; i<=a; i++){
        if(chk[i]) count++;
      }
      printf("%d\n", count);
    }
    else {
      a_sqrt=(int)sqrt(a);
      for(i=2; i<=a_sqrt; i++){
        for(j=past+1; j<=a; j++){
          if(j%i==0) chk[j]=false;
        }
      }
      past=a;
      for(i=1; i<=a; i++){
        if(chk[i]) count++;
      }
      printf("%d\n", count);
    }
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:19: error: 'sqrt' was not declared in this scope; did you mean 'a_sqrt'?
   21 |       a_sqrt=(int)sqrt(a);
      |                   ^~~~
      |                   a_sqrt
Language: C++

import java.io.*;

import java.util.*;
import java.math.*;



class Main{

	private static ArrayList<Integer> sum_check(int a){

		int count = 0;
		ArrayList<Integer> s = new ArrayList<Integer>();
		
		for(int i=0;i<=a;i++){
			s.add(0);
		}
		s.set(2,1);
		for(int i=3;i<=a;i=i+2) s.set(i,1);
		for(int i=3;i<=Math.sqrt(a);i=i+2){
			if(s.get(i) == 0) continue;
			for(int j=i+i;j<=a;j=j+i)s.set(j,0);
		}		
		return s;

	}

	

		public static void main(String args[]) throws IOException{

			Scanner scan = new Scanner(System.in);

			int n,count;
			ArrayList<Integer> a = new ArrayList<Integer>();

			ArrayList<Integer> res = new ArrayList<Integer>();


			while(scan.hasNext()){
				count = 1;

				String str1 = scan.next();

				n = Integer.valueOf(str1).intValue();

				if(n != 1){
				a = sum_check(n);
				for(int i=3;i<=n;i=i+2){
					if(a.get(i) == 1)count++;
				}
				res.add(count);
				}
				else res.add(0);

			}
			for(int i=0;i<res.size();i++){
				System.out.println(res.get(i));
			}

		}

}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.*;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.math.*;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:10:16: error: expected ':' before 'static'
   10 |         private static ArrayList<Integer> sum_check(int a){
      |                ^~~~~~~
      |                :
a.cc:10:24: error: 'ArrayList' does not name a type
   10 |         private static ArrayList<Integer> sum_check(int a){
      |                        ^~~~~~~~~
a.cc:30:23: error: expected ':' before 'static'
   30 |                 public static void main(String args[]) throws IOException{
      |                       ^~~~~~~
      |                       :
a.cc:30:41: error: 'String' has not been declared
   30 |                 public static void main(String args[]) throws IOException{
      |                                         ^~~~~~
a.cc:30:54: error: expected ';' at end of member declaration
   30 |                 public static void main(String args[]) throws IOException{
      |                                                      ^
      |                                                       ;
a.cc:30:56: error: 'throws' does not name a type
   30 |                 public static void main(String args[]) throws IOException{
      |                                                        ^~~~~~
a.cc:63:2: error: expected ';' after class definition
   63 | }
      |  ^
      |  ;
Language: C++

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

int main()
{
	
	long long int k,p[100000];
	long long int n;
	time_t time1,time2;
	p[0]=2;
cin>>n;
		time(&time1);
		if(n<0){
			break;
		}
	k=0;
	int r=(int)sqrt((float)n);
	for(int i=3;i<=r;i++){
		for(int j=0;j<k+1;j++){
			if(i%p[j]==0){
				break;
			}else if(j==k){
				k++;
				cout<<i<<endl;
				p[k]=i;
			}
		}
	}
	long long int r_k=k;
	for(;r<n;r++){
		for(long int i=0;i<=r_k;i++){
			if(r%p[i]==0){
				break;
			}else if(i==r_k){
				k++;
				cout<<r<<endl;
			}
		}
	}
	time(&time2);
	if(k!=0&&k!=1){
		k+=1;
		cout<<k<<endl;
	}else{
		cout<<k<<endl;
	}
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:25: error: break statement not within loop or switch
   17 |                         break;
      |                         ^~~~~
Language: C++

#include<iostream>
#include<string>
#include<cmath>

using namespace std;

int main()
{
	
	long long int k,p[100000];
	long long int n;
	p[0]=2;
cin>>n;

		if(n<0){
			break;
		}
	k=0;
	int r=(int)sqrt((float)n);
	for(int i=3;i<=r;i++){
		for(int j=0;j<k+1;j++){
			if(i%p[j]==0){
				break;
			}else if(j==k){
				k++;
				cout<<i<<endl;
				p[k]=i;
			}
		}
	}
	long long int r_k=k;
	for(;r<n;r++){
		for(long int i=0;i<=r_k;i++){
			if(r%p[i]==0){
				break;
			}else if(i==r_k){
				k++;
				cout<<r<<endl;
			}
		}
	}
	if(k!=0&&k!=1){
		k+=1;
		cout<<k<<endl;
	}else{
		cout<<k<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: break statement not within loop or switch
   16 |                         break;
      |                         ^~~~~
Language: C++

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

Compiler output:
a.cc:1:5: warning: multi-character character constant [-Wmultichar]
    1 | j,a['   '],s;main(i){for(;++i<1e6;){if(!a[i])for(j=i;j<1e6;)a[j+=i]=1;a[i]=s+=!a[i];}for(;~scanf("%d",&i);printf("%d\n",a[i]));}
      |     ^~~~~
a.cc:1:1: error: 'j' does not name a type
    1 | j,a['   '],s;main(i){for(;++i<1e6;){if(!a[i])for(j=i;j<1e6;)a[j+=i]=1;a[i]=s+=!a[i];}for(;~scanf("%d",&i);printf("%d\n",a[i]));}
      | ^
a.cc:1:18: error: expected constructor, destructor, or type conversion before '(' token
    1 | j,a['   '],s;main(i){for(;++i<1e6;){if(!a[i])for(j=i;j<1e6;)a[j+=i]=1;a[i]=s+=!a[i];}for(;~scanf("%d",&i);printf("%d\n",a[i]));}
      |                  ^
Language: C++

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

Compiler output:
a.cc:1:5: warning: multi-character character constant [-Wmultichar]
    1 | j,a['   '],s;main(i){for(;++i<1e6||~scanf("%d",&j)&&printf("%d\n",a[j]);)for(s+=!a[j=i];j<1e6;a[i]=s)a[j+=i]=1;}
      |     ^~~~~
a.cc:1:1: error: 'j' does not name a type
    1 | j,a['   '],s;main(i){for(;++i<1e6||~scanf("%d",&j)&&printf("%d\n",a[j]);)for(s+=!a[j=i];j<1e6;a[i]=s)a[j+=i]=1;}
      | ^
a.cc:1:18: error: expected constructor, destructor, or type conversion before '(' token
    1 | j,a['   '],s;main(i){for(;++i<1e6||~scanf("%d",&j)&&printf("%d\n",a[j]);)for(s+=!a[j=i];j<1e6;a[i]=s)a[j+=i]=1;}
      |                  ^
Language: C++

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

Compiler output:
a.cc:1:5: warning: multi-character character constant [-Wmultichar]
    1 | j,a['   '],s;main(i){for(;++i<1e6||~scanf(s="%d\n",&j)&&printf(s,a[j]);)for(a[i]=s+=!a[j=i];j<1e6;a[j+=i]=1);}
      |     ^~~~~
a.cc:1:1: error: 'j' does not name a type
    1 | j,a['   '],s;main(i){for(;++i<1e6||~scanf(s="%d\n",&j)&&printf(s,a[j]);)for(a[i]=s+=!a[j=i];j<1e6;a[j+=i]=1);}
      | ^
a.cc:1:18: error: expected constructor, destructor, or type conversion before '(' token
    1 | j,a['   '],s;main(i){for(;++i<1e6||~scanf(s="%d\n",&j)&&printf(s,a[j]);)for(a[i]=s+=!a[j=i];j<1e6;a[j+=i]=1);}
      |                  ^
Language: C++

#include<iostream>
using namespace std;
int main(){
int n;
int max=1;
while(cin>>n){
for(int i=3;i<=n;i+=2){
for(int j=2;j<=i/2+1;j++){
if(i%j==0){max++;goto A;}
}
A:
;
cout<<max<<endl;
max=1;
}
}

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

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

bool is_prime(int n){
for(int i=2;i*i<=n;i++){
if(n % i == 0) return false;
}
return n!=1;
}

int main(){
int n;

while(~scanf("%d",&n)){
int* table =  new int[1000000];
memset(table,sizeof(table),1);
table[0]=0;

for(int i=1;i<=n;i++){
if(!is_prime(i)) {
for(int j=i;j<=n;j*=i){
table[j] = 0;
}
}
}
printf("%d\n",count(table,table+1000000,1));
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:1: error: 'memset' was not declared in this scope
   17 | memset(table,sizeof(table),1);
      | ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <cstdlib>
  +++ |+#include <cstring>
    3 | using namespace std;
a.cc:27:15: error: 'count' was not declared in this scope
   27 | printf("%d\n",count(table,table+1000000,1));
      |               ^~~~~
Language: C++

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <limits>
#include <map>
using namespace std;

bool is_prime(int n){
for(int i=2;i*i<=n;i++){
if(n % i == 0) return false;
}
return n!=1;
}

int main(){
int n;

while(~scanf("%d",&n)){
int* table =  new int[1000000];
memset(table,sizeof(table),1);
table[0]=0;

for(int i=1;i<=n;i++){
if(!is_prime(i)) {
for(int j=i;j<=n;j*=i){
table[j] = 0;
}
}
}
printf("%d\n",count(table,table+1000000,1));
}
}

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

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <limits>
#include <map>
#include <string>
using namespace std;

bool is_prime(int n){
for(int i=2;i*i<=n;i++){
if(n % i == 0) return false;
}
return n!=1;
}

int main(){
int n;

while(~scanf("%d",&n)){
int* table =  new int[1000000];
memset(table,sizeof(table),1);
table[0]=0;

for(int i=1;i<=n;i++){
if(!is_prime(i)) {
for(int j=i;j<=n;j*=i){
table[j] = 0;
}
}
}
printf("%d\n",count(table,table+1000000,1));
}
}

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

#include<iostream>

using namespace std;

int main(void){
	
	long int n,f,k,i;
	int count;
	bool chk;
	scanf("%d",&n)!=EOF);
		count=0;
		for(i=2;i<=n;i++){
		
			chk=0;
			f=i/2;
			k=2;
		
			while(f>=k){
				if((i%k)==0){
					chk=true;
					break;
				}
				k++;
			}
		
			if(chk==false){
				count++;
			}
		}
		cout<<count<<endl;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:28: error: expected ';' before ')' token
   10 |         scanf("%d",&n)!=EOF);
      |                            ^
Language: C++

#include<iostream>

using namespace std;



bool Prime(int n)
{
	if((n==1)||(n==0))
	{
		return false;
	}
	for(int i=2;i<=n-1;++i)
	{
		if(n%i==0)
		{
			return false;
		}
	}
	return true;
}

void main()
{
	int n;
	while(cin>>n)
	{
		int count = 0;
		for(int i=0;i<=n;++i)
		{
			if(Prime(i))
			{
				++count;
			}
		}
		cout<<count<<endl;
	}
}

Compiler output:
a.cc:23:1: error: '::main' must return 'int'
   23 | void main()
      | ^~~~
Language: C++

#include<iostream>

using namespace std;



bool Prime(int n)
{
	if((n==1)||(n==0))
	{
		return false;
	}
	for(int i=2;i<=(int)sqrt((double)n);++i)
	{
		if(n%i==0)
		{
			return false;
		}
	}
	return true;
}

int main()
{
	int n;
	while(cin>>n)
	{
		int count = 0;
		for(int i=0;i<=n;++i)
		{
			if(Prime(i))
			{
				++count;
			}
		}
		cout<<count<<endl;
	}
	return 0;
}

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

#include<iostream>
using namespace std;
 
__forceinline int isPrime(int n){
	//sieve of Eratosthenes
	if(n==2) return 1;
	if(n%2==0 || n<2){
		return 0;
	}

	for(int i=3; i*i<=n; i+=2){
		if(n%i==0){
			return 0;
		}
	}
	return 1;

}

//0009
int main()
{
	int n;
 
	while(cin >> n){
		int cnt = 0;
		for(; n>1; n--){
			if(isPrime(n))
				++cnt;
		}
		cout << cnt << endl;
	}
  return 0;
}

Compiler output:
a.cc:4:1: error: '__forceinline' does not name a type
    4 | __forceinline int isPrime(int n){
      | ^~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:28:28: error: 'isPrime' was not declared in this scope
   28 |                         if(isPrime(n))
      |                            ^~~~~~~
Language: C++

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

using namespace std;

bool t[1000000];

int main(){
	memset(t,1,sizeof(t));
	t[0] = t[1] = false;
	for(int i = 2; i < 1000; i++){
		if(t[i])
			for(int j = 2 * i; j < 1000000; j += i){
				t[j] = false;
			}
	}

	int n;
	while(cin>>n){
		int ans = 0;
		for (int i = 0; i <= n; i++)
		{
			ans += t[i];
		}
		cout << ans << endl;
	}

	return 0;
}

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

#include	<stdio.h>

bool isPrimeNumber(int number){
	if(number	  == 2)	return true;
	if(number % 2 == 0)	return false;
	
	for(int i = 3; i <= sqrt(number) ;i += 2){
		if(number % i == 0)	return false;
	}
	
	return true;
}

int main(int argc, char** argv){
	
	int search, counter;
	
	while((scanf("%d", &search)) != EOF){
		counter = 0;
		for(int i = 2; i <= search; i++){
			counter += isPrimeNumber(i) ? 1 : 0;		
		}
		printf("%d\n", counter);
	}
	
	return 0;
}

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