Go: package main

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

var scanner= bufio.NewScanner(os.Stdin)

func main() {
	MAX := 10001
	SQRT := 100
	isPrime := make([]bool, MAX)
	for i :=range isPrime {
		isPrime[i] = true
	}
	for i := 3; i < SQRT; i += 2 {
		if isPrime[i] {
			for j := i*i; j < MAX; j += i {
				isPrime[j] = false
			}
		}
	}
	// log.Println(isPrime)
	tbl := make([]int, MAX)
	ans := 0
	for i := 5; i < MAX; i += 2 {
		if isPrime[i] && isPrime[i-2] {
			ans = i
		}
		tbl[i] = ans
	}
	// log.Println(tbl)
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			break
		}
		if n&1 == 0 {
			n--
		}
		fmt.Printf("%d %d\n", tbl[n]-2, tbl[n])
	}
}

C++: #include <iostream>

using namespace std;

int main(){
    bool numbers[10001];
    for(int i=0; i<10001; i++) {
        numbers[i] = false;
    }
    numbers[2] = true;
    numbers[3] = true;
    for(int i=5; i<10001; i+=2) {
        if(i % 3 != 0)
            numbers[i] = true;
    }
    int p = 5;
    int num = 0;
    while(true) {
        while(true) {
            if(numbers[p]) break ;
            p++;
        }
        for(int i=10000; i>0; i--) {
            if(!numbers[i]) {
                num = i;
                break ;
            }
        }
        if(p*p > num) break ;
        for(int i=p+1; i<10001; i++) {
            if(i % p == 0) numbers[i] = false;
        }
        p++;
    }

    int n;
    while(cin >> n, n != 0) {
        for( ; n>=5; n--) {
            if(numbers[n] && numbers[n-2]) {
                cout << n - 2 << " " << n << endl;
                break ;
            }
        }
    }
    return 0;
}

C++: #include <stdio.h>

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

int main() {
	int n,i;
	int sousi[2];
	int prime[10100][2];
	while(1) {
		sousi[0] = 0;
		sousi[1] = 0;
		for(i = 0; i < 10100; i++) {
			prime[i][0] = 0;
			prime[i][0] = prime[i][0] + i;
			prime[i][1] = 0;
		} 
		scanf("%d",&n);
		if(n == 0) {
			break;
		}
		for(i = 0; i <= n; i++) {
			prime[i][1] = isprime(prime[i][0]);
		}
		for(i = 0; i <= n; i++) {
			if(prime[i][1] == 1 && prime[i + 2][1] == 1) {
				sousi[0] = prime[i][0];
				sousi[1] = prime[i + 2][0];
			}
		}
		printf("%d %d\n",sousi[0],sousi[1]);
	}
	return 0;
}

C++: #include <stdio.h>

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

int main(){
	int k,g,j,suu,an1,an2;
	int su[10000]={0};
    for(k=0;k<10000;k++){
    	if(isprime(k)==1){
    		for(g=1;j<=10000;g++){
    			j=g*k;
    			su[j]=1;
    		}
    	}  
    }
    while(1){
        scanf("%d",&suu);
        if(suu != 0){
            for(k=2;k<=suu;k++){
            	if(su[k-2]==1 && su[k]==1){
        	    	an1=k-2;
        	    	an2=k;
            	}
            }
            printf("%d %d\n",an1,an2);
        }
        else{
    	    break;
        }
    }
    return 0; 
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <ctime>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <numeric>
#include <cassert>
using namespace std;
static const double EPS = 1e-10;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SS stringstream
#define DBG1(a) rep(_X,sz(a)){printf("%d ",a[_X]);}puts("");
#define DBG2(a) rep(_X,sz(a)){rep(_Y,sz(a[_X]))printf("%d ",a[_X][_Y]);puts("");}
#define bitcount(b) __builtin_popcount(b)
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)

#define delete(a,n) a.erase(remove(all(a),n),a.end())
template<typename T, typename S> vector<T>& operator<<(vector<T>& a, S b) { a.push_back(b); return a; }
template<typename T> void operator>>(vector<T>& a, int b) {while(b--)if(!a.empty())a.pop_back();}
bool isprime(int n){ if(n<2)return false;  for(int i=2;i*i<=n;i++)if(n%i==0)return false;  return true;} 
ll b_pow(ll x,ll n){return n ? b_pow(x*x,n/2)*(n%2?x:1) : 1ll;}
string itos(int n){stringstream ss;ss << n;return ss.str();}


