Go: package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	a := make([]int, 4)
	b := make([]int ,4)
	for scanner.Scan() {
		inputa := strings.Split(scanner.Text(), " ")
		for i := range a {
			a[i], _ = strconv.Atoi(inputa[i])
		}
		scanner.Scan()
		inputb := strings.Split(scanner.Text(), " ")
		for i := range b {
			b[i], _ = strconv.Atoi(inputb[i])
		}
		hit := 0
		blow := 0
		if a[0] == b[0] {
			hit++
		}
		if a[1] == b[1] {
			hit++
		}
		if a[2] == b[2] {
			hit++
		}
		if a[3] == b[3] {
			hit++
		}
		if a[0] == b[1] {
			blow++
		}
		if a[1] == b[2] {
			blow++
		}
		if a[2] == b[3] {
			blow++
		}
		if a[1] == b[0] {
			blow++
		}
		if a[2] == b[1] {
			blow++
		}
		if a[2] == b[0] {
			blow++
		}
		if a[3] == b[2] {
			blow++
		}
		if a[3] == b[1] {
			blow++
		}
		if a[3] == b[0] {
			blow++
		}
		if a[0] == b[2] {
			blow++
		}
		if a[1] == b[3] {
			blow++
		}
		if a[0] == b[3] {
			blow++
		}
		fmt.Printf("%d %d\n", hit, blow)
	}
}

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

int main() {

  int a[4],b[4];

  while(true) {

    if ( cin.eof() ) break;

    cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3];

    int hit = 0;
    int blow = 0;

    for ( int i = 0; i < 4; i++ ) {

      for ( int j = 0; j < 4; j++ ) {

	int k = ( i + j ) % 4;

	if ( a[i] == b[k] ) {

	  if ( i == k ) {
	    hit++;
	  }else {
	    blow++;
	  }
	  break;

	}

      }

    }

    cout << hit << " " << blow << endl;

  }

}

C++: #include <iostream>

using namespace std;

int main() {
  int a[4];
  int b[4];
  while (cin >> a[0] >> a[1] >> a[2] >> a[3]) {
    cin >> b[0] >> b[1] >> b[2] >> b[3];
    int hit = 0;
    int blow = 0;
    for (int i = 0; i < 4; i++) {
      if (a[i] == b[i]) {
        hit++;
        continue;
      } else {
        for (int j = 0; j < 4; j++) {
          if (a[i] == b[j]) {
            blow++;
            continue;
          }
        }
      }
    }
    cout << hit << ' ' << blow << endl;
  }
  return 0;
}

C++: #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#define PI 3.1415926535897932384626433
using namespace std;
int main(){
    int a[4],b[4];
    while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]){
        int hit=0,blow=0;
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
                if(i==j&&b[i]==a[j])hit++;
                else if(b[i]==a[j])blow++;
            }
        }
        cout<<hit<<' '<<blow<<endl;
    }
    return 0;
}

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

int main(void)
{
	int a[4], b[4], hit, blow;

	while (cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]) {
		hit = 0;
		blow = 0;
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				if (a[i] == b[j]) {
					if (i == j) hit++;
					else blow++;
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
    int a[4][50],b[4][50],hit,blow,n;
    n = 0;
    while(cin >> a[0][n] >> a[1][n] >> a[2][n] >> a[3][n] 
            >> b[0][n] >> b[1][n] >> b[2][n] >> b[3][n] ){
        n++;
       
    }
    
    for(int i = 0;i < n;i++){
        hit = blow = 0;
        for(int j = 0;j < 4;j++){
            for(int k = 0;k < 4;k++){
                if(a[j][i] == b[k][i]){
                    if(j == k){
                        hit++;
                    }
                    else{
                        blow++;
                    }
                }
            }
        }
        cout << hit << " " << blow << endl;
    }
}

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

int a[4], b[4];

int main(){
	while(scanf("%d %d %d %d", &a[0], &a[1], &a[2], &a[3]) != EOF){
		scanf("%d %d %d %d", &b[0], &b[1], &b[2], &b[3]);
		int hit = 0, blow = 0;
		for(int i = 0; i < 4; i++){
			for(int j = 0; j < 4; j++){
				if(a[i] == b[j] && i == j) hit++;
				else if(a[i] == b[j] && i != j) blow++;
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include<math.h>
using namespace std;

int main(){
	int a[4],b[4],work[10],hit,blow;
	while(scanf("%d %d %d %d\n%d %d %d %d",&a[0],&a[1],&a[2],&a[3],&b[0],&b[1],&b[2],&b[3])!=EOF){
		hit = blow = 0;
		for(int i=0;i < 10;i++)work[i] = -1;
		for(int i=0;i<4;i++)work[a[i]]=i;
		for(int i=0;i<4;i++){
			if(work[b[i]] == i)hit++;
			else if(work[b[i]] != -1)blow++;
		}
		printf("%d %d\n",hit,blow);
	}

    return 0;
}

C++: 
#include <iostream>

int main(){
    int a_num[4];
    int b_num[4];
    
    while (true) {
        
        // input a's number.
        for (int i=0; i<4; ++i) {
            if(! (std::cin >> a_num[i]) ){
                return 0;
            }
        }
        // input b's number.
        for (int i=0; i<4; ++i) {
            if(! (std::cin >> b_num[i]) ){
                return 0;
            }
        }
        
        // count hit.
        int hit=0;
        for (int i=0; i<4; ++i) {
            if (a_num[i] == b_num[i]) {
                ++hit;
            }
        }
        std::cout << hit << " ";
        
        // count blow.
        int blow=0;
        for (int i=0; i<4; ++i) {
            for (int j=0; j<4; ++j) {
                if (i==j) {
                    break;
                }
                if (b_num[i] == a_num[j]) {
                    ++blow;
                    break;
                }
            }
        }
        std::cout << blow << std::endl;
        
    }
    return 0;
}

C++: // 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
#ifdef DAIJOBU
#include "/home/v-o_o-v/deb.h"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif 

using namespace std;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	int a[4], b[4];
	while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){
		int hit = 0, blow = 0;
		for(int i = 0; i < 4; i++){
			if(b[i] == a[i])hit++;
			else if(find(a, a + 4, b[i]) - a != 4)blow++;
		}
		cout << hit << ' ' << blow << '\n';
	}
	return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
int main ()
{
	int a[4];
	int b[4];
	while(scanf("%d%d%d%d", &a[0], &a[1], &a[2], &a[3]) != EOF)
	{
		int num1 = 0;
		int num2 = 0;
		for(int i=0; i<4; i++)
		{
			scanf("%d", &b[i]);
			if(b[i] == a[i])
				num1++;
		}
		for(int i=0; i<4; i++)
		for(int j=0; j<4; j++)
		{
			if(a[i] == b[j])
				num2++;
		}
		printf("%d %d\n", num1, num2 - num1);
	}
	return 0;
}

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

using namespace std;

int main() {

    int a[4], b[4];
    int hit, blow;

    while(1) {

        hit = 0;
        blow = 0;

        for(int i = 0; i < 4; ++i) {
            if(!(cin >> a[i])) return 0;
        }

        for(int i = 0; i < 4; ++i) {
            cin >> b[i];
        }

        for(int i = 0; i < 4; ++i) {
            for(int j = 0; j < 4; ++j) {
                if(b[i] == a[j]) {
                    if(i == j) {
                        ++hit;
                    } else {
                        ++blow;
                    }
                }
            }
        }

        cout << hit << ' ' << blow << endl;

    }

    return 0;

}