Go: package main

import "fmt"

func main() {
	var a1, a2, a3, a4, b1, b2, b3, b4 int
	for {
		i, _ := fmt.Scan(&a1, &a2, &a3, &a4)
		if i == 0 {
			break
		}
		fmt.Scan(&b1, &b2, &b3, &b4)
		a := [4]int{a1, a2, a3, a4}
		b := [4]int{b1, b2, b3, b4}
		var hit, blow int

		for j := 0; j < 4; j++ {
			for k := 0; k < 4; k++ {
				if a[j] == b[k] {
					if j == k {
						hit++
					} else {
						blow++
					}
				}
			}
		}
		fmt.Println(hit, blow)
	}
}

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 (b_num[i] == a_num[j]) {
                    ++blow;
                    break;
                }
            }
        }
        std::cout << blow << std::endl;
        
    }
    return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cstring>
#include <cctype>
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <functional>
#include <complex>
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
const double PI = 3.141592653589793238462643383279502884L;
const int LARGE_PRIME = 1000000007;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(auto i = (c).rbegin(); i != (c).rend(); i++)
#define repfn(i,a,cont,next) \
  for(auto i = (a); [=](){return(cont);}(); i = [=](){return(next);}())
#define repby(i,a,b,s) repfn(i,a,i<b,i+s)
#define repab(i,a,b) repby(i,a,b,1)
#define rep(i,b) repab(i,0,b)
#define pb push_back
#define sz(c) int((c).size())

int main(int argc, char **argv)
{
  vi a(4), b(4);
  map<int, int> m;
  int hit;

  while(!cin.eof()) {
    for (auto v:{&a, &b}) {
      rep (i, 4) {
        cin >> (*v)[i];
      }
    }
    if (cin.eof())
      break;

    m.clear();
    hit = 0;

    rep (i, 4) {
      m[a[i]]++;
      m[b[i]]++;
      if (a[i] == b[i])
        hit++;
    }
    cout << hit << " ";
    cout << count_if(all(m), [](pii p){ return p.second==2;}) - hit << endl;
  }
  return 0;
}

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

