Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	race1 := make([]player, 8)
	race2 := make([]player, 8)
	race3 := make([]player, 8)
	rest := make([]player, 6)
	for i := 0; i < 8; i++ {
		scanner.Scan()
		input := strings.Split(scanner.Text(), " ")
		no, _ := strconv.Atoi(input[0])
		time, _ := strconv.ParseFloat(input[1], 64)
		race1[i] = player{no, time}
	}
	for i := 0; i < 8; i++ {
		scanner.Scan()
		input := strings.Split(scanner.Text(), " ")
		no, _ := strconv.Atoi(input[0])
		time, _ := strconv.ParseFloat(input[1], 64)
		race2[i] = player{no, time}
	}
	for i := 0; i < 8; i++ {
		scanner.Scan()
		input := strings.Split(scanner.Text(), " ")
		no, _ := strconv.Atoi(input[0])
		time, _ := strconv.ParseFloat(input[1], 64)
		race3[i] = player{no, time}
	}
	for i := 1; i <= 7; i++ {
		for k := 7; k >= i; k-- {
			if race1[k].time < race1[k-1].time {
				race1[k], race1[k-1] = race1[k-1], race1[k]
			}
			if race2[k].time < race2[k-1].time {
				race2[k], race2[k-1] = race2[k-1], race2[k]
			}
			if race3[k].time < race3[k-1].time {
				race3[k], race3[k-1] = race3[k-1], race3[k]
			}
		}
	}
	rest[0] = race1[2]
	rest[1] = race1[3]
	rest[2] = race2[2]
	rest[3] = race2[3]
	rest[4] = race3[2]
	rest[5] = race3[3]
	for i := 1; i <= 5; i++ {
		for k := 5; k >= i; k-- {
			if rest[k].time < rest[k-1].time {
				rest[k],rest[k-1] = rest[k-1], rest[k]
			}
		}
	}
	fmt.Printf("%d %.2f\n", race1[0].no, race1[0].time)
	fmt.Printf("%d %.2f\n", race1[1].no, race1[1].time)
	fmt.Printf("%d %.2f\n", race2[0].no, race2[0].time)
	fmt.Printf("%d %.2f\n", race2[1].no, race2[1].time)
	fmt.Printf("%d %.2f\n", race3[0].no, race3[0].time)
	fmt.Printf("%d %.2f\n", race3[1].no, race3[1].time)
	fmt.Printf("%d %.2f\n", rest[0].no, rest[0].time)
	fmt.Printf("%d %.2f\n", rest[1].no, rest[1].time)
}

type player struct {
	no int
	time float64
}

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

using namespace std;

struct smap {
    int number;
    double time;
};typedef struct smap Smap;

//プロトタイプ宣言
bool tfsort (const Smap &a, const Smap &b);

//main関数
int main(){
    int i, number, cnt = 0, idx = 0;
    double time;
    Smap rec[50];
    map<int, double> data;

    //入力
    for(i = 0;i < 24; i++){
        scanf("%d %lf", &number, &time);
        data[number] = time;
    }
    
    
    //map-構造体変換
    for(auto &p: data){
        rec[cnt] = (Smap){p.first, p.second};
        cnt++;
    }
    //3組ごとのソート
    for(i = 0; i < 17; i += 8){
        sort(rec + i, rec + i + 7, tfsort);
    }
    printf("---------------------\n");
    //上位二組出力
    for(i = 0; i < 3; i++){
        printf("%d %0.2f\n", rec[idx].number, rec[idx].time);
        printf("%d %0.2f\n", rec[idx + 1].number, rec[idx + 1].time);
        rec[idx].time = -1.0;
        rec[idx + 1].time = -1.0;
        idx += 8;
    }
    
    //全てのチームをソート
    sort(rec, rec + 24, tfsort);
    
    //3位以下の上位二人を出力
    for(i = 6; i < 8; i++){
        printf("%d %0.2f\n", rec[i].number, rec[i].time);
    }
    
    return 0;
}

bool tfsort (const Smap &a, const Smap &b){
    if(a.time < b.time) return true;
    return false;
}

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

using namespace std;

