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 <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
    int n;
    cin >> n;

    map<string,bool> ma;
    rep(i,n) {
        string s;
        cin >> s;
        ma[s] = true;
    }

    int m;
    cin >> m;

    bool lock = true;
    rep(i,m) {
        string s;
        cin >> s;

        if(!ma[s]) cout << "Unkown " << s << endl;
        else {
            if(lock) cout << "Opened by " << s << endl;
            else cout << "Closed by " << s << endl;
            lock = !lock;
        }
    }
    
    return 0;
}

C++: #include<iostream>
#include<string>
#include<map>
using namespace std;
int main(){
  map<string,int> U;
  int n,m=0;
  cin >>n;
  while(n--){
    string s;
    cin >>s;
    U[s] = 1;
  }
  cin >>n;
  while(n--){
    string s;
    cin >>s;
    if(U[s] == 1){
      if(m == 0) cout <<"Opened by "<<s<<endl;
      else cout <<"Closed by "<<s<<endl;
      m = 1-m;
    }
    else cout <<"Unknown "<<s<<endl;
  }
  return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:https://onlinejudge.u-aizu.ac.jp/challenges/sources/JAG/Summer/2440>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */
void solve(){
    int N; cin >> N;
    map<string,int> mp;
    set<string> s;
    for(int i = 0; i < N;i++) { string U; cin >> U; mp[U] = 0; s.insert(U);}
    int M; cin >> M;
    bool state = false;
    for(int i = 0; i < M;i++){
        string T; cin >> T;
        if(s.find(T) == s.end()){
            cout << "Unknown " << T << endl;
        }else{
            if(state == 0){
                state = 1;
                cout << "Opened by " << T << endl;
            }else{
                state = 0;
                cout << "Closed by " << T << endl;
            }
        }
    }
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve();
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <stack>
#include <queue>

using namespace std;

int main(void) {
	int n, m;
	string id;
	string U[256];
	bool opened = false, unknown;
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> U[i];
	}
	cin >> m;
	for(int i = 0; i < m; i++) {
		cin >> id;
		unknown = true;
		for(int i = 0; i < n; i++) {
			if(id == U[i]) {
				cout << (opened ? "Closed by " : "Opened by ") << id << endl;
				opened = !opened;
				unknown = false;
				break;
			}
		}
		if(unknown) cout << "Unknown " << id << endl;
	}

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (ll)(1E9+7)
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}



int main() {
	int n,m,flag=0,flag2=0;
	cin >> n;
	vector<string> key(n);
	rep(i, n) {
		cin >> key[i];
	}
	cin >> m;
	int count = 0;
	string str;
	rep(i, m) {
		cin >> str;
		for (auto c : key) {
			count++;
			if (str == c) {
				if (flag == 0) {
					cout << "Opened by " << c << endl;
					flag = 1;
					flag2 = 1;
					break;
				}
				else {
					cout << "Closed by " << c << endl;
					flag = 0;
					flag2 = 1;
					break;
				}
			}
		}
		if (count == n&&flag2==0) {
			cout << "Unknown " << str << endl;
		}
		count = 0;
		flag2 = 0;
	}

}

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

int main(){

  int n,m;
  string s[1000],t[1000];
  bool a = true,b = true,c = true;

  cin >> n;
  for(int i=0;i<n;i++) cin >> s[i];

  cin >> m;
  for(int i=0;i<m;i++) cin >> t[i];

  for(int i=0;i<m;i++){
    for(int j=0;j<n;j++){
      if(s[j] == t[i] && a == true){
	cout << "Opened by " << t[i] << endl;
	a = false;
	b = false;
	break;
      }
      if(s[j] == t[i] && a == false){
	cout << "Closed by " << t[i] << endl;
	a = true;
	b = false;
	break;
      }
    }
    if(b == true) cout << "Unknown " << t[i] << endl;
    b = true;
  }
}

C++: #include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<utility>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
 
using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+9
#define EPS 1e-9
#define rep(i,j) for(int i = 0; i < (j); i++)
#define reps(i,j,k) for(int i = j; i < (k); i++)
typedef long long ll;
int main(){
    int n;
    vector<string> ok;
    scanf("%d",&n);
    rep(i,n){
        string str;
        cin >> str;
        ok.push_back(str);
    }
    int m;
    bool f = false;
    scanf("%d",&m);
    rep(i,m){
        bool c = false;
        string str;
        cin >> str;
        rep(j,n){
            if(ok[j] == str){
                (f) ? f = false : f = true;
                c = true;
                (f) ? printf("Opened by ") : printf("Closed by ");
            }
        }
        if(!c)printf("Unknown ");
        cout << str << endl;
    }
    return 0;
}