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>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> P;

inline int tax(int p, int x) {
    return p * (100 + x) / 100;
}

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

    int n;
    cin >> n;
    set<string> st;
    rep(i, n) {
        string s;
        cin >> s;
        st.insert(s);
    }
    int m;
    cin >> m;
    bool locked = true;
    rep(i, m) {
        string s;
        cin >> s;
        if (st.count(s)) {
            cout << (locked ? "Opened by " : "Closed by ") << s << endl;
            locked ^= 1;
        } else {
            cout << "Unknown " << s << endl;
        }
    }
}

C++: #include <iostream>
#include <string>
using namespace	std;
int main(){

  string a[256],b;
  bool tf=0,c=0;
  int i,j,n,m;

  cin>>n;
  for(i=0;i<n;i++) cin>>a[i];
  cin>>m;
  for(i=0;i<m;i++){
    cin>>b;
    for(j=0;j<n;j++){
      if(a[j]==b){
        if(tf==0){
          cout<<"Opened by "<<b<<endl;
          tf=1;
	}
        else{
          cout<<"Closed by "<<b<<endl;
          tf=0;
	}
        c=1;
        break;
      }
    }
    if(c==0) cout<<"Unknown "<<b<<endl;
    c=0;

  }

  return 0;

}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,n-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
 
int main() {
	int N, M;
	cin >> N;

	set<string> name;
	string tmp;
	REP(i, N) {
		cin >> tmp;
		name.insert(tmp);
	}

	int status = 0;
	cin >> M;
	REP(i, M) {
		cin >> tmp;
		if(EXIST(name, tmp)) {
			if(!status%2) {
				cout << "Opened by " << tmp << endl;
			} else {
				cout << "Closed by " << tmp << endl;
			}
			status++;
		} else {
			cout << "Unknown " << tmp << endl;
		}
	}
	
	return 0;
}

C++: #include<iostream>
#include<cctype>
#include<vector>
#include <ctype.h>
#include<algorithm>
#include<queue>
#include<string>
#include <math.h>
using namespace std;
vector<string> a, b;
string q;
int c, d,door=0,p=0;
int main() {
	cin >>c;
	for (size_t i = 0; i < c; i++)
	{
		cin >> q;
		a.push_back(q);
	}
	cin >> d;
	for (size_t i = 0; i < d; i++)
	{
		cin >> q;
		for (size_t l = 0; l < c; l++)
		{
			if (q == a[l])p++;
		}
		if (p == 0)
		{
			cout << "Unknown " << q << endl;
		}
		else if (door == 0)
		{
			door++; cout << "Opened by " << q << endl;
		}
		else{  cout << "Closed by " << q << endl;
		door = 0;
		}
		p = 0;
	}
	return 0;
	}

C++: #include <iostream>
#include <string>
#include <unordered_set>

using namespace std;

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

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

    int m;
    cin >> m;
    bool open = false;
    for (int i = 0; i < m; ++i) {
        string t;
        cin >> t;
        if (ids.find(t) != end(ids)) {
            if (open) {
                cout << "Closed by " << t << endl;
            }
            else {
                cout << "Opened by " << t << endl;
            }
            open = !open;
        }
        else {
            cout << "Unknown " << t << endl;
        }
    }
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	int n, m, t=0;
	cin >> n;
	string a[n];
	for (int i=0;i<n;i++) {
		cin >> a[i];
	}
	cin >> m;
	string b[m];
	for (int i=0;i<m;i++){
		cin >> b[i];
		for(int j=0;j<n;j++){
			if(a[j]==b[i]){
				if(t%2==0){
					cout << "Opend by " << a[j] << endl;
					t++;
					break;
				}else if(t%2==1){
					cout << "Closed by " << a[j] << endl;
					t++;
					break;
				}
			}else if(j==n-1){
				cout << "Unknown " << b[i] << endl;
				break;
			}
		}
	}
}

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

using namespace std;

int main()
{
	int N, M;

	bool locked = true;

	cin >> N;

	vector<string> U(N);

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

	cin >> M;

	vector<string> T(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 (T[i] == U[j])
			{
				goto Exit1;
			}
		}

		cout << "Unknown " << T[i] << endl;

		goto Exit2;

	Exit1:;

		if (locked == true)
		{
			locked = false;

			cout << "Opened by " << T[i] << endl;
		}
		else
		{
			locked = true;

			cout << "Closed by " << T[i] << endl;
		}

	Exit2:;
	}

	return 0;
}

C++: #include<iostream>
#include<string>
#include<set>
using namespace std;
int main()
{
	int n,m;
	string u,t;
	set<string>s;
	for(cin>>n;n--;)
	{
		cin>>u;
		s.insert(u);
	}
	bool f=0;
	for(cin>>m;m--;)
	{
		cin>>t;
		if(s.find(t)==s.end())
			cout<<"Unknown ";
		else
		{
			if(f)cout<<"Closed by ";
			else cout<<"Opened by ";
			f=!f;
		}
		cout<<t<<endl;
	}
	return 0;
}

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <queue>

#pragma warning( disable: 4996 )

using namespace std;

typedef long long ll;

#define INF 1000000000
#define EPS 1e-10

#define MAX_N 256
#define MAX_M 256

int N, M;
map<string, bool> m;

vector<string> ans_list;

int main(){

	cin >> N;
	for (int i = 0; i < N; i++){
		string str;
		cin >> str;
		m[str] = true;
	}
	cin >> M;
	string ans[3];
	ans[0] = "Closed by ";
	ans[1] = "Opened by ";
	ans[2] = "Unknown ";
	int count = 0;

	for (int i = 0; i < M; i++){
		string tmp;
		cin >> tmp;
		if (m[tmp]){
			count++;
			ans_list.push_back(ans[count % 2] + tmp);
		}
		else{
			ans_list.push_back(ans[2] + tmp);
		}
	}


	for (int i = 0; i < ans_list.size(); i++){
		cout << ans_list[i] << endl;
	}

	return 0;

}