Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var primeCount int
	for sc.Scan() {
		input := nextInt()
		for i := 0; i <= input; i++ {
			if IsPrime(i) {
				primeCount++
			}
		}
		fmt.Printf("%d\n", primeCount)
		primeCount = 0
	}
}

func IsPrime(num int) bool {
	switch {
	case num == 2:
		return true
	case num < 2 || num%2 == 0:
		return false
	}
	sqrt := math.Sqrt(float64(num))
	for i := 3; i <= int(sqrt); i += 2 {
		if num%i == 0 {
			return false
		}
	}
	return true
}

func next() string {
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

C++: #include <bits/stdc++.h>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

#define INF 100000000
#define MOD 1000000007
#define writeln(n) cout<<n<<endl
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

template<class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};

const int inf=100000000;

bool isprime(int p) {
    if (p == 1) return false;
    for (int i = 2; i < p; i++) {
        if (p%i == 0) return false;
    }
    return true;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    int cnt=0;
    for(int i=1; i<=n; i++)
    {
        if(isprime(i)) ++cnt;
    }
    cout<<cnt<<endl;
}

C++: // IncludingFiles
#include<iostream>
#include<vector>
#include<cmath>
#include<ctime>

// Defines
#define     MAX_NUMBER     (999999)
#define     MIN_NUMBER     (1)
// #define     __DEBUG__

// Using Namespace
using namespace std;

// Function
int main(){
	vector <int> PrimeNumbers;
	vector <int> input;
	int buf;
	int sz,maxn;
	int i,root;

	// 入力
	while(cin >> buf){
#ifdef __DEBUG__
		// 入力値のチェック
		if((buf < ((int)(MIN_NUMBER))) || (buf > ((int)(MAX_NUMBER)))){
			cerr << "InputError!!" << endl;
			return -1;
		}
#endif
		// 入力値をリストに追加
		input.push_back(buf);
	}

	// n の最大値を求めて maxn に代入
	sz = (int)input.size();
	maxn = input[0];
	for(i=1;i<sz;i++){
		if(maxn < input[i]){
			maxn = input[i];
		}
	}

	// 素数2 を 素数表PrimeNumbers に追加
	PrimeNumbers.push_back(2);

	// 3 から maxn までの整数が素数かどうかを調べ、素数であれば 素数表PrimeNumbers に追加
	for(i=3;i<=maxn;i+=2){
		// root に i の平方根を代入
		root = (int)sqrt(i);
		// sz に 素数表PrimeNumbers の大きさを代入
		sz = (int)PrimeNumbers.size();
		// i が 素数表PrimeNumbers に含まれている素数で割り切れないかを確認
		for(buf=0;(buf < sz) && (PrimeNumbers[buf] <= root);buf++){
			if((i % PrimeNumbers[buf]) == 0){						// もし割り切れたら
				goto NotPrime;										// i を素数表に追加しない
			}
		}
		// i は素数である ならば i を 素数表PrimeNumbers に追加
		PrimeNumbers.push_back(i);
		// ここにジャンプする
		NotPrime:;
	}

	// n 以下の素数の個数を計測
	sz = (int)input.size();
	for(i=0;i<sz;i++){
		// a, b および flag の宣言・初期化
		int a = 0,b = (int)PrimeNumbers.size() - 1,m,n;
		bool flag = false;

		// PrimeNumbers の最大値 <= input[i] となっていないかどうかを調べる
		if(PrimeNumbers[b] <= input[i]){
			n = b;
			flag = true;
		}

		// 二分検索
		while (flag == false){
			m = (a + b) / 2;
			if(PrimeNumbers[m] > input[i]){
				b = m;
			}else if((PrimeNumbers[m] <= input[i]) && (PrimeNumbers[m+1] > input[i])){
				n = m;
				flag = true;
			}else if(PrimeNumbers[m] < input[i]){
				a = m;
#ifdef __DEBUG__
			}else{
				cerr << "BinarySearchError!!" << endl << endl;
				cerr << "PrimeNumbers[" << m << "] = " << PrimeNumbers[m] << endl;
				cerr << "PrimeNumbers[" << (m + 1) << "] = " << PrimeNumbers[m+1] << endl;
				cerr << "input[" << i << "] = " << input[i] << endl;
				return -1;
			}
#else
			}
#endif
		}

		// 出力
		cout << n << endl;
	}

	return 0;
}

C++: #include <cstdio>
#include <vector>

using namespace std;

int main()
{
	int n;
	
	while (scanf("%d", &n) != EOF){
		vector<int> prime;
		
		for (int i = 2; i <= n; i++){
			int j;
			for (j = 0; j < prime.size(); j++){
				if (i % prime[j] == 0){
					break;
				}
			}
			if (j == prime.size()){
				prime.push_back(i);
			}
		}
		printf("%d\n", prime.size());
	}
	
	return 0;
}

C++: #include <iostream>
using namespace std;
static const int MAX = 999999;

bool isPrime[MAX + 1];
int numPrime[MAX + 1];

void calcPrime(){
  for(int i = 0; i <= MAX; i++)
    isPrime[i] = true;
  isPrime[0] = isPrime[1] = false;
  for(int i = 0; i * i <= MAX; i++){
    if(isPrime[i]){
      for(int j = i * 2; j <= MAX; j += i)
        isPrime[j] = false;
    }
  }
  int sum = 0;
  for(int i = 0; i <= MAX; i++){
    if(isPrime[i])
      sum++;
    numPrime[i] = sum;
  }
}

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

C++: #include <iostream>
#include <cmath>
using namespace std;

int main() {
    const int numPrimes = 1000000;
	bool primes[numPrimes];
    for (int i = 0; i != numPrimes; ++i) {
        primes[i] = true;
    }

    for (int i = 2; i != sqrt(numPrimes); ++i) {
        for (int j = 2; i * j < numPrimes; ++j) {
            primes[i*j] = false;
        }
    }

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

C++: #include <iostream>
#include <string>
using namespace std;

int main()
{
    int n , m;
    int prime[1000000];
    while(1){
        cin >> n;
        prime[1]=2;
        m=3;
        int i=2;
        while(i<=n){
            int flag=0;
            for(int j=1 ; j<i ; j++){
                if(m % prime[j] == 0){
                    flag++;
                }
            }
            if(flag == 0){
                prime[i]=m;
                i++;
            }
            m++;
        }
        cout << prime[n] <<endl;
    }
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int n,i,j,k,sum=0,num,SUM=0;
	for(i=0;i<30;i++){
		cin>>n;
		for(j=1;j<=n;j++){
			for(k=j;k>=1;k--){
				num=j/k*k;
				if(num==j)sum++;
			}
			if(sum==2)SUM++;
			sum=0;
		}
		cout<<SUM<<endl;
		SUM=0;
	}
	return 0;
}

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() {
	int n,m;
	m=0;
	while(1){
		m < 30;
		cin >> n;
		if(cin.eof()){
			break;
		}
		m++;
		int count = 0;
		for(int i=2;i<=n;i++){
			if(IsPrime(i)){
				count++;
			}
		}
		cout << count << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
using namespace std;

long int money = 100000;
int s = 100000;
int a[124],b[124];

int main(){
	int n;
	int tmp;
	cin>>n;
	//while(n!=0){
		money = 100000;
	for(int i=0;i<n;i++){
		money*=1.05;
		//if(i==n-1) cout << "\nbefore  \n" << money <<"\nafter"<<endl;
		if(i==24){
			tmp = money/100;
			//cout<<tmp<<endl;
		}
		tmp = money%1000;
		if(tmp!=0){
			money/=1000;
			money++;
			money*=1000;
			
		}
		b[i+1] = money;
		//if(i==n-1)	cout << money << endl;
	}
		cout<<b[n]<<endl;
		
		;
 
    
    //scanf("%d",&n);
 
 
    for(int i=0;i<n;i++){
        if(int(s*1.05)%1000==0){
            s=int(s*1.05);
        }else{
            s= int(s*1.05) + (1000- int(s*1.05) % 1000);
        }
    	a[i+1] = s;
    }
    //printf("%d\n",s);
	
		for(int i=0;i<n;i++)
			//cout<<i+1<<" a = "<<a[i+1]<<" b = "<<b[i+1]<<endl;
	//cout << money << endl;
		//cin >> n;
	//}
	return 0;
}