int main(){
	int a[4], b[4];
	int hit, blow;
	while(1){
		hit = blow = 0;
		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++){
			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<cmath>
#include<iostream>
#include <bits/stdc++.h>
#define REP(i,s,n) for(int i=0;i<n;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;
using ld = long double;

int main(){
  int a,b,c,d;
  int e,f,g,h;
  int a_ans, b_ans;
  while(cin>>a>>b>>c>>d, cin>>e>>f>>g>>h){
    // cout<<a<<b<<c<<d<<e<<f<<g<<h;
    a_ans=0;b_ans=0;
    if(a==e)a_ans+=1;
    else if(a==f|a==g|a==h)b_ans+=1;
    if(b==f)a_ans+=1;
    else if(b==e|b==g|b==h)b_ans+=1;
    if(c==g)a_ans+=1;
    else if(c==f|c==e|c==h)b_ans+=1;
    if(d==h)a_ans+=1;
    else if(d==f|d==g|d==e)b_ans+=1;
    cout << a_ans << " " << b_ans<<endl;
  }
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
#define mp make_pair
#define IP pair<int,int>
#define enld endl

int main() {
	vector<int>A(4);
	vector<int>B(4);
	while (cin >> A[0] >> A[1] >> A[2] >> A[3] >> B[0] >> B[1] >> B[2] >> B[3]) {
		int ans1 = 0;
		int ans2 = 0;
		rep(i, 4) {
			if (A[i] == B[i]) {
				ans1++;
			}
		}
		rep(i, 4) {
			rep(j, 4) {
				if (A[i] == B[j]) {
					ans2++;
				}
			}
		}
		cout << ans1 << ' ' << ans2 - ans1 << endl;
	}
}

C++: #include<iostream>
#include<vector>
using namespace std;
int main(){
  vector<int> hit_anss;
  vector<int> bolor_anss;
  int nums_a[4],nums_b[4];
  while(cin>>nums_a[0]>>nums_a[1]>>nums_a[2]>>nums_a[3]>>nums_a[3]){
    int hit=0,bolor=0;
    for(int i=0;i<4;i++){
      cin>>nums_b[i];
    }
    //hit????¢????
    for(int i=0;i<4;i++){
      if(nums_a[i]==nums_b[i])hit++;
    }
    //bolor????¢????
    for(int i=0;i<4;i++){
      for(int j=0;j<4;j++){
        if(i==j)continue;
        if(nums_a[i]==nums_b[j]){
          bolor++;
          break;
        }
      }
    }
    hit_anss.push_back(hit);
    bolor_anss.push_back(bolor);
  }
  for(int i=0;i<hit_anss.size();i++){
    cout<<hit_anss[i]<<' '<<bolor_anss[i]<<endl;
  }
}

C++: #include<iostream>

using namespace std;

int hit(int *ans, int *q){
	int i, hit = 0;
	for(i = 0; i < 4; i ++){
		if(ans[i] == q[i]) hit ++;
	}
	return hit;
}

int blow(int *ans, int *q){
	int i, j, blow = 0;
	for(i = 0; i < 4; i ++){
		for(j = 0; j < 4; j  ++){
			if(ans[i] == q[j] && i != j) blow ++;
		}
	}
	return blow;
}

int main(){
	int  q[4], ans[4], i, cut1, cut2;

	while(cin >> q[0] >> q[1] >> q[2] >> q[3]){
		cut1 = 0, cut2 = 0;
		for(i = 0; i < 4; i ++){
			cin >> ans[i];
		}

		cut1 = hit(ans, q);
		cut2 = blow(ans, q);

		cout << cut1 << " " << cut2 << endl;
	}

	return 0;
}

C++: #include<cstdio>
using namespace std;
int main(){
  int a[10],b[4],i,h,br,a1,a2,a3,a4;
  while(scanf("%d%d%d%d",&a1,&a2,&a3,&a4)!=EOF){
    scanf("%d%d%d%d",&b[0],&b[1],&b[2],&b[3]);
    for(i=0,h=0,br=0;i<10;i++)a[i]=0;
    a[a1]=1,a[a2]=2,a[a3]=3,a[a4]=4;
    for(i=0;i<4;i++)if(a[b[i]]==i+1)h++;else if(a[b[i]])br++;
    printf("%d %d\n",h,br);
  }
}

C++: #include <iostream>

using namespace std;

int main(){
	int a[4];
	int b[4];
	int hit=0;
	int blow=0;
	int m, n;

	for(int i=0; i<4; i++){
		cin >> a[i];
	}
	for(int i=0; i<4; i++){
		cin >> b[i];
	}
	for(m=0; m<4; m++){
		for(n=0; n<4; n++){
			if(a[m] == b[n] && m == n){
				hit = hit + 1;
			}
			else if(a[m] == b[n]){
				blow = blow + 1;
			}
		}
	}
		
	cout << hit << " " << blow << endl;
}

C++: #include<iostream>
using namespace std;
int main(void){
	float low=1000000,high=0,yama;
	while(1){
		cin>>yama;
		if(high<yama)high=yama;
		else if(low>yama)low=yama;
	}
	cout<<high-low<<endl;
	return 0;
}

C++: #include<iostream>
int main() {
	int input[4];
	for (int i = 0; i < 4;++i) {
		std::cin >> input[i];
	}
	int answer[4];
	for (int i = 0; i < 4; ++i) {
		std::cin >> answer[i];
	}
	int e=0, b=0;
	for (int i = 0; i < 4; ++i) {
		for (int j = 0; j < 4; ++j) {
			if (input[i] == answer[j]) {
				if (i == j)++e;
				else ++b;
				break;
			}
		}
	}
	std::cout << e << " " << b << std::endl;
return 0;
}