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>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){
	int a[4];
	int b[4];
	while(cin >> a[0]){
		int hit = 0;
		int brow = 0;
		FOR(i,1,4){
			cin >> a[i];
		}
		rep(i,4){
			cin >> b[i];
			if(a[i] == b[i])hit++;
		}
		rep(i,4)rep(j,4){
			if(a[i] == -1 || b[j] == -1)continue;
			if(a[i] == b[j]){
				brow++;
				a[i] = -1; b[j] = -1;
			}
		}
		cout << hit << " " << (brow-hit) << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <array>

int main() {
    std::array<int, 4> a, b;

    while (std::cin >> a[0] >> a[1] >> a[2] >> a[3] 
                    >>b[0] >> b[1] >> b[2] >> b[3]) {
        int cnt_hits = 0, cnt_blows = 0;
        
        for (int i = 0; i < 4; ++i) {
            for (int j = 0; j < 4; ++j) {
                if (a[i] == b[j]) {
                    i != j ? ++cnt_blows : ++cnt_hits;
                }
            }
        }

        std::cout << cnt_hits << " " << cnt_blows << std::endl;
    }

    return 0;
}

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

int main()
{
	for (int a[4],b[4]; 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 (a[i]==b[i]) {
				hit++;
				a[i]=b[i]=-1;
			}
		}
		for (int i=0; i<4; i++) {
			if (a[i]==-1) {
				continue;
			}
			for (int j=0; j<4; j++) {
				if (a[i]==b[j]) {
					blow++;
				}
			}
		}
		cout << hit << ' ' << blow << endl;
	}
	return 0;
}

C++: #include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int a[4],u[10],h,b,t; while(cin>>a[0]){
    rep(i,10)u[i]=0; h=0,b=0;
    rep(i,3)cin>>a[i+1]; rep(i,4)u[a[i]]=1;
    rep(i,4){
      cin>>t; if(a[i]==t)h++;
      if(u[t])b++;
    }
    cout<<h<<" "<<b-h<<endl;
  }
  return 0;
}

C++: #include <iostream>

int main(){
	std::array(u_int, 4) a, b;
	int hit=0, blow=0;

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

    return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
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 H = 0, B = 0;
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++)
				if (a[i] == b[j])B++;
			if (a[i] == b[i]) {
				B--; H++;
			}
		}
		cout << H << " " << B << endl;
	}

	return 0;
}

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

std::vector<int> a, b;
int hit, blow;

int main()
{
	while( 1 ){
		hit = blow = 0;
		a.clear();
		b.clear();
		
		for( int i = 0; i < 4; i++ ){
			int n;
			if( !( std::cin >> n ) ) goto end;
			a.push_back( n );
		}
		
		for( int i = 0; i < 4; i++ ){
			int n;
			if( !( std::cin >> n ) ) goto end;
			b.push_back( n );
		}
		
		for( int i = 0; i < 4; i++ ){
		 	if( a[i] == b[i] ){
			 	hit++;
			}
		}
		
		for( int i = 0; i < 4; i++ ){
			blow += std::count( a.begin(), a.end(), b[i] );
		}
		blow -= hit;
		
		std::cout << hit << " " << blow << std::endl;
	}

end:

 	return 0;
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	vector<int>as(4), bs(4);
	while (cin >> as[0]) {
		for (int i = 0; i < 3; ++i) {
			cin >> as[i + 1];
		}
		for (int i = 0; i < 4; ++i) {
			cin >> bs[i];
		}
		int hit = 0, blow = 0;
		for (int i = 0; i < 4;++i){
			if (as[i] == bs[i])hit++;
			for (int j = 0; j < 4; ++j) {
				if (i == j)continue;
				if (as[i] == bs[j])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 = 50;
    for(int i = 0;i < 50;i++){
        cin >> a[0][i] >> a[1][i] >> a[2][i] >> a[3][i] 
            >> b[0][i] >> b[1][i] >> b[2][i] >> b[3][i] ;
           } 
    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 <iostream>
#include <string>
using namespace std;
 
int main()
{
    int a[4],b[4],i,j,hit,blow;
    while(cin >> a[0]){
        for (i = 1 ; i < 4 ; i++){
            cin >> a[i];
        }
        for(i = 0 ; i < 4 ; i++){
            cin >> b[i];
        }
        hit = 0;
        blow = 0;
        for(i = 0 ; i < 4 ; i++){
            if(a[i] == b[i]){
                hit++;
            } else {
                for(j = 0 ; j < 4 ; j++){
                    if(a[i] == b[j]){
                        blow++;
                    }
                }
            }
             
        }
        cout << hit << " " << blow << endl;
    }
    return 0;
}

C++: #include<iostream>
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++){
      if(a[i] == b[i]){hit++; a[i] = 10; b[i] = 11;}
    }
    for(int i=0; i<4; i++){
      for(int j=0; j<4; j++){
	if(a[i] == b[j]){blow++; a[i] = 10; b[j] = 11;}
      }
    }
    cout <<hit<<" "<<blow<<endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
  char a[4], b[4];
  int hi, bl, i, j;
  while (cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]) {
    for (i = hi = bl = 0; i < 4; i++) {
      for (j = 0; j < 4; j++) {
        if (b[i] == a[j]) {
          if (i == j) 
            hi++;
          else
            bl++;
        }
      }
    }
    cout << hi << ' ' << bl << endl;
  }
  return 0;
}