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 <cstdio>
#include <utility>
#include <unordered_set>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	unordered_set<string> m;
	string s;
	bool k = false;
	for (int n = in(); n; n--) {
		scan(s);
		m.insert(s);
	}
	for (int n = in(); n; n--) {
		scan(s);
		auto r = m.find(s);
		if (r != m.end()) {
			outl(k ? "Closed by " : "Opened by ", s);
			k ^= true;
		} else
			outl("Unknown ", s);
	}
}

C++: #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    cin>>n;
    set<string> set;
    rep(i,n){
        string s;
        cin>>s;
        set.insert(s);
    }
    int m;
    cin>>m;
    bool f=true;
    rep(i,m){
        string s;
        cin>>s;
        if(set.find(s)!=set.end()){
            cout<<(f?"Opened":"Closed")<<" by "<<s<<endl;
            f=!f;
        }
        else{
            cout<<"Unknown "<<s<<endl;
        }
    }
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> piii;
typedef pair<ll,ll> pll;

#define reps(i,f,n) for(int i = int(f); i <= int(n); i++)
#define rep(i,n) reps(i,0,int(n)-1)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)

#define all(x) (x).begin(),(x).end()
#define X first
#define Y second

#define sz size()
#define eb emplace_back


int main(void){
  int n,m;
  vector<string> u;
  string t;
  cin >> n;
  rep(i,n){cin >> t;u.eb(t);}
  cin >> m;
  bool s = false;
  rep(i,m){
    bool f=false;
    cin >> t;
    rep(i,n){
      if(t==u[i]){
        f=true;
      }
    }
    if(f){
      if(s) cout << "Opened by " << t << endl;
      else  cout << "Closed by " << t << endl;
      s ^= true;
    }else{
      cout << "Unknown " << t << endl;
    }
  }



  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
	string data[256],id;
	bool door=false;
	int n,m;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>data[i];
	}
	cin>>m;
	for(int i=0;i<m;i++){
		cin>>id;
		bool f=false;
		for(int j=0;j<n;j++){
			if(id==data[j]){
				f=true;
				if(door){
					door=false;
					cout<<"Closed by "<<id<<endl;
					break;
				}else{
					door=true;
					cout<<"Opened by "<<id<<endl;
					break;
				}
			}
		}
		if(!f)cout<<"Unknown "<<id<<endl;
	}
}

C++: #include <cstdio>
#include <string>
#include <algorithm>

using namespace std;

int N, M;
string U[256];

int main() {
  char s[14];
  scanf("%d", &N);
  for (int i=0;i<N;i++) {
    scanf("%s", s);
    U[i] = s;
  }
  scanf("%d", &M);
  bool opened = false;
  for (int i=0;i<M;i++) {
    scanf("%s", s);
    const string* p = find(U, U+N, (string)s);
    if (!p->empty()) {
      opened = !opened;
      printf("%s by %s\n", (opened ? "Opened" : "Closed"), s);
    } else {
      printf("Unknown %s\n", s);
    }
  }
  return 0;
}

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

int n,m,flag=1;
string u;
map<string,int>mp;

int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>u;
    mp[u]=1;
  }
  
  cin>>m;
  for(int i=0;i<m;i++){
    cin>>u;
    if(mp.count(u)){
      if(flag){cout<<"Opened by "<<u<<endl;flag=0;}
      else{cout<<"Closed by "<<u<<endl;flag=1;}
    }
    else cout<<"Unknown "<<u<<endl;
  }
}

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

int n,m;
map<string,int> regi;
string s;
bool now=1;

int main(){
  int i;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> s;
    regi[s]=1;
  }
  cin >> m;
  for(i=0;i<m;i++){
    cin >> s;
    if(regi.find(s)==regi.end())cout << "Unknown " << s << endl;
    else {
      if(now){
	cout << "Opened by " << s << endl;
	now=0;
      }
      else {
	cout << "Closed by " << s << endl;
	now++;
      }
    }
  }
  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<m;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==m-1){
				cout << "Unknown " << b[i] << endl;
				break;
			}
		}
	}
}

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

int main(){
  int N, M, cnt1, cnt2;
  cnt1=0;
  cnt2=0;
  string U[256], 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(U[i] == T[j]) cnt1++;
      else cnt2++;
    }
    if(cnt2 == N) cout<<"Unknown"<<" "<<T[j]<<endl;
    if(cnt1 % 2 == 1 && cnt2 != N) cout<<"Opened by"<<" "<<T[j]<<endl;
    if(cnt1 % 2 == 0 && cnt2 != N) cout<<"Closed by"<<" "<<T[j]<<endl;
    cnt2=0;
   
  }

  return 0;
}