int p(int n){
	if( n < 2 ) return 0;
	for(int i = 2 ; i * i <= n ; i++)
		if( n % i == 0 ) return false;
	return true;
}
int main(){
	ios_base::sync_with_stdio(false);
	int n;
	while(cin >> n && n){
		while( !p(n) || !p(n-2) ) n--;
		cout << n-2 << " " << n << endl;
	}
}

C++: #include <iostream>
using namespace std;
bool a[10001];
int main()
{
  int i,j;
  for(i=2;i<10001;i++){
    if(!a[i]){
      for(j=2;i*j<10001;j++){
	a[i*j] = true;
      }
    }
  }
  for(;;){
    cin >> i;
    if(i==0) break;
    if(i%2 == 0) i--;
    while(i > 4){
      if(a[i] == false && a[i-2] == false) break;
      i -= 2;
    }
    cout << (i-2) << " " << i << endl;
  }
  return 0;
}

C++:    
#include <stdio.h>
 
int isprime(int n) {
    int i;
    for(i = 2; i * i <= n; i++) {
        if(n % i == 0) {
            return 0;
        }
    }
    return 1;
}
 
int main() {
    int n,i;
    int ans[2];
    int prime[10100][2];
    for (i = 0; i < 10100; i++) {
        prime[i][0] = i;
        prime[i][1] = isprime(i);
    }
    while(1) {
        ans[0] = 0;
        ans[1] = 0;    
        scanf("%d",&n);
        if(n == 0) {
            break;
        }
        for(i = n; i > 2; i--) {
            if(prime[i][1] == 1 && prime[i - 2][1] == 1) {
                ans[0] = prime[i - 2][0];
                ans[1] = prime[i][0];
                break;
            }
        }
        printf("%d %d\n",ans[0],ans[1]);
    }
    return 0;
}

C++: #include <iostream>
int i,j,n,P[9999];int main(){for(i=2;i*i<9999;i++)for(j=i;j<9999;P[j+=i]=1);for(;std::cin>>n,n;printf("%d %d\n",i-2,i))for(i=n;P[i]||P[i-2];i--);}

C++: #include <iostream>
using namespace std;
int main(){
  int p[100000];
  fill(p,p+100000,1);
  p[0]=p[1]=0;
  for(int i = 2 ; i*i < 100000 ; i++){
    if(p[i])for(int j = i*2 ; j < 100000 ; j+=i)p[j] = 0;
  }

  int n;
  while(cin >> n,n){
    for(int i = n ; i >= 5 ; i--){
      if(p[i] == 1 && p[i-2] == 1 ){
	cout << i-2 << " " << i << endl;
	break;
      }
    }
  }
  return 0;
}

C++: #include <stdio.h>
int isprime(int n){//?´???°???????????¢??°
	int i;
	for(i = 2; i*i <= n; i++){
		if(n % i == 0) return 0;
	}
	return 1;
}
int main(){
	int n, i;
	while(1){//0?????\?????????????????§?????????
		scanf("%d", &n);
		if(n == 0) break;
		for(i = n; n >= 5; i--){
			if(isprime(i) == 1 && isprime(i-2) == 1){
				printf("%d %d\n", i-2, i);
				break;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;
int main()
{
	int maxsize(0);
	vector<int> input;

	while (1)
	{
		int tmp;

		cin >> tmp;

		(maxsize < tmp) ? (maxsize = tmp) : (0);
	}

	vector<int> prime, ans;

	for (int i(1); i <= maxsize; ++i)
	{
		for (vector<int>::iterator i2(prime.begin()), n2(prime.end()); i2 != n2; ++i2)
		{
			if (i % *i2 == 0)
			{
				prime.push_back(i);
				if (i2 != prime.begin())
				{
					if (*(--i2) == i)
					{
						ans.push_back(i);
					}
				}
				break;
			}
		}
	}

	for (vector<int>::iterator i(input.begin()), n(input.end()); i != n; ++i)
	{
		int out(*i);

		for (vector<int>::reverse_iterator i2(ans.rbegin()), n2(ans.rend()); i2 != n2; ++i2)
		{
			if (*i2 <= out)
			{
				cout << (*i2 - 2) << ' ' << (*i2) << endl;
			}
		}
	}

	return 0;
}