int main()
{
	int num[5][100]={};
	double t[5][100]={};
	double min1=10000,min2=10000;
	int num1,num2;

	for(int i=0;i<3;i++)
	{
		for(int j=0;j<8;j++)
		cin >> num[i][j] >> t[i][j];
	}

	for(int k=0;k<3;k++)
	{
		for(int i=0;i<8;i++)
		{
			for(int j=i;j<8;j++)
			{
				if(t[k][i]>t[k][j])
				{
					swap(t[k][i],t[k][j]);
					swap(num[k][i],num[k][j]);
				}
			}
		}
	}

	for(int i=0;i<3;i++)
	{
		for(int j=2;j<8;j++)
		{
			if(min1>=t[i][j])
			{
				min1=fmin(min1,t[i][j]);
				num1=num[i][j];
			}
		}
	}
	for(int i=0;i<3;i++)
	{
		for(int j=2;j<8;j++)
		{
			if(min2>=t[i][j] && min1!=t[i][j])
			{
				min2=fmin(min2,t[i][j]);
				num2=num[i][j];
			}
		}
	}

	for(int i=0;i<3;i++)
	{
		for(int j=0;j<2;j++)
		{
			cout << num[i][j] << " " << t[i][j] <<endl;
		}
	}
	cout << num1 << " " << min1 << endl;
	cout << num2 << " " << min2 << endl; 

    return 0;
}

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

int main(int argc, const char * argv[])
{
    struct data {
        int name;
        double time;
    };
    data kiroku[24];
    for (int i = 0; i < 24; i++) {
        cin >> kiroku[i].name >> kiroku[i].time;
    }
    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 7; j++) {
            if (kiroku[j].time > kiroku[j+1].time) {
                data tmp = kiroku[j];
                kiroku[j] = kiroku[j+1];
                kiroku[j+1] = tmp;
            }
        }
    }
    for (int i = 8; i < 16; i++) {
        for (int j = 8; j < 15; j++) {
            if (kiroku[j].time > kiroku[j+1].time) {
                data tmp = kiroku[j];
                kiroku[j] = kiroku[j+1];
                kiroku[j+1] = tmp;
            }
        }
    }
    for (int i = 16; i < 24; i++) {
        for (int j = 16; j < 23; j++) {
            if (kiroku[j].time > kiroku[j+1].time) {
                data tmp = kiroku[j];
                kiroku[j] = kiroku[j+1];
                kiroku[j+1] = tmp;
            }
        }
    }
    printf("%d %.2f\n", kiroku[0].name, kiroku[0].time);
    printf("%d %.2f\n", kiroku[1].name, kiroku[1].time);
    printf("%d %.2f\n", kiroku[8].name, kiroku[8].time);
    printf("%d %.2f\n", kiroku[9].name, kiroku[9].time);
    printf("%d %.2f\n", kiroku[16].name, kiroku[16].time);
    printf("%d %.2f\n", kiroku[17].name, kiroku[17].time);
    
    data tmp = {0, 0};
    kiroku[0] = kiroku[1] = kiroku[8] = kiroku[9] = kiroku[16] =kiroku[17] = tmp;
    
    for (int i = 0; i < 24; i++) {
        for (int j = 0; j < 23; j++) {
            if (kiroku[j].time > kiroku[j+1].time) {
                data tmp = kiroku[j];
                kiroku[j] = kiroku[j+1];
                kiroku[j+1] = tmp;
            }
        }
    }
    printf("%d %.2f\n", kiroku[6].name, kiroku[6].time);
    printf("%d %.2f\n", kiroku[7].name, kiroku[7].time);
    return 0;
}

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

using namespace std;

struct smap {
    int number;
    double time;
};typedef struct smap Smap;

//プロトタイプ宣言
bool tfsort (const Smap &a, const Smap &b);

//main関数
int main(){
    int i, idx = 0;
//    double time;
    Smap rec[50];
//    map<int, double> data;
    
    //入力
    for(i = 0;i < 24; i++){
        scanf("%d %lf", &rec[i].number, &rec[i].time);
//        data[number] = time;
//        rec[i].time=time;
    }
    
    
//    //map-構造体変換
//    for(auto &p: data){
//        rec[cnt] = (Smap){p.first, p.second};
//        cnt++;
//    }
    
    //3組ごとのソート
    for(i = 0; i < 17; i += 8){
        sort(rec + i, rec + i + 8, tfsort);
    }
    //上位二組出力
    for(i = 0; i < 3; i++){
        printf("%d %0.2f\n", rec[idx].number, rec[idx].time);
        printf("%d %0.2f\n", rec[idx + 1].number, rec[idx + 1].time);
        rec[idx].time = 999999;
        rec[idx + 1].time = 999999;
        idx += 8;
    }
    
    //全てのチームをソート
    sort(rec, rec + 24, tfsort);
    
    //3位以下の上位二人を出力
    for(i = 0; i < 2; i++){
        printf("%d %0.2f\n", rec[i].number, rec[i].time);
    }
    
    return 0;
}

bool tfsort (const Smap &a, const Smap &b){
    if(a.time < b.time) return true;
    return false;
}