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>
#define REP(i,n,N) for(int i=n;i<N;i++)
#define p(S) cout<<(S)<<endl
#define ck(a,b) (0<=(a)&&(a)<(b))

using namespace std;


int main(){
	int N,M;
	cin>>N;
	set<string> s;
	string str;
	REP(i,0,N) cin>>str,s.insert(str);
	cin>>M;
	bool flag=true;
	REP(i,0,M){
		cin>>str;
		if(s.find(str)!=s.end()){
			if(flag) cout<<"Opened by ";
			else cout<<"Closed by ";
			flag=!flag;
		}else	cout<<"Unknown ";
		p(str);
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int n;
    cin >> n;
    string id[257];
    for(int i = 0; i < n; i++){
        cin >> id[i];
    }
    int lock = 0;
    int m;
    cin >> m;
    string x;
    for(int i = 0; i < m; i++){
        int cnt = 0;
        cin >> x;
        for(int j = 0; j < n; j++){
            if(x == id[j]){
                if(lock == 0){
                    lock = 1;
                    cout << "Opened by " << x << endl;
                }
                else{
                    lock = 0;
                    cout << "Closed by " << x << endl;
                }
                continue;
            }
            else cnt++;
        }
        if(cnt == n){
            cout << "Unknown " << x << endl;
        }
    }
        
    return 0;
}

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

int main(){
  int n,m;
  string s;
  map<string,bool> id;
  bool open = false;

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

  cin >> m;
  for(int i=0;i<m;i++){
    cin >> s;
    if(id[s]){
      if(open)cout << "Closed by " << s << endl;
      else cout << "Opened by " << s << endl;
      open = !open;
    }else{
      cout << "Unknown " << s << endl;
    }
  }
}

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

int main() {
  int N; cin >> N;
  set<string> U;
  for(int i = 0; i < N; ++i) {
    string id; cin >> id;
    U.insert(id);
  }
  int M; cin >> M;
  for(bool door = 0; M--; ) {
    string id; cin >> id;
    if(U.count(id)) {
      if(door) cout << "Closed by " << id << endl;
      else cout << "Opened by " << id << endl;
      door ^= 1;
    } else {
      cout << "Unknown " << id << endl;
    }
  }
  return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
  int n,m,f=0,c=0;
  string u[300],t;
  cin>>n;
  for(int i=0;i<n;i++)cin>>u[i];
  cin>>m;
  for(int i=0;i<m;i++){
    c=0;
    cin>>t;
    for(int j=0;j<n;j++){
      if(t==u[j]){
	if(f==0){
	  cout<<"Opened by "<<t<<endl;
	  f=1;
	  c++;
	}else{
	  cout<<"Closed by "<<t<<endl;
	  f=0;
	  c++;
	}
      }
    }if(c==0)cout<<"Unknown "<<t<<endl;
  }
  return 0;
}

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

int main(void){
	int N,M;
	string s;
	bool locked=true;
	map<string,bool> ID;

	cin>>N;
	rep(i,N){
		cin>>s;
		ID[s]=true;
	}

	cin>>M;
	rep(i,M){
		cin>>s;
		if(ID[s]){
			cout<<(locked ? "Openned" : "Closed")<<" by "<<s<<endl;
			locked = !locked;
		}else {
			cout<<"Unknown "<<s<<endl;
		}
	}

	return 0;
}

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

main(){
  int N, M; 
  string name;
  set<string> U;
  cin >> N;
  for ( int i = 0; i < N; i++ ){
    cin >> name;
    U.insert(name);
  }
  int state = 0;
  cin >> M;
  for ( int i = 0; i < M; i++ ){
    cin >> name;
    if ( U.find(name) == U.end() ){
      cout << "Unknown " << name << endl;
    } else {
      cout << ((state%2==0)?"Opened":"Closed") << " by " << name << endl;
      state++;
    }
  }
}

C++: #define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

int main(){
  int registered_num,enter_num;
  while(~scanf("%d",&registered_num)){
    map<string,bool> table;
    for(int i=0;i<registered_num;i++){
      string key;
      cin >> key;
      table[key] = true;
    }
    scanf("%d",&enter_num);
    int count = 0;
    for(int i=0;i<enter_num;i++){
      string key;
      cin >> key;
      if(table.find(key) != table.end()){
	// Unknown abcc
	printf("%s %s\n","Unknown",key.c_str());
      }
      else{
	// Opened by abcd
	// Closed by efgh	
	printf("%s by %s\n",(count % 2 == 0) ? "Opened" : "Closed",key.c_str());
	count++;
      }
    }
  }
}

C++: #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
// const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
	int N; cin >> N;
	vector<string> S(N);
	rep(i,N) cin >> S[i];
	int M; cin >> M;
	vector<string> T(M);
	rep(i,M) cin >> T[i];

	int key = 0;
	rep(i,M) {
		bool flag = false;
		rep(j,N) {
			if (T[i] == S[j]) {
				flag = true;
				key = 1 - key;
			}
		}
		if (flag) {
			if (key) cout << "Opened by " << T[i] << endl;
			else cout << "Closed by " << T[i] << endl;
		} else cout << "Unknown " << T[i] << endl;
	}
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-6;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

const int64 mod = 1e9+7;

int main(void){
	int32 N, M;
	set<string> st;
	cin >> N;
	string s;
	REP(i, N){
		cin >> s;
		st.insert(s);
	}
	cin >> M;
	bool closing = 1;
	REP(i, M){
		cin >> s;
		if(st.find(s) != st.end()){
			if(closing) cout << "Opened by " << s << endl;
			else cout << "Closed by " << s << endl;
			closing = !closing;
		}else{
			cout << "Unknown " << s << endl;
		}
	}
}