Go: package main

import "fmt"

func main() {
    var n, m int
    fmt.Scan(&n)

    u := make([]string, 300)

    for i := 0; i < n; i++ {
        fmt.Scan(&u[i])
    }

    fmt.Scan(&m)

    is_lock := true
    for i := 0; i < m; i++ {
        var t string
        fmt.Scan(&t)

        is_include := false
        for j := 0; j < n; j++ {
            if t == u[j] {
                is_include = true
                break
            }
        }
        if is_include == false {
            fmt.Printf("Unknown %s\n", t)
        } else if (is_lock) {
            fmt.Printf("Opened by %s\n", t)
            is_lock = false
        } else {
            fmt.Printf("Closed by %s\n", t)
            is_lock = true
        }
    }
}

C++: #include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N,M;
    cin >> N;
    set<string> st;
    rep(i,0,N){
        string s;
        cin >> s;
        st.insert(s);
    }
    cin >> M;
    int turn = 0;//0 close
    rep(i,0,M){
        string s;
        cin >> s;
        if(st.count(s)){
            if(!turn)cout << "Opened by " + s << endl;
            else     cout << "Closed by " + s << endl;
            turn = !turn;
        }else{
            cout << "Unknown " + s << endl;
        }
    }
}

C++: #include <iostream>
#include <algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
	int n; cin>>n;
	string s[n]; rep(i,n) cin>>s[i];
	int m; cin>>m;
	int cnt=0;
	rep(i,m){
		string t; cin>>t;
		bool flg=0;
		rep(j,n){
			if(t==s[j]) flg=1;
		}
		if(flg){
			cnt++;
			if(cnt%2==1) cout<<"Opened by "<<t<<endl;
			else cout<<"Closed by "<<t<<endl;
		}else{
			cout<<"Unknown "<<t<<endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <stack>

using namespace std;

#define Getsign(n) ((n > 0) - (n < 0))
#define QWERTYR(c) (c == 'y' || c == 'u' || (c >= 'h' && c <= 'p') ?	true : false)
typedef vector<int> Ivec;
typedef pair<int, int> pii; // (cst, to)

int main() {
	int n, m;
	map<string, bool> IDs;
	scanf("%d", &n);
	for (int i = 0; n > i; i++) {
		char str[11];
		scanf("%s", str);
		IDs[string(str)] = true;
	}
	scanf("%d", &m);
	bool state = false;
	for (int i = 0; m + i; i++) {
		char str[11];
		scanf("%s", str);
		if (IDs[string(str)]) {
			state = 1 - state;
			printf("%sed by %s\n", state ? "Open" : "Clo", str);
		}
		else {
			printf("Unknown %s\n", str);
		}
	}

	return 0;
}

C++: ///
// File:  2440.cpp
// Author: ymiyamoto
//
// Created on Fri Nov 10 15:06:25 2017
//

#include <cstdint>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

enum status_t {
  Open,
  Close,
};

int32_t main()
{
  uint32_t N, U;
  cin >> N;

  vector<string> registered;
  for (uint32_t i = 0; i < N; i++) {
    string str;
    cin >> str;
    registered.push_back(str);
  }

  cin >> U;
  bool is_close = true;
  for (uint32_t i = 0; i < U; i++) {
    string str;
    cin >> str;
    uint32_t j = 0;
    for (; j < registered.size(); j++) {
      if (str == registered[j]) {
        if (is_close) {
          cout << "Opened by " << str << endl;
        } else {
          cout << "Closed by " << str << endl;
        }
        is_close = !is_close;
        break;
      }
    }

    if (j == registered.size()) {
      cout << "Unknown " << str << endl;
    }
  }

  return 0;
}