stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <string>

#include <cstring>

#include <cmath>

#include <algorithm>

#include <vector>

#include <queue>

using namespace std;

#define MAX 1000000

#define LMT 1000

unsigned flag[MAX>>6];

int primes[6000000];//5761455

#define ifc(n) (flag[n>>6]&(1<<((n>>1)&31)))

#define isc(n) (flag[n>>6]|=(1<<((n>>1)&31)))



int sieve()

{

    unsigned i, j, k;

    for(i=3; i<LMT; i+=2)

        if(!ifc(i))

            for(j=i*i, k=i<<1; j<MAX; j+=k)

                isc(j);

    return 0;

}



int main()

{

    sieve();

    unsigned int i,L;

    int k=1, count;

    primes[0]=2;

    while(scanf("%d", &L)==1)

    {

        count=1;

        for( i=3; i<=L; i+=2)

        {

            if(ifc(i)==0)

                count++;

        }

        if(L>1)

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

        else printf("0\n");

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.3715891925619452x):
#include <iostream>

#include<stdio.h>

#include<cstring>

#include<algorithm>

using namespace std;

typedef long long ll;

#define MAX 1000000



bool is_prime[MAX];

ll prime[MAX];



ll found(ll a)

{

    ll p=0;

    for(ll i=0;i<=a;i++)

    {

        is_prime[i]=true;

    }

    is_prime[0]=false;

    is_prime[1]=false;

    for(ll i=2;i<=a;i++)

    {

        if(is_prime[i])

        {

            prime[p++]=i;

            for(ll k=2*i;k<=a;k=k+i)

            {

                is_prime[k]=false;

            }

        }

    }

    return p;

}



int main()

{

    ll n;

    while(cin>>n)

    {

        ll q;

        q=found(n);

        cout<<q<<endl;

    }

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

#include<cmath>

using namespace std;



bool prime[1000000];



int main()

{

    int i,j,k,l,m,n;

    int count;

    while(cin>>n)

    {

        memset(prime,0,sizeof(prime));

        prime[1]=1;

        prime[2]=0;



        count=0;



        for(j=2;j*j<=n;j++)

        {

            if(prime[j]==0)

            {

                for(k=2;k*j<=n;k++)

                {

                   prime[j*k]=1;

                }

            }

        }

        for(i=1;i<=n;i++)

        {

            if(prime[i]==0)

            count++;

        }

        cout << count << endl;

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.259635491468363x):
#include <iostream>

#include<stdio.h>

#include<cstring>

#include<algorithm>

using namespace std;

typedef long long ll;

#define MAX 1000000



bool is_prime[MAX];

ll prime[MAX];



ll found(ll a)

{

    ll p=0;

    for(ll i=0;i<=a;i++)

    {

        is_prime[i]=true;

    }

    is_prime[0]=false;

    is_prime[1]=false;

    for(ll i=2;i<=a;i++)

    {

        if(is_prime[i])

        {

            prime[p++]=i;

            for(ll k=2*i;k<=a;k=k+i)

            {

                is_prime[k]=false;

            }

        }

    }

    return p;

}



int main()

{

    ll n;

    while(cin>>n)

    {

        ll q;

        q=found(n);

        cout<<q<<endl;

    }

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

#include<math.h>

using namespace std;

const int MAX = 1000000;

int prime(int n)

{

	int ans = 0;

	bool prime[MAX];

	memset(prime, 0, sizeof(prime));

	for (int i = 2; i < n;i++)  

	{ 

		for (int j = 2; j <= n / i; j++)

		{

			if (i*j <= n)

				prime[i*j] = 1;

		}

	}

	for (int i = 2; i <= n; i++)

	{

		if (!prime[i])

			ans++;

	}

	return ans;

}

int main()

{

	int n, m = 0;

	while (cin >> n&&m<30)

	{

		cout << prime(n) << endl;

		m++;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.2744303137244675x):
#include <iostream>

#include<stdio.h>

#include<cstring>

#include<algorithm>

using namespace std;

typedef long long ll;

#define MAX 1000000



bool is_prime[MAX];

ll prime[MAX];



ll found(ll a)

{

    ll p=0;

    for(ll i=0;i<=a;i++)

    {

        is_prime[i]=true;

    }

    is_prime[0]=false;

    is_prime[1]=false;

    for(ll i=2;i<=a;i++)

    {

        if(is_prime[i])

        {

            prime[p++]=i;

            for(ll k=2*i;k<=a;k=k+i)

            {

                is_prime[k]=false;

            }

        }

    }

    return p;

}



int main()

{

    ll n;

    while(cin>>n)

    {

        ll q;

        q=found(n);

        cout<<q<<endl;

    }

    return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<string.h>

using namespace std;

int pNum;

bool IsPrime[1000010];

int Prime[1000010];

int GetPrime(int n){

    memset(IsPrime,true,sizeof(IsPrime));

    IsPrime[0]=IsPrime[1]=false;

    pNum=0;

    for(int i=2;i<=n;i++){

        if(IsPrime[i])Prime[++pNum]=i;

        for(int j=1;j<=pNum&&Prime[j]*i<=n;j++){

            IsPrime[Prime[j]*i]=false;

            if(i%Prime[j]==0)break;

        }

    }

    return pNum;

}

int main(){

    int n;

    while(~scanf("%d",&n)){

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

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.4295186477761597x):
#include <iostream>

#include<stdio.h>

#include<cstring>

#include<algorithm>

using namespace std;

typedef long long ll;

#define MAX 1000000



bool is_prime[MAX];

ll prime[MAX];



ll found(ll a)

{

    ll p=0;

    for(ll i=0;i<=a;i++)

    {

        is_prime[i]=true;

    }

    is_prime[0]=false;

    is_prime[1]=false;

    for(ll i=2;i<=a;i++)

    {

        if(is_prime[i])

        {

            prime[p++]=i;

            for(ll k=2*i;k<=a;k=k+i)

            {

                is_prime[k]=false;

            }

        }

    }

    return p;

}



int main()

{

    ll n;

    while(cin>>n)

    {

        ll q;

        q=found(n);

        cout<<q<<endl;

    }

    return 0;

}
// Slower C++ solution:
#include<stdio.h>

#include<math.h>

bool flag[1000000];

int main(void)

{

	long long i,j,p,n,count;

	p = (long long)sqrt(1000000.0);

	for(i = 3; i <= p; i = i + 2)

	{

		if(flag[i] == false)

		{

			for(j = i * i; j <= 1000000; j = j + 2 * i)

			{

				flag[j] = true;

				

			}

		}

	}

		

	while((scanf("%lld",&n)) != EOF)

	{

		

		if(n == 1 || n == 0)

			count = 0;

		else

		{

			count = 1;

			for(i = 3; i <= n; i = i + 2)

			{

				if(flag[i] == false)

					count++;

			}

		}

		printf("%lld\n",count);

	}

	



		

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.4680758285037356x):
#include<stdio.h>

#include<string.h>

#include<iostream>

using namespace std;

int prime[1000010];

bool is_prime[1000010];

int sieve(int n)

{

    int p(0);

    for(int i=0;i<=n;i++)

        is_prime[i]=1;

    is_prime[0]=is_prime[1]=0;

    for(int i=2;i<=n;i++)

    {

        if(is_prime[i])

        {

            prime[p++]=i;

            for(int j=2*i;j<=n;j+=i)

                is_prime[j]=0;

        }

    }

    return p;

}

int main()

{

    //freopen("input.txt","r",stdin);

    int n;

    while(cin>>n)

    {

        cout<<sieve(n)<<"\n";

    }









	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <string>

#include <cstring>

#include <cmath>

#include <algorithm>

#include <vector>

#include <queue>

using namespace std;

#define MAX 1000000

#define LMT 1000

unsigned flag[MAX>>6];

int primes[6000000];//5761455

#define ifc(n) (flag[n>>6]&(1<<((n>>1)&31)))

#define isc(n) (flag[n>>6]|=(1<<((n>>1)&31)))



int sieve()

{

    unsigned i, j, k;

    for(i=3; i<LMT; i+=2)

        if(!ifc(i))

            for(j=i*i, k=i<<1; j<MAX; j+=k)

                isc(j);

    return 0;

}



int main()

{

    sieve();

    unsigned int i,L;

    int k=1, count;

    primes[0]=2;

    while(scanf("%d", &L)==1)

    {

        count=1;

        for( i=3; i<=L; i+=2)

        {

            if(ifc(i)==0)

                count++;

        }

        if(L>1)

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

        else printf("0\n");

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.3706714417189696x):
#include<stdio.h>

#include<string.h>

#include<iostream>

using namespace std;

int prime[1000010];

bool is_prime[1000010];

int sieve(int n)

{

    int p(0);

    for(int i=0;i<=n;i++)

        is_prime[i]=1;

    is_prime[0]=is_prime[1]=0;

    for(int i=2;i<=n;i++)

    {

        if(is_prime[i])

        {

            prime[p++]=i;

            for(int j=2*i;j<=n;j+=i)

                is_prime[j]=0;

        }

    }

    return p;

}

int main()

{

    //freopen("input.txt","r",stdin);

    int n;

    while(cin>>n)

    {

        cout<<sieve(n)<<"\n";

    }









	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

#include<cmath>

using namespace std;



bool prime[1000000];



int main()

{

    int i,j,k,l,m,n;

    int count;

    while(cin>>n)

    {

        memset(prime,0,sizeof(prime));

        prime[1]=1;

        prime[2]=0;



        count=0;



        for(j=2;j*j<=n;j++)

        {

            if(prime[j]==0)

            {

                for(k=2;k*j<=n;k++)

                {

                   prime[j*k]=1;

                }

            }

        }

        for(i=1;i<=n;i++)

        {

            if(prime[i]==0)

            count++;

        }

        cout << count << endl;

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.258761064150337x):
#include<stdio.h>

#include<string.h>

#include<iostream>

using namespace std;

int prime[1000010];

bool is_prime[1000010];

int sieve(int n)

{

    int p(0);

    for(int i=0;i<=n;i++)

        is_prime[i]=1;

    is_prime[0]=is_prime[1]=0;

    for(int i=2;i<=n;i++)

    {

        if(is_prime[i])

        {

            prime[p++]=i;

            for(int j=2*i;j<=n;j+=i)

                is_prime[j]=0;

        }

    }

    return p;

}

int main()

{

    //freopen("input.txt","r",stdin);

    int n;

    while(cin>>n)

    {

        cout<<sieve(n)<<"\n";

    }









	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

#include<math.h>

using namespace std;

const int MAX = 1000000;

int prime(int n)

{

	int ans = 0;

	bool prime[MAX];

	memset(prime, 0, sizeof(prime));

	for (int i = 2; i < n;i++)  

	{ 

		for (int j = 2; j <= n / i; j++)

		{

			if (i*j <= n)

				prime[i*j] = 1;

		}

	}

	for (int i = 2; i <= n; i++)

	{

		if (!prime[i])

			ans++;

	}

	return ans;

}

int main()

{

	int n, m = 0;

	while (cin >> n&&m<30)

	{

		cout << prime(n) << endl;

		m++;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.2735501611481883x):
#include<stdio.h>

#include<string.h>

#include<iostream>

using namespace std;

int prime[1000010];

bool is_prime[1000010];

int sieve(int n)

{

    int p(0);

    for(int i=0;i<=n;i++)

        is_prime[i]=1;

    is_prime[0]=is_prime[1]=0;

    for(int i=2;i<=n;i++)

    {

        if(is_prime[i])

        {

            prime[p++]=i;

            for(int j=2*i;j<=n;j+=i)

                is_prime[j]=0;

        }

    }

    return p;

}

int main()

{

    //freopen("input.txt","r",stdin);

    int n;

    while(cin>>n)

    {

        cout<<sieve(n)<<"\n";

    }









	return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<string.h>

using namespace std;

int pNum;

bool IsPrime[1000010];

int Prime[1000010];

int GetPrime(int n){

    memset(IsPrime,true,sizeof(IsPrime));

    IsPrime[0]=IsPrime[1]=false;

    pNum=0;

    for(int i=2;i<=n;i++){

        if(IsPrime[i])Prime[++pNum]=i;

        for(int j=1;j<=pNum&&Prime[j]*i<=n;j++){

            IsPrime[Prime[j]*i]=false;

            if(i%Prime[j]==0)break;

        }

    }

    return pNum;

}

int main(){

    int n;

    while(~scanf("%d",&n)){

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

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.428965456714166x):
#include<stdio.h>

#include<string.h>

#include<iostream>

using namespace std;

int prime[1000010];

bool is_prime[1000010];

int sieve(int n)

{

    int p(0);

    for(int i=0;i<=n;i++)

        is_prime[i]=1;

    is_prime[0]=is_prime[1]=0;

    for(int i=2;i<=n;i++)

    {

        if(is_prime[i])

        {

            prime[p++]=i;

            for(int j=2*i;j<=n;j+=i)

                is_prime[j]=0;

        }

    }

    return p;

}

int main()

{

    //freopen("input.txt","r",stdin);

    int n;

    while(cin>>n)

    {

        cout<<sieve(n)<<"\n";

    }









	return 0;

}
// Slower C++ solution:
#include<stdio.h>

#include<math.h>

bool flag[1000000];

int main(void)

{

	long long i,j,p,n,count;

	p = (long long)sqrt(1000000.0);

	for(i = 3; i <= p; i = i + 2)

	{

		if(flag[i] == false)

		{

			for(j = i * i; j <= 1000000; j = j + 2 * i)

			{

				flag[j] = true;

				

			}

		}

	}

		

	while((scanf("%lld",&n)) != EOF)

	{

		

		if(n == 1 || n == 0)

			count = 0;

		else

		{

			count = 1;

			for(i = 3; i <= n; i = i + 2)

			{

				if(flag[i] == false)

					count++;

			}

		}

		printf("%lld\n",count);

	}

	



		

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.508641676991073x):
#include <stdio.h>

#include<iostream>

using namespace std;



const int M = 1000010;

int prime[M];

bool isprime[M];



bool is_prime(int n);  

int sieve(int n);  



int main ( )

{

    int n;

    while(~scanf("%d",&n))

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



    return 0;

}



bool is_prime(int n)

{

    for(int i=2;i*i<=n;i++)

        if(n%i==0)

            return false;



    return n!=1;

}



int sieve(int n)

{

    int p=0,i;

    for( i=0;i<=n;i++)

        isprime[i] = true;

    isprime[0] = isprime[1] = false;

    i++;

    for( i=2;i<=n;i++)

        {

        if(isprime[i])

        {

            prime[p++] = i;

            for(int j=2*i;j<=n;j+=i)

                isprime[j] = false;

        }

    }

    i++;

    return p;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <string>

#include <cstring>

#include <cmath>

#include <algorithm>

#include <vector>

#include <queue>

using namespace std;

#define MAX 1000000

#define LMT 1000

unsigned flag[MAX>>6];

int primes[6000000];//5761455

#define ifc(n) (flag[n>>6]&(1<<((n>>1)&31)))

#define isc(n) (flag[n>>6]|=(1<<((n>>1)&31)))



int sieve()

{

    unsigned i, j, k;

    for(i=3; i<LMT; i+=2)

        if(!ifc(i))

            for(j=i*i, k=i<<1; j<MAX; j+=k)

                isc(j);

    return 0;

}



int main()

{

    sieve();

    unsigned int i,L;

    int k=1, count;

    primes[0]=2;

    while(scanf("%d", &L)==1)

    {

        count=1;

        for( i=3; i<=L; i+=2)

        {

            if(ifc(i)==0)

                count++;

        }

        if(L>1)

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

        else printf("0\n");

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.3984010252902492x):
#include <stdio.h>

#include<iostream>

using namespace std;



const int M = 1000010;

int prime[M];

bool isprime[M];



bool is_prime(int n);  

int sieve(int n);  



int main ( )

{

    int n;

    while(~scanf("%d",&n))

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



    return 0;

}



bool is_prime(int n)

{

    for(int i=2;i*i<=n;i++)

        if(n%i==0)

            return false;



    return n!=1;

}



int sieve(int n)

{

    int p=0,i;

    for( i=0;i<=n;i++)

        isprime[i] = true;

    isprime[0] = isprime[1] = false;

    i++;

    for( i=2;i<=n;i++)

        {

        if(isprime[i])

        {

            prime[p++] = i;

            for(int j=2*i;j<=n;j+=i)

                isprime[j] = false;

        }

    }

    i++;

    return p;

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

#include<cmath>

using namespace std;



bool prime[1000000];



int main()

{

    int i,j,k,l,m,n;

    int count;

    while(cin>>n)

    {

        memset(prime,0,sizeof(prime));

        prime[1]=1;

        prime[2]=0;



        count=0;



        for(j=2;j*j<=n;j++)

        {

            if(prime[j]==0)

            {

                for(k=2;k*j<=n;k++)

                {

                   prime[j*k]=1;

                }

            }

        }

        for(i=1;i<=n;i++)

        {

            if(prime[i]==0)

            count++;

        }

        cout << count << endl;

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.2851816396015234x):
#include <stdio.h>

#include<iostream>

using namespace std;



const int M = 1000010;

int prime[M];

bool isprime[M];



bool is_prime(int n);  

int sieve(int n);  



int main ( )

{

    int n;

    while(~scanf("%d",&n))

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



    return 0;

}



bool is_prime(int n)

{

    for(int i=2;i*i<=n;i++)

        if(n%i==0)

            return false;



    return n!=1;

}



int sieve(int n)

{

    int p=0,i;

    for( i=0;i<=n;i++)

        isprime[i] = true;

    isprime[0] = isprime[1] = false;

    i++;

    for( i=2;i<=n;i++)

        {

        if(isprime[i])

        {

            prime[p++] = i;

            for(int j=2*i;j<=n;j+=i)

                isprime[j] = false;

        }

    }

    i++;

    return p;

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

#include<math.h>

using namespace std;

const int MAX = 1000000;

int prime(int n)

{

	int ans = 0;

	bool prime[MAX];

	memset(prime, 0, sizeof(prime));

	for (int i = 2; i < n;i++)  

	{ 

		for (int j = 2; j <= n / i; j++)

		{

			if (i*j <= n)

				prime[i*j] = 1;

		}

	}

	for (int i = 2; i <= n; i++)

	{

		if (!prime[i])

			ans++;

	}

	return ans;

}

int main()

{

	int n, m = 0;

	while (cin >> n&&m<30)

	{

		cout << prime(n) << endl;

		m++;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.300143723667059x):
#include <stdio.h>

#include<iostream>

using namespace std;



const int M = 1000010;

int prime[M];

bool isprime[M];



bool is_prime(int n);  

int sieve(int n);  



int main ( )

{

    int n;

    while(~scanf("%d",&n))

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



    return 0;

}



bool is_prime(int n)

{

    for(int i=2;i*i<=n;i++)

        if(n%i==0)

            return false;



    return n!=1;

}



int sieve(int n)

{

    int p=0,i;

    for( i=0;i<=n;i++)

        isprime[i] = true;

    isprime[0] = isprime[1] = false;

    i++;

    for( i=2;i<=n;i++)

        {

        if(isprime[i])

        {

            prime[p++] = i;

            for(int j=2*i;j<=n;j+=i)

                isprime[j] = false;

        }

    }

    i++;

    return p;

}
// Slower C++ solution:
#include<cstdio>

#include<string.h>

using namespace std;

int pNum;

bool IsPrime[1000010];

int Prime[1000010];

int GetPrime(int n){

    memset(IsPrime,true,sizeof(IsPrime));

    IsPrime[0]=IsPrime[1]=false;

    pNum=0;

    for(int i=2;i<=n;i++){

        if(IsPrime[i])Prime[++pNum]=i;

        for(int j=1;j<=pNum&&Prime[j]*i<=n;j++){

            IsPrime[Prime[j]*i]=false;

            if(i%Prime[j]==0)break;

        }

    }

    return pNum;

}

int main(){

    int n;

    while(~scanf("%d",&n)){

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

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.4456799690481468x):
#include <stdio.h>

#include<iostream>

using namespace std;



const int M = 1000010;

int prime[M];

bool isprime[M];



bool is_prime(int n);  

int sieve(int n);  



int main ( )

{

    int n;

    while(~scanf("%d",&n))

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



    return 0;

}



bool is_prime(int n)

{

    for(int i=2;i*i<=n;i++)

        if(n%i==0)

            return false;



    return n!=1;

}



int sieve(int n)

{

    int p=0,i;

    for( i=0;i<=n;i++)

        isprime[i] = true;

    isprime[0] = isprime[1] = false;

    i++;

    for( i=2;i<=n;i++)

        {

        if(isprime[i])

        {

            prime[p++] = i;

            for(int j=2*i;j<=n;j+=i)

                isprime[j] = false;

        }

    }

    i++;

    return p;

}
// Slower C++ solution:
#include<stdio.h>

#include<math.h>

bool flag[1000000];

int main(void)

{

	long long i,j,p,n,count;

	p = (long long)sqrt(1000000.0);

	for(i = 3; i <= p; i = i + 2)

	{

		if(flag[i] == false)

		{

			for(j = i * i; j <= 1000000; j = j + 2 * i)

			{

				flag[j] = true;

				

			}

		}

	}

		

	while((scanf("%lld",&n)) != EOF)

	{

		

		if(n == 1 || n == 0)

			count = 0;

		else

		{

			count = 1;

			for(i = 3; i <= n; i = i + 2)

			{

				if(flag[i] == false)

					count++;

			}

		}

		printf("%lld\n",count);

	}

	



		

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.470140365972928x):
#include <bits/stdc++.h>

using namespace std;

int main()

{

    int n;

    while (scanf ("%d",&n)!=EOF)

    {

    int prime[n+1],i,j;

    for (i=0;i<=n;i++)

        prime[i]=1;

    prime[0]=0;

    prime[1]=0;

    for (i=2;i<=sqrt(n);i++)

    {

        if (prime[i]==1)

        {

            for(j=2;i*j<=n;j++)

                prime[i*j]=0;

        }

    }

    int cnt=0;

    for (i=0;i<=n;i++)

    {

        if (prime[i]!=0)

            cnt++;

    }

    cout<<cnt<<endl;

    }

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <string>

#include <cstring>

#include <cmath>

#include <algorithm>

#include <vector>

#include <queue>

using namespace std;

#define MAX 1000000

#define LMT 1000

unsigned flag[MAX>>6];

int primes[6000000];//5761455

#define ifc(n) (flag[n>>6]&(1<<((n>>1)&31)))

#define isc(n) (flag[n>>6]|=(1<<((n>>1)&31)))



int sieve()

{

    unsigned i, j, k;

    for(i=3; i<LMT; i+=2)

        if(!ifc(i))

            for(j=i*i, k=i<<1; j<MAX; j+=k)

                isc(j);

    return 0;

}



int main()

{

    sieve();

    unsigned int i,L;

    int k=1, count;

    primes[0]=2;

    while(scanf("%d", &L)==1)

    {

        count=1;

        for( i=3; i<=L; i+=2)

        {

            if(ifc(i)==0)

                count++;

        }

        if(L>1)

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

        else printf("0\n");

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.3720826969107818x):
#include <bits/stdc++.h>

using namespace std;

int main()

{

    int n;

    while (scanf ("%d",&n)!=EOF)

    {

    int prime[n+1],i,j;

    for (i=0;i<=n;i++)

        prime[i]=1;

    prime[0]=0;

    prime[1]=0;

    for (i=2;i<=sqrt(n);i++)

    {

        if (prime[i]==1)

        {

            for(j=2;i*j<=n;j++)

                prime[i*j]=0;

        }

    }

    int cnt=0;

    for (i=0;i<=n;i++)

    {

        if (prime[i]!=0)

            cnt++;

    }

    cout<<cnt<<endl;

    }

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

#include<cmath>

using namespace std;



bool prime[1000000];



int main()

{

    int i,j,k,l,m,n;

    int count;

    while(cin>>n)

    {

        memset(prime,0,sizeof(prime));

        prime[1]=1;

        prime[2]=0;



        count=0;



        for(j=2;j*j<=n;j++)

        {

            if(prime[j]==0)

            {

                for(k=2;k*j<=n;k++)

                {

                   prime[j*k]=1;

                }

            }

        }

        for(i=1;i<=n;i++)

        {

            if(prime[i]==0)

            count++;

        }

        cout << count << endl;

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.2601056993548396x):
#include <bits/stdc++.h>

using namespace std;

int main()

{

    int n;

    while (scanf ("%d",&n)!=EOF)

    {

    int prime[n+1],i,j;

    for (i=0;i<=n;i++)

        prime[i]=1;

    prime[0]=0;

    prime[1]=0;

    for (i=2;i<=sqrt(n);i++)

    {

        if (prime[i]==1)

        {

            for(j=2;i*j<=n;j++)

                prime[i*j]=0;

        }

    }

    int cnt=0;

    for (i=0;i<=n;i++)

    {

        if (prime[i]!=0)

            cnt++;

    }

    cout<<cnt<<endl;

    }

}