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 "stdio.h"
const int MAX_V = 10000; // 1????????§????´???°??¨?????????
int prime[MAX_V+1]; // 1????´???°,0????´???°??§?????????
int main() {
    int i, k, n;
    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?????\???????????°????´???°??§?????????
            }
        }
    }
    scanf("%d",&n);
    while (1) {
    if (n == 0)break;
    //while(scanf("%d", &n) != 0) {
        //        int isprime = prime[v];
        //        if(isprime) printf("%d is a prime number\n", v);
        //        else printf("%d is not a prime number\n", v);
        int p1;
        int q1;
        for(i = n;0 <= i;i--){
            if(prime[i] == 1 && prime[i-2] == 1){  //??????????´???°
                if (q1 <= i) {
                    q1 = i;
                    p1 = i-2;
                }
            }
        }
        printf("%d %d\n",p1,q1);
    }
    return 0;
}
//????¨??????¨????????????????????????

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
    vector<bool> v(11111, true);
    v[0] = v[1] = false;
    for (int i = 2; i <= 10010 / 2; i++) {
        for (int j = 2; j * i <= 10010; j++) {
            v[i * j] = false;
        }
    }

    vector<pair<int,int> > d;
    for (int i = 0; i <= 10010 ; i++) {
        if (v[i] && v[i+2]) d.push_back(pair<int,int>(i, i+2));
    }

    int n;
    while (cin >> n, n) {
        auto iter = upper_bound(d.begin(), d.end(), pair<int,int>(n - 2,n - 2)) - d.begin();
        while (d[iter].second > n) iter--;
        cout << d[iter].first << ' ' << d[iter].second << endl;
    }

    return 0;
}

C++: #include<stdio.h>

int main(){
  const int MAX_V = 10000;
  int prime[MAX_V+1];
  int i, k, v, ans, dif;
  for(i = 2; i <= MAX_V; i++){
    prime[i] = 1;
  }
  for(i = 2; i*i <= MAX_V; i++){
    if(prime[i]){
      for(k = 2 * i; k <= MAX_V; k += i){
        prime[k] = 0;
      }
    }
  }
  while(scanf("%d", &v) != EOF){
    if(v == 0) break;
    for(k = v; k >= 2; k--){
      ans = prime[k];
      if(ans == 1){
        dif = prime[k - 2];
        if(dif == 1){
          printf("%d %d\n", k - 2, k);
          break;
        }
      }
    }
  }
  return 0;
}

C++: #include <stdio.h>
const int MAX_V = 10000;
int prime[10000];
int main(){
int i, k, v ,n;
  for(i = 2; i <= MAX_V; i++) {
    prime[i] = 1;
  }
  for(i = 2; i*i <= MAX_V; i++) {
    if(prime[i]) {
      for(k = 2 * i; k <= MAX_V; k += i) {
        prime[k] = 0;
      }
    }
  }
  while(scanf("%d", &n)){
    if(n==0)break;
    int fir=0 , sec=0;
    for(i=n ;i>3 ;i--){
      if(prime[i] && prime[i-2]){
        fir=i-2;
        sec=i;
        break;
      }
    }
    printf("%d %d\n" ,fir ,sec);
  }
  return 0;
}

C++: #include <stdio.h>
int main(){
	int i,j;
	int isprime[10000];
	for(i=0;i<=10000;i++){
 		isprime[i]=1;
	}
	isprime[0]=isprime[1]=0;
	for(i=2;i<=10000;i++){
 		if(isprime[i]==1){
 			for(j=2*i;j<=1000;j+=i){
				isprime[j]=0;
			}
		}
	}
	int n,p1,q1;
	while (scanf("%d", &n) != EOF){
		for(i=2;i<=n;i++){
			if(isprime[i-2]==1 && isprime[i]==1){
				p1 = i-2;
				q1 = i;
			}
		}
		printf("%d %d\n",p1,q1);
	}
	return 0;
 }

C++: #include <bits/stdc++.h>
using namespace std;

bool isPrime(int x) {
  if(x == 0 || x == 1) return false;
  for(int i = 2; i*i <= x; ++i) {
    if(x % i == 0) return false;
  }
  return true;
}

int main() {
  int n;
  while(cin >> n && n) {
    int p, q;
    for(int x = 3; x+2 <= n; ++x) {
      if(isPrime(x) && isPrime(x+2)) {
        p = x;
        q = x+2;
      }
    }
    cout << p << " " << q << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  int ans[10001] = {};
  int z = 1000000;
  dep(i, 10000, 0) {
    int f = 0;
    dep(j, i - 1, 2) {
      if(i % j == 0) {
        f = 1;
        break;
      }
    }
    if(!f) {
      if(z - i == 2) ans[z] = 1;
      z = i;
    }
  }
  int n;
  while(cin >> n) {
    if(!n) return 0;
    dep(i, n, 0) {
      if(ans[i]) {
        cout << i - 2 << " " << i << endl;
        break;
      }
    }
  }
}

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

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

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

int main(){
	bool prime[10001];
	int i,j,n;
	for(i = 4;i<=10000;i+=2){
		prime[i] = false;
	}
	prime[2] = true;
	for(i = 3;i<=10000;i+=2){
		if(prime[i]){
			for(j = 3;j<=10000/i;j+=2){
				prime[i*j] = false;
			}
		}
	}
	while(cin >> n && (n != 0)){
		for(i = n;i>=7;i--){
			if(prime[i] && prime[i-2]){
				cout << i-2 << " " << i << endl;
			}
		}
	}
	return 0;
}

C++: #include<stdio.h>

int main(){
  const int MAX_V = 100000;
  int prime[MAX_V+1];
  int i, k, v, ans, dif;
  for(i = 2; i <= MAX_V; i++){
    prime[i] = 1;
  }
  for(i = 2; i*i <= MAX_V; i++){
    if(prime[i]){
      for(k = 2 * i; k <= MAX_V; k += i){
        prime[k] = 0;
      }
    }
  }
  while(scanf("%d", &v) != EOF){
    if(v == 0) break;
    for(k = n; k >= 2; k--){
      ans = prime[k];
      if(ans == 1){
        dif = prime[k - 2];
        if(dif == 1){
          printf("%d %d\n", k - 2, k);
          break;
        }
      }
    }
  return 0;
}