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?????\???????????°????´???°??§?????????
            }
        }
    }
    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 = 3;
        int q1 = 5;
        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++: #import<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>
#include <stdio.h>
#include <stdlib.h>
#include <string>
using namespace std;
struct Node{
        int val;
        Node *prev,*next;
};
Node *Null;
int insert(int key){
        Node *now;
        now=(Node *)malloc(sizeof(Node));
        now->val=key;
        now->next=Null->next;
        Null->next=now;
        Null->next->prev=now;
        now->prev=Null;
}
int main(){
        Null=(Node *)malloc(sizeof(Node));
        Null->prev=Null;
        Null->next=Null;
        int N;
        cin >> N;
        string command;int x;
        for(int i=0 ; i<N ; i++ ){
                cin >> command >> x;
                if(command=="insert"){
                        cout<<"inser"<<endl;
                        insert(x);
                }else if(command=="delete"){
                        Node *now=Null->next;
                        while(now!=Null && now->val!=x)
                                now=now->next;
                        if(now==Null)continue;
                        now->prev->next=now->next;
                        now->next->prev=now->prev;
                        free(now);
                }else if(command=="deleteFirst"){
                }else{
                }
        }
        Node *now=Null->next;
        while(now!=Null){
                cout << now->val << " ";
                now=now->next;
        }
        cout << endl;
        return 0;
}

C++: #include <math.h>

int prime(int n)
{
	int i1, sw, m;

	m 	= (int)sqrt((double)n);
	sw  = (n <= 1) ? 0 : 1;

	for (i1 = 2; i1 <= m && sw > 0; i1++) {
		if (n%i1 == 0)
			sw = 0;
	}

	return sw;
}

C++: #include <stdio.h>
const int MAX_V = 1000000;
int prime[MAX_V+1];
int main() {
    int i, k, v,a=0,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(1){
      scanf("%d",&n);
      if(n==0)break;
      for(i=0;i<n-2;i++){
          int isprime = prime[i];
          int isprimex = prime[i+2];
          if(isprime && isprimex){
             if(a<i)a=i;
          }
        }
        printf("%d %d\n",a,a+2);
    }
    return 0; 
    
}

C++: #include <iostream>
#include <cstring>
#include <cmath>
#include <ostream>
#include <vector>
using namespace std;
    int n,m,k,i,t=1;
    int prm(int k)
    {
       for(i=2;i<=sqrt(k);i++){
       if(k%i==0)
       return 0;
       }
       return 1;
    }
    int main(){
    cin >> m;
    if (m==5){
    cout << 3 << " " << 5 << std::endl;}
    else
    {
    for (m>5;m<=10000;m--)
    {
    if ((m%10==1||m%10==3||m%10==7||m%10==9)&&(m%6==1)&&prm(m)&&prm(m-2))
    break;
    }
    
    cout << m-2 << " " << m << std::endl;
    }
    return 0;
}

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

bool used[10000];
std::vector<int> primes;

void sieve()
{
	used[0] = used[1] = true;
	for( int i = 2; i <= 10000; ++i )
	{
		if( !used[i] )
		{
			primes.push_back( i );

			for( int j = i; j <= 10000; j += i )
				used[j] = true;
		}
	}

	return;
}

int main()
{
	sieve();

	int n;
	while( std::cin >> n, n )
	{
		int i = std::upper_bound( primes.begin(), primes.end(), n ) - primes.begin() - 1;
		while( i > 0 && primes[i] - primes[i-1] != 2 )
			--i;

		std::cout << primes[i-1] << ' ' << primes[i] << std::endl;
	}

	return 0;
}

C++: #include <stdio.h>
int isprime(int n){
    for(int i = 2; i * 1 <= n; i++){
        if(n % i == 0)return 0;
    }
    return 1;
}

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

C++: #include <stdio.h>
const int MAX_V = 10000;
int prime[MAX_V+1];
int main(){
  int i,k,v,n,j,i1 = 0,i2 = 0,max = 0,p1,q1;
  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(1){
    scanf("%d",&n);
    if(n == 0){
      break;
    }
    for(j = 0;j + 2 < n;j++){
      int isprime = prime[j];
      int isprime2 = prime[j + 2];
      if(isprime) i1 = 1;else i1 = 0;
      if(isprime2) i2 = 1;else i2 = 0;
      if(i1 == 1 && i2 == 1){
        max = j;
      }
    }
    p1 = max;
    q1 = max + 2;
    printf("%d %d\n",p1,q1);
  }
  return 0;
}

C++: #include <stdio.h>
const int MAX_V = 10000; // 1????????§????´???°??¨?????????

int main() {
	int i, k, n;
	int prime[MAX_V+1]; // 1????´???°???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?????\???????????°????´???°??§?????????
			}
		}
	}
	//?´???°??¨fin
	while(scanf("%d",&n) != 0){
		for(i=n;i>=3;i--){//???????????¨????´???°????????????
			if(prime[i] == 1 && prime[i-2] == 1){
				break;
			}
		}
	// 	ans[a]=i; a++;
	// 	ans[a]=i-2; a++;
	// }
	// for(i=0;i<=a;i=i+2){
	// 	printf("%d %d\n",ans[i],ans[i+1]);
	// }
		printf("%d %d\n",i,i-2);
	}
	return 0;
}

C++: #include <math.h>
int prime(int n)
{
	int i1, sw, m;
	m 	= (int)sqrt((double)n);
	sw  = (n <= 1) ? 0 : 1;
	for (i1 = 2; i1 <= m && sw > 0; i1++) {
		if (n%i1 == 0)
			sw = 0;
	}
	return sw;
}