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;
int main() {
	vector<string>VS{ "Opened by ","Closed by ","Unknown " };
	set<string>SS;
	int N;
	cin >> N;
	for( size_t i = 0; i < N; i++ ) {
		string S;
		cin >> S;
		SS.insert( S );
	}
	cin >> N;
	bool x = 0;
	for( size_t i = 0; i < N; i++ ) {
		string S;
		cin >> S;
		if( SS.end() == find( SS.begin(), SS.end(), S ) ) {
			cout << VS[2] << S << endl;
		} else {
			cout << VS[x] << S << endl;
			x = 1 - x;
		}
	}
	sleep(1500);
	return 0;
}

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

int main(){
  int N,M,islocked=1,found=0;
  char U[256][11],T[11];

  cin >> N;

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

  cin >> M;

  for (int i=0;i<M;i++){
    cin >> T;
    found=0;
    for (int j=0;j<N;j++)
      if (strcmp(T,U[j])==0)found=1;
    if (found){
      if (islocked) cout << "Opened by " << T << endl;
      else cout << "Closed by " << T << endl;
      islocked = !islocked;
    } else cout << "Unknown " << T << endl;
  }
  return 0;
}

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


int N,M;

int main(){


  cin >> N;
  bool open = false;
  set<string> ID;       
  for(int i = 0; i < N ; i++){
    string tmp;
    cin >> tmp;
    ID.insert(tmp);
  }

  cin >> M;
  for(int i = 0; i < M ; i++){
    string tmp;  
    cin >> tmp;

    if(ID.count(tmp) == 0){
      cout <<"Unknown " << tmp << endl;
    }
    else{
      if(open){
	open = false;
	cout << "Closed by " << tmp << endl;
      }else{
	open =true;
	cout << "Opened by " << tmp << 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;}
 
int main(){

  int n,m;
  bool open=true;

  cin >> n;
  string tou[200];
  REP(i,n){
	cin >> tou[i];
  }
  cin >> m;
  string kita;
  REP(i,m){
	cin >> kita;
	REP(j,n){
	  if(kita == tou[j]){
		if(open){
		  cout<<"Opened by "<<kita<<endl;
		  open = (not open);
		  break;
		}else{
		  cout<<"Closed by "<<kita<<endl;
		  open = (not open);
		  break;
		}
	  }
	  if(j==n-1)  cout<<"Unknown "<<kita<<endl;
	}
  }
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  int now=0; // 0-close 1-open
  string user[257];
  string visit[257];
  cin>>n;
  for(int i=0;i<n;i++)cin>>user[i];
  cin>>m;
  for(int i=0;i<m;i++)cin>>visit[i];
 
  for(int i=0;i<m;i++){
    int flag=0;
    for(int j=0;j<n;j++){
      if(user[i]==visit[j]){
	if(now==0){
	  cout<<"Opened by "<<user[i]<<endl;
	  now=1;
	}else{
	  cout<<"Closed by "<<user[i]<<endl;
	  now=0;
	}
	flag=1;
      }
    }
    if(flag){
      cout<<"Unknown "<<user[i]<<endl;
    }
  }
  return 0;
}

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

using namespace std;

int main(){
	int n;
	cin >> n;
	set<string> st;
	while(n--){
		string s;
		cin >> s;
		st.insert(s);
	}
	int m;
	cin >> m;
	bool flag = false;
	while(m--){
		string s;
		cin >> s;
		if(st.find(s) == st.end()){
			cout << "Unknown " << s << endl;
		}else{
			flag = !flag;
			cout << (flag ? "Opened by " : "Closed by ") << s << endl;
		}
	}
	return 0;
}

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

void solve()
{
	int N;
	cin >> N;
	set<string> ID;
	while(N--)
	{
		string str;
		cin >> str;
		ID.insert(str);
	}
	int M;
	cin >> M;
	bool flag = false;
	while(M--)
	{
		string str;
		cin >> str;
		if(ID.find(str) == ID.end())
		{
			cout << "Unknown " << str << endl;
		}
		else
		{
			if(!flag)
			{
				cout << "Opened by " << str << endl;
			}
			else
			{
				cout << "Closed by " << str << endl;
			}
			flag = !flag;
		}
	}
}

int main()
{
	solve();
	return(0);
}

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 << "Opened 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 <map>
#include <iostream>
using namespace std;
int main(){
	map<string,int>m;
	string s;
	int N,M,f=0;
	for(cin>>N;N--;m[s]=1)cin>>s;
	for(cin>>M;M--;cout<<s<<endl)if(cin>>s,m[s])cout<<(f?"Closed by ":"Opened by "),f^=1;else cout<<"Unknown ";
}

C++: #include<bits/stdc++.h>
 
using namespace std;
 
#define rep(i, n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define pb push_back


int main(){
    int n,m;

    cin>>n;
    vector<string> v;


    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        v.push_back(s);
    }

    cin>>m;
    int count=0;

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

        for(int j=0;j<v.size();j++){
            if(t==v[j]){
                flag=true;
                if(count%2==0){
                    cout<<"Opened by "<<t<<endl;
                    count++;
                    break;
                }else if(count%2==1){
                    cout<<"Closed by "<<t<<endl;
                    count++;
                    break;
                }
            }
        }
        if(!flag){
            cout<<"Unknown "<<t<<endl;
        }
    }
}

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

int main()
{
  int n,m;
  string u;
  map<string, bool> mp;

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

  string t;
  bool isOpen = false;
  cin >> m;
  for(int j = 0 ; j < m ; j++){
    cin >> t;
    if(mp[t] == true){
      if(isOpen == true){
	cout << "Closed by " << t << '\n';
      }else{
	cout << "Opened by " << t << '\n';
      }
      isOpen = !isOpen; 
    }else{
      cout << "Unknown " << t << '\n';
    }
  }

  
  return 0;
}

C++: #include <iostream>
#include <cstring>
//#include <cstdio>

using namespace std;

int main(){
	int N,M;
	//scanf("%d",&N);
	cin >> N;
	int flag=0,oc=0,i,j;
	char U[256][11];
	for(i=0;i<N;i++){
		//scanf("%s",U[i]);
		cin >> U[i];
	}
	//scanf("%d",&M);
	cin >> M;
	char T[11];
	for(i=0;i<M;i++){
		flag=0;
		//scanf("%s",T);
		cin >> T;
		for(j=0;j<N;j++){
			if(strcmp(U[j],T)==0){
				flag=1;
				break;
			}
		}
		if(flag==0){
			cout<<"Unknown "<<T<<endl;
		}else if(oc==0){
			cout<<"Opened by "<<T<<endl;
			oc=1;
		}else{
			cout<<"Closed by "<<T<<endl;
			oc=0;
		}
	}


	return 0;
}