stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int n,a,sum=0;

    cin>>n;

    a=n;

    for(int i=n;i>=1;i--)

    {

        sum=sum+n%10;

        n=n/10;



    }

    if(a%sum==0) cout<<"Yes"<<endl;

    else cout<<"No"<<endl;



    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	int input;

	int temp=0;

	scanf ("%d",&input);

	int cek=input;

	while(input>0){

		temp+=input%10;

		input/=10;

	}

	//printf ("%d",temp);

	if(cek%temp==0){

		printf ("Yes\n");

	}else printf ("No\n");

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>



using namespace std;



int main()

{

    long long value;

    while(cin >> value){

        int divisor = 0;

            int temp = value;

            while(temp!=0){

                divisor += temp%10;

                temp /=10;

            }

            if(value%divisor == 0){

                cout << "Yes" << endl;

            }

            else

                cout << "No" << endl;

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	int input;

	int temp=0;

	scanf ("%d",&input);

	int cek=input;

	while(input>0){

		temp+=input%10;

		input/=10;

	}

	//printf ("%d",temp);

	if(cek%temp==0){

		printf ("Yes\n");

	}else printf ("No\n");

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

int main()

{

    int n,d,a,sum=0;

    cin>>n;

    a=n;

    while(a>0){

    d=a%10;

    sum=sum+d;

    a=a/10;

    }

    if(n%sum==0)

    printf("Yes\n");

    else

    printf("No\n");

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	int input;

	int temp=0;

	scanf ("%d",&input);

	int cek=input;

	while(input>0){

		temp+=input%10;

		input/=10;

	}

	//printf ("%d",temp);

	if(cek%temp==0){

		printf ("Yes\n");

	}else printf ("No\n");

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

long long n, s, t, a[100005], b[100005];

int main() {

	int i;

	scanf("%lld", &n);

	for(i=1; i<=n; i++) scanf("%lld", &a[i]), b[i]=a[i];

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

		a[i] += a[i-1];

		if(i%2) {

			if(a[i]<=0) s += 1-a[i], a[i]=1;

		} else {

			if(a[i]>=0) s += a[i]+1, a[i]=-1;

		}

	}

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

		b[i] += b[i-1];

		if(i%2) {

			if(b[i]>=0) t += b[i]+1, b[i]=-1;

		} else {

			if(b[i]<=0) t += 1-b[i], b[i]=1;

		}

	}

	printf("%lld", std::min(s,t));

	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

long long n, s, x, y, a[100005];

int main() {

	int i;

	scanf("%lld", &n);

	for(i=0; i<n; i++) scanf("%lld", &a[i]);

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

		s += a[i];

		if(i%2) {

			if(s<=0) x += 1-s, s=1;

		} else {

			if(s>=0) x += s+1, s=-1;

		}

	}

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

		s += a[i];

		if(i%2) {

			if(s>=0) y += s+1, s=-1;

		} else {

			if(s<=0) y += 1-s, s=1;

		}

	}

	printf("%lld", x<y ? x:y);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include "bits/stdc++.h"

using namespace std;

#define ll long long int

#define rep(i,n) for( int i = 0; i < n; i++ )

#define rrep(i,n) for( int i = n; i >= 0; i-- )

#define REP(i,s,t) for( int i = s; i <= t; i++ )

#define RREP(i,s,t) for( int i = s; i >= t; i-- )

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define INF 2000000000

#define mod 1000000007

#define INF2 1000000000000000000

#define int long long



signed main(void)

{

    cin.tie(0);

    ios::sync_with_stdio(false);

    int n; cin >> n;

    int a[100010];

    rep(i, n) cin >> a[i + 1];

    int ans[2] = {};

    rep(j, 2) {

        int sum[100010] = {};

        REP(i, 1, n) {

            sum[i] += sum[i - 1] + a[i];

            if (i % 2 == j && sum[i] >= 0) {

                ans[j] += sum[i] + 1;

                sum[i] -= sum[i] + 1;

            } 

            else if(i % 2 == (j + 1) % 2 && sum[i] <= 0) {

                ans[j] += 1 - sum[i];

                sum[i] += 1 - sum[i];

            }

        }

    }

    cout << min(ans[0], ans[1]) << endl;



    return 0;

}


// Optimized solution to the same problem (faster):
#include "bits/stdc++.h"

using namespace std;

#define ll long long int

#define rep(i,n) for( int i = 0; i < n; i++ )

#define rrep(i,n) for( int i = n; i >= 0; i-- )

#define REP(i,s,t) for( int i = s; i <= t; i++ )

#define RREP(i,s,t) for( int i = s; i >= t; i-- )

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define INF 2000000000

#define mod 1000000007

#define INF2 1000000000000000000





int main(void)

{

    cin.tie(0);

    ios::sync_with_stdio(false);

    int n; cin >> n;

    int a[100010];

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

        cin >> a[i];

    }

    

    ll ans = INF2;

    for (int k = 0; k < 2; k++) {

        ll tmp = 0;

        ll sum = 0;

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

            sum += a[i];

            if ((k + i) % 2 == 0 && sum <= 0) {

                tmp += abs(1 - sum);

                sum = 1;

                

            } else if ((k + i) % 2 == 1 && sum >= 0) {

                tmp += abs(-1 - sum);

                sum = -1;

            }

            //cout << sum << " " << tmp << endl;

        }

        //cout << endl;

        ans = min(ans, tmp);

    }

    cout << ans << endl;



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

#define MAX 1000000

int prime[MAX];

bool is_prime[MAX];

int sieve(int n){   //埃氏?

   int p=0;

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

    is_prime[i]=true;

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

   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]=false;

    }

   }

   return p;

}

int main()

{

  int num;

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

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

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

#define MAX 1000000

int prime[MAX];

bool is_prime[MAX];

int sieve(int n){   //埃氏?

   int p=0;

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

    is_prime[i]=true;

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

   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]=false;

    }

   }

   return p;

}

int main()

{

  int num;

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

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

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

#define MAX 1000000

int prime[MAX];

bool is_prime[MAX];

int sieve(int n){   //埃氏?

   int p=0;

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

    is_prime[i]=true;

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

   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]=false;

    }

   }

   return p;

}

int main()

{

  int num;

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

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

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

#define MAX 1000000

int prime[MAX];

bool is_prime[MAX];

int sieve(int n){   //埃氏?

   int p=0;

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

    is_prime[i]=true;

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

   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]=false;

    }

   }

   return p;

}

int main()

{

  int num;

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

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

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstring>

#include <cmath>



using namespace std;





int main()

{

    unsigned int n;

    while( cin >> n )

    {

        bool *prime = new bool[n+2];

        unsigned int k, allprime = 0;



        memset( prime, false, n+2 );

        prime[2] = true;

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

        {

            if( i % 2 == 0 )

            {

                prime[i] = false;

            }

            else

            {

                prime[i] = true;

            }

        }

        k = sqrt( n );

        for( int i = 3; i <= k; i++ )

        {

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

            {

                prime[j] = false;

            }

        }

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

        {

            if( prime[i] )

            {

                allprime++;

            }

        }

        cout << allprime << '\n';

    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

#define MAX 1000000

int prime[MAX];

bool is_prime[MAX];

int sieve(int n){   //埃氏?

   int p=0;

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

    is_prime[i]=true;

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

   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]=false;

    }

   }

   return p;

}

int main()

{

  int num;

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

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

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cmath>

using namespace std;

bool prime[1000000] = {false};

int main(){

    int n;

    while(cin >> n){

       

        prime[1] = true;

        prime[2] = false;

        int count = 0;

        

      

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

            if(!prime[j]){

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

                   prime[j*k] = true;

                }

            }

        }

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

            if(!prime[i]) count = count +1;

        }

        cout << count << endl;

    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

#define MAX 1000000

int prime[MAX];

bool is_prime[MAX];

int sieve(int n){   //埃氏?

   int p=0;

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

    is_prime[i]=true;

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

   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]=false;

    }

   }

   return p;

}

int main()

{

  int num;

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

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

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):


#include<iostream>

#include<cstdio>

#include<cstdlib>

using namespace std;



const int MAX_N = 999999;

int prime[MAX_N];

bool is_prime[MAX_N + 1];



int sieve(int n)

{

	int p = 0;

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

		is_prime[i] = true;

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



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

	{

		if (is_prime[i])

		{

			prime[p++] = i;

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

				is_prime[j] = false;

		}

	}

		return p;

}



int main()

{

	int n;

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

	{

		int ans = sieve(n);

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

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

#define MAX 1000000

int prime[MAX];

bool is_prime[MAX];

int sieve(int n){   //埃氏?

   int p=0;

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

    is_prime[i]=true;

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

   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]=false;

    }

   }

   return p;

}

int main()

{

  int num;

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

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

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdlib>

#include<algorithm>

#include<cstdio>

using namespace std;



//C



const int MAX_N = 1000000;

int prime[MAX_N];

bool is_prime[MAX_N + 1];



int sieve(int n){

	int p = 0;

	for (int i = 0; i <= n; i++)is_prime[i] = true;

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

	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] = false;

		}

	}

	return p;

}



int main(){

	int n;

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

	{

		int ans = sieve(n);

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

	}

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

#define MAX 1000000

int prime[MAX];

bool is_prime[MAX];

int sieve(int n){   //埃氏?

   int p=0;

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

    is_prime[i]=true;

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

   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]=false;

    }

   }

   return p;

}

int main()

{

  int num;

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

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

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<cmath>

#define size 20000000

using namespace std;

int find_prime(int n)

{

    int count =0;

    bool *numberList=new bool[size+1];

    for(unsigned long i=3;i<=sqrt(n);i+=2)

    {

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

            numberList[i*j]=true;

    }

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

    {

        if(!numberList[i])

            count++;

    }



    return count;



}

int main ()

{

    int n;

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

    {

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

            printf("0\n");

        else if(n==2)

            printf("1\n");



        else

        {

        int v=0;

        v=find_prime(n);

        printf("%d\n",v+1);

        }

    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

#define MAX 1000000

int prime[MAX];

bool is_prime[MAX];

int sieve(int n){   //埃氏?

   int p=0;

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

    is_prime[i]=true;

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

   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]=false;

    }

   }

   return p;

}

int main()

{

  int num;

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

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

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

bool Eratosthenes[999999+30];



int main()

{

    int n,pos;

    int c;



    while(cin>>n)

    {

        c=0;

        Eratosthenes[1]=false;



        for(int i=2; i<=n; i++) Eratosthenes[i]=true;

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

        {

            if(Eratosthenes[i]==true)

            {

                pos=2*i;

                while(pos<=n)

                {

                    Eratosthenes[pos]=false;

                    pos=pos+i;

                }

            }

        }

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

        {

            if(Eratosthenes[i]==true)

                c++;

        }

        cout<<c<<endl;



    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

#define MAX 1000000

int prime[MAX];

bool is_prime[MAX];

int sieve(int n){   //埃氏?

   int p=0;

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

    is_prime[i]=true;

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

   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]=false;

    }

   }

   return p;

}

int main()

{

  int num;

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

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

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e7+1;

int prime[maxn];

bool is_prime[maxn];



int sieve(int n) {

    int p = 0;

    for(int i = 1; i <= n; i ++) is_prime[i] = true;

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

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

        if(is_prime[i]) {

            prime[p++] = i;

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

                is_prime[j] = false;

            }

        }

    }

    return p;

}



int main() {

    int n;

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

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

    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

#define MAX 1000000

int prime[MAX];

bool is_prime[MAX];

int sieve(int n){   //埃氏?

   int p=0;

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

    is_prime[i]=true;

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

   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]=false;

    }

   }

   return p;

}

int main()

{

  int num;

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

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

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<iostream>

#include<algorithm>

#include<cmath>

#include<cstring>

#include<string>

#include<cstdlib>

#include<ctime>

#include<stack>

#include<queue>

#include<set>

#include<map>

#include<vector>

#define mem(name,value) memset(name,value,sizeof(name))

#define loop(i,from,to) for(int i=from;i<to;i++)

#define loopr(i,from,to) for(int i=from;i>=to;i--)

#define pb push_back

using namespace std;

typedef long long ll;

typedef unsigned long long ull;

typedef pair<int,int> P;

const int INF=0x3f3f3f3f;



const int maxn=1000000+5;

int pr[maxn];

bool is_pr[maxn];



int sieve(int n){

    int p=0;

    loop(i,0,n+1) is_pr[i]=true;

    is_pr[0]=is_pr[1]=false;

    loop(i,2,n+1){

        if(is_pr[i]){

            pr[p++]=i;

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

                is_pr[j]=false;

        }

    }

    return p;

}



int main()

{

    int n;

    while(cin>>n)

        cout<<sieve(n)<<endl;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

#define MAX 1000000

int prime[MAX];

bool is_prime[MAX];

int sieve(int n){   //埃氏?

   int p=0;

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

    is_prime[i]=true;

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

   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]=false;

    }

   }

   return p;

}

int main()

{

  int num;

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

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

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//Author- Simanta Deb Turja

//Team- AUST_HoyeJabe



#include<bits/stdc++.h>

#define pi acos(-1)



typedef unsigned long long ull;

typedef unsigned long ul;

typedef long long ll;

//typedef push_back pb;





using namespace std;



int SieveOfEratosthenes(int n)

{



    bool prime[n+1];

    ull count = 0;

    memset(prime, true, sizeof(prime));



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

    {



        if (prime[p] == true)

        {



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

                prime[i] = false;

        }

    }





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

       if (prime[p])

          count++;

 return count;

}



int main()

{

    int n;

    while(cin>>n){

        cout<<SieveOfEratosthenes(n)<<endl;

    }





    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

#define MAX 1000000

int prime[MAX];

bool is_prime[MAX];

int sieve(int n){   //埃氏?

   int p=0;

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

    is_prime[i]=true;

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

   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]=false;

    }

   }

   return p;

}

int main()

{

  int num;

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

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

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



const int maxn = 1e6 + 15;

bool is_prime[maxn];

int sieve(int x){

	int res = 0;

	fill(is_prime+2,is_prime+x+1,true);

	for(int i = 2; i <= x; i++) if(is_prime[i]){

		res++;

		for(int j = 2 * i; j <= x; j += i) is_prime[j] = false;

	}

	return res;

}



int main(){

	int n;

	while(scanf("%d", &n) == 1) printf("%d\n", sieve(n));

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

#define MAX 1000000

int prime[MAX];

bool is_prime[MAX];

int sieve(int n){   //埃氏?

   int p=0;

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

    is_prime[i]=true;

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

   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]=false;

    }

   }

   return p;

}

int main()

{

  int num;

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

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

  }

  return 0;

}

// Fastest known solution for this problem: