Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func check(n int) int {
	eratos := make([]bool, n+1)
	cnt := 0
	for i := 2; i < len(eratos); i++ {
		if !eratos[i] {
			cnt++
			for j := i*i; j < len(eratos); j += i {
				eratos[j] = true
			}
		}
	}
	return cnt
}

func main() {
	for scanner.Scan() {
		n := nextInt()
		fmt.Println(check(n))
	}
}

C++: #include <stdio.h>
#include <math.h>
#define MAX 1000000
//エラトステネスの篩
int main(){
    int mem[100000] = {2};
    bool list[MAX]={true,true};
    int set = 2,m = 1,j,x;
    while( set < sqrt( MAX )){
    	for( int i = set;i < MAX;i++ ) if( i % set == 0 ) list[i] = true;
    	for( int i = set;i < MAX;i++ ) if( list[i] == false ){ set = i,mem[m++] = i,list[i] = true;break; }
    }
    for( int i = set;i < MAX;i++ )if( list[i] == false ) mem[m++] = i;
    while( scanf( "%d",&x ) != EOF ){
        for( j = 0;mem[j] <= x && j < m;j++ );
        printf( "%d\n",j );
    }
    return 0;
}

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

int main() {
	int n, ans;
	while (cin >> n) {
		ans = 2;
		if (n == 2) { cout << "1" << endl; continue; }
		if (n == 3) { cout << "2" << endl; continue; }
		for (int i = 4; i <= n; i++) {
			if (i % 2 == 0 || i % 3 == 0) continue;
			if (i % 6 != 1 && i % 6 != 5) continue;
			for (int i = 5; pow(i, 2) <= n; i += 6)
				if (n % i == 0 || n % (i + 2) == 0) continue;
			ans++;
		}
		cout << ans << endl;
	}
	return 0;
}

C++: /*-*-coding:utf-8-*-*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <iterator>
#include <cmath>
#include <stack>
#include <functional>
#include <iomanip>
using namespace std;

int main()
{
  int n;

  while(cin >> n, !cin.eof()) {
    int ans = 0;
    int flag = 0;

    if(n >= 2) ans++;    
    for(int i = 3; i <= n; i+=2) {
      for(int j = 3; j <= sqrt(i); j+=2) {
	if(i % j == 0) {
	  flag = 1;
	  break;
	}
      }
      if(flag == 0) ans++;
    }    
    cout << ans << endl;
  }
  
  return 0;
}

C++: #include <stdio.h>
#include <algorithm>

using namespace std;

void set_prime_number(bool* array, int num) {

  fill(array, array + num, true);
  array[0] = array[1] = false;
  for (int i = 2; i < num; i++) {
    if (!array[i]) continue;
    for (int j = i * 2; j < num; j += i) {
      array[j] = false;
    }
  }

}

int main() {
  bool prime_number[999999];
  int num;
  int nump=0;
  int cnt=0;

	while(scanf("%d",&num)!=EOF){
	  set_prime_number(prime_number,num);
	 for (int i = 0; i < num+1; i++) {
		 if (prime_number[i]){cnt++;}
	 }
	 printf("%d ",cnt);
	 cnt=0;
	}


  return 0;
}

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

    return 0; 
    
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
#define FOR(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

int p[1000010];

int main(){
	p[0]=p[1]=1;
	rep(i,1000000){
		if(p[i]==0)
			for(int j=2*i;j<1000000;j+=i)
				p[j]=1;
	}
	int n;
	cin>>n;
	int r=0;
	rep(i,n)
	if(p[i]==0)r++;
	cout<<r<<endl;
	return 0;
}

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

int main(){
  bool is_prime[1000000];
  for(int i=0;i<1000000;i++){
    is_prime[i] = true;
  }
  is_prime[0] = false;
  is_prime[1] = false;
  
  for(int i=2;i<1000000;i++){
    if(is_prime[i]){
      for(int j=2*i;j<1000000;j += i){
	is_prime[j] = false;
      }
    }
  }
 
 int n,counter;
 while(cin >> n){
 counter = 0;
 
 for (int k = 1; k <= n; k++)
   if(is_prime[k]){
     counter++;
   }

 cout << counter << endl;
 }
 
 return 0;
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int n;

  while(!cin.eof()) {
    cin >> n;

    int m = sqrt(n);
    
    vector<bool> h(n+1, true);
    h[0] = false;
    h[1] = false;

    for(int i = 2; i <= m; i++) {
      if(h.at(i)) {
	for(int s = 2; s*i < h.size(); s++) {
	  if(h.at(s*i))
	    h[s*i] = false;
	}
      }
    }
    
    int ans=0;
    for(auto f : h) {
      if(f)
	ans++;
    }

    cout << ans << endl;
  }
  return 0;
}

C++: #include <stdio.h>
int prime[1000000],z;
bool p[1000010];
void pr()
{
    p[2] = 1;
    prime[z] = 2;
    z++;
    for(int i=3; i<1000000; i+=2)
    {
        p[i] = 1;
    }
    for(int i=3; i*i<1000000; i+=2)
    {
        if(p[i])
        {
            for(int j=i+i; j<1000000; j+=i)
            {
                p[j] = 0;
            }
        }
    }
    for(int i=3; i<1000000; i+=2)
    {
        if(p[i])
        {
            prime[z] = i;
            z++;
        }
    }
}

int main()
{
    pr();
    int n,cnt;
    while(~scanf("%d", &n))
    {
        cnt = 0;
        for(int i=0; i<z; i++)
        {
            cnt++;
            if(prime[i] > n)
            {
                cnt--; break;
            }
        }
        printf("%d\n", cnt);
    }
    return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
using namespace std;

#define FOR(i,a,b) for(long long int i=(a);i<(b);i++)
#define REP(i,n) for(long long int i=0;i<(n);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI 3.14159265358479

typedef long long int ll;
typedef vector<long long int> vi;
typedef vector<long long int>::iterator vit;

int main(){
	vi v(1000010, 1);
	vi copy(1000011, 1);
	ll n, c = 0;
	double rt;

	v[0] = 0;

	while (cin >> n){
		rt = sqrt(n);
		FOR(i, 1, rt){
			if (v[i] == 1){
				for (int j = i + 1; (i + 1)*j <= n; j++){
					v[(i + 1)*j - 1] = 0;
				}
			}
		}
		/*REP(i,n){
			cout << v[i] << "\n";
		}*/
		REP(i, n){
			if (v[i] == 1)c++;
		}
		cout << c << "\n";
	}
}

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

int main(){
	float a[6];
	float x,y;
	while(true){
		cin >> a[0];
		cin >> a[1];
		cin >> a[2];
		cin >> a[3];
		cin >> a[4];
		cin >> a[5];
		if(cin.eof())
			break;
			
		x = (a[4]*a[2]-a[1]*a[5])/(a[0]*a[4]-a[1]*a[3]);
		y = (-a[3]*a[2]+a[0]*a[5])/(a[0]*a[4]-a[1]*a[3]);
		
		cout.precision(3);
		cout << x << " " << y << endl;
	}
	return 0;
}

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

int main()
{
	
	long long int k,p[100000];
	long long int bn,n=-1;
	p[0]=2;
	while(1){
		bn=n;
		cin>>n;
		if(n==bn)
			return 0;
	k=1;
	int r=(int)sqrt((float)n);
	//ツ確ツ認ツ用ツ素ツ青板づ債閉つ篠づ個づ慊づ必ツ要
	//ツ閉つ篠づ慊づづ慊づュツつキ
	for(int i=3;i<r;i++){
		//ツつサツづェツづ慊づづ個素ツ青板づ確ツ認
		for(int j=0;j<k;j++){
			//ツ催甘コツづ慊づ環づェツづ按つゥツづつスツづァツカツウツδ督トツつオツづ、ツ確ツ認ツ用ツ素ツ青板づ個配ツ療アツづ可格ツ納
			if(i%p[j]==0){
				break;
			}else if(j==(k-1)){
				p[k]=i;
				k++;
			}
		}
	}
	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-1){
				k++;
			}
		}
	}
	if(n==1){
		k=0;
		cout<<k<<endl;
	}else if(n==2){
		k=1;
		cout<<k<<endl;
	}else if(n==3){
		k=2;
		cout<<k<<endl;
	}else{
	cout<<k<<endl;
	}
	}
}