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 <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int
 
#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))
 
typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;
 
typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;
 
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;
 
namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}
 
signed main() {
    int n, m; cin >> n;
    string s;
    set<string> namelist;
    rep(i,0,n) {
        cin >> s;
        namelist.insert(s);
    }
    
    cin >> m;
    bool open = false;
    rep(i,0,m) {
        cin >> s;
        if(namelist.count(s)) {
            open ^= 1;
            if(open) cout << "Opened by " << s << endl;
            else cout << "Closed by " << s << endl;
        }
        else cout << "Unknown " << s << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

vector<string> nlist;
bool isinclude(string tmp){
	REP(i,nlist.size()){
		if(nlist[i]==tmp) return true;
	}
	return false;
}
int main(){
	int n;
	cin >> n;
	REP(i,n){
		string tmp;
		cin >> tmp;
		nlist.pb(tmp);
	}
	int nows = 0;
	cin >> n;
	REP(i,n){
		string tmp;
		cin >> tmp;
		if(isinclude(tmp)){
			if(nows == 1){
				cout << "Closed by " << tmp << endl;
			}else{
				cout << "Opened by " << tmp << endl;
			}
			nows = 1 - nows;
		}else{
			cout << "Unknown " << tmp << endl; 
		}
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<list>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
using namespace std;
int main() {
	int n;
	cin >> n;
	string a[256];
	for (int i = 0; i < n; i++) cin >> a[i];
	int m;
	cin >> m;
	bool l = false;
	for (int i = 0; i < m; i++) {
		string b;
		cin >> b;
		for (int j = 0; j < n; j++) {
			if (a[j] == b) {
				if (!l) {
					cout << "Opened by " + b << endl;
				}
				else {
					cout << "Closed by " << b << endl;
				}
				l = !l;
				goto stop;
			}
		}
		cout << "Unknown " << b << endl;
	stop:;
	}
}

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

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define SORT(v) sort(ALL(v))
//#define scanf scanf_s
typedef pair<int, int> P;

int n, m;
string id[1000];

int main()
{
	cin >> n;
	REP(i, n) cin >> id[i];
	cin >> m;
	string s;
	bool rock = false;
	REP(i, m)
	{
		bool flag = false;
		cin >> s;
		REP(i, n) if (s == id[i]) flag = true;
		if (flag)
		{
			if (rock == false) cout << "Opend by ";
			else cout << "Closed by ";
			cout << s << endl;
			rock = !rock;
		}
		else cout << "Unknown " << s << endl;
	}

	return 0;
}

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

#define INF (1001001001)

int dx[8] = {0, 1, 0, -1, -1, 1, 1, -1};
int dy[8] = {1, 0, -1, 0, 1, 1, -1, -1};

using namespace std;

int main()
{
	int n, m;

	scanf("%d", &n);

	vector<string> ids(n);

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

	bool door = false;

	scanf("%d", &m);

	for (int i = 0; i < m; i++){
		string id;

		cin >> id;

		for (int j = 0; j < n; j++){
			if (id == ids[j]){
				if (door == false){
					cout << "Opened by " << id << endl;

					door = true;
				}
				else {
					cout << "Closed by " << id << endl;

					door = false;
				}

				break;
			}

			if (j == n - 1){
					cout << "Unknown " << id << endl;
			}
		}
	}

	return (0);
}

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

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

	int n;
	cin >> n;

	set<string> u;
	for(int i = 0; i < n; ++i) {
		string s;
		cin >> s;
		u.insert(s);
	}

	int m;
	cin >> m;

	bool lock = true;
	for(int i = 0; i < m; ++i) {
		string t;
		cin >> t;

		if(u.find(t) != u.end()) {
			if(lock)
				cout << "Opened by " << t << endl;
			else
				cout << "Closed by " << t << endl;

			lock = !lock;
		}
		else {
			cout << "Unknown " << t << endl;
		}
	}
	
	return EXIT_SUCCESS;
}

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

int main(){
　int N, M;
  int cnt1 = 0;
  int cnt2 = 0;
  string U[256];
  string T[256];
  cin>>N;
  for(int i=0;i<N;i++) cin>>U[i];
  cin>>M;
  for(int j=0;j<M;j++) cin>>T[j];

  for(int j=0;j<M;j++){
  for(int i=0;i<N;i++){
 if(T[j] == U[i]) cnt1++;
 else cnt2++;
 }
if(cnt1 % 2 == 1 && cnt2 != N) cout<<"Opened by"<<" "<<T[j]<<endl;
if(cnt1 % 2 == 0 && cnt2 != N) cout<<"Closed by"<<" "<<T[j]<<endl;
if(cnt2 == N) cout<<"Unknown"<<" "<<T[j]<<endl;
cnt2 = 0;
}
 return 0;
}

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

using namespace std;

int main() {

    int n, m;
    string id;
    map<string, bool> account;
    bool door = false;

    cin >> n;
    for(int i = 0; i < n; ++i) {
        cin >> id;
        account[id] = true;
    }

    cin >> m;
    for(int i = 0; i < m; ++i) {
        cin >> id;
        if(account.count(id)) {
            if(door == false) cout << "Opened by ";
            else cout << "Closed by ";
            door = !door;
        } else {
            cout << "Unknown ";
        }
        cout << id << endl;
    }

}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <tr1/unordered_set>
using namespace std;

int main() {
    int N; cin >> N;
    tr1::unordered_set<string> s;
    while(N--) {
        string t; cin >> t; s.insert(t);
    }

    int M; cin >> M;
    bool isOpen = false;
    while(M--) {
        string t; cin >> t;
        if(s.count(t)) {
            isOpen ^= 1;
            cout << (isOpen ? "Opened by " : "Closed by ") << t << endl;
        }
        else {
            cout << "Unknown " << t << endl;
        }
    }
}