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 <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int n; cin>>n;
    map<string,int>mp;
    rep(i,n){string gotiusa_is_god; cin>>gotiusa_is_god;mp[gotiusa_is_god]++;}
    int ujimatsu_tiya; cin>>ujimatsu_tiya;
    bool gotiusa=true;
    rep(i,ujimatsu_tiya){
        string rize; cin>>rize;
        if(!mp[rize]){cout<<"Unknown "<<rize<<endl; continue;}
        if(gotiusa)cout<<"Opened by "<<rize<<endl;
        else cout<<"Closed by "<<rize<<endl;
        if(gotiusa)gotiusa=false;
        else gotiusa=true;
    }
}

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

int main(){
	int n, m;
	vector<string> U;
	string T;
	int Lock = 1;

	cin >> n;
	for (int i = 0; i < n; i++){
		string u;
		cin >> u;
		U.push_back(u);
	}
	cin >> m;
	for (int i = 0; i < m; i++){
		cin >> T;
		int flg = 0;
		for (int j = 0; j < U.size(); j++){
			if (T == U[j]){
				if (Lock == 0){
					cout << "Closed by " << T << endl;
					Lock = 1;
				}
				else{
					cout << "Opened by " << T << endl;
					Lock = 0;
				}
				flg = 1;
				break;
			}
		}
		if (flg == 0) cout << "Unknown " << T << endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<math.h>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iomanip>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug" << x << endl;
using namespace std;

int main(){
    int n, m;
    bool open = false;
    map<string, int> door;
    cin >> n;
    while(n--){
        string input;
        cin >> input;
        door[input] = 1;
    }
    cin >> m;
    while(m--){
        string input;
        cin >> input;
        if(door.find(input) == door.end()){
            cout << "Unknown " << input << endl;
        }else{
            if(door[input] == 1 && open == false){
                cout << "Opened by " << input << endl;
                open = true;
            }else if(door[input] == 1 && open == true){
                cout << "Closed by " << input << endl;
                open = false;
            }
        }

    }
}

C++: #include<iostream>
#include<string>
using namespace std;
int main()
{
	int n,m; cin>>n;
	string id[n];
	for(int i = 0; i < n; ++i)
	{
		cin>>id[i];
	}
	cin>>m;
	bool isOpen=false;
	for(int i = 0; i < m; ++i)
	{
		string in; cin>>in;
		bool out=false;
		for(int j = 0; j < n; ++j)
		{
			if(in==id[j])
			{
				if(!isOpen) cout<<"Opened by "<<in<<endl;
				else cout<<"Closed by "<<in<<endl;
				isOpen=~isOpen;
				out=true;
				break;
			}
		}
		if(!out) cout<<"Unknown "<<in<<endl;
	}
  return 0;
}

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

int N, M, c;
map<string, int> mp;
vector<string> T;

string solve(string s) {
  if (!mp[s]) return "Unknown " + s;
  return ( (++c % 2) ? "Opened by " : "Closed by " ) + s;
}

int main() {
  cin >> N;
  for (int i = 0; i < N; ++i) {
    string U; cin >> U;
    ++mp[U];
  }
  cin >> M;
  T = vector<string>(M);
  for (int i = 0; i < M; ++i) cin >> T[i];

  for (auto&& s : T) cout << solve(s) << endl;
  return 0;
}

C++: #include <iostream>
using namespace std;
string u[257];
string t;
int n,m;
bool door;
void check(string s){
	for(int i=0;i<n;i++){
		if(u[i]==s){
			if(door){
				door=false;
				cout <<"Closed by " ;
			}else{
				door=true;
				cout <<"Opened by " ;
			}
			cout << s<<endl;
			return;
		}
	}
	cout << "Unknown "<< s <<endl;
}





int main(){
	door=false;
	cin >>n;
	for(int i=0;i<n;i++){
		cin >>u[i];
	}
	cin >>m;
	for(int i=0;i<m;i++){
		cin >>t;
		check(t);
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;


vector<int>  dx = {1,-1,0,0};
vector<int>  dy = {0,0,1,-1};


int main() {
	
	int N; cin >> N;
	vector<pair<string, int>> v;
	for (int i = 0; i < N; i++) {
		string s; cin >> s;
		v.push_back(make_pair(s,-1));
	}

	int M; cin >> M;
	int state = -1;
	for (int i = 0; i < M; i++) {
		string s; cin >> s;
		for (int j = 0; j < v.size(); j++) {
			if (v[j].first == s) {
				state *= -1;
				if (state == 1) {
					cout << "Opened by " << s << endl;
				}else {
					cout << "Closed by " << s << endl;
				}
				break;
			}else if (v[j].first != s and j == v.size() - 1) {
				cout << "Unknown " << s << endl;	
			}
		}
	}

	return 0;
}

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

int main(){
    int n,m,k=0,h=0;
    string u[256];
    string t[256];

    cin>>n;

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

    cin>>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]){
                if(k==0){
                    cout<<"Opened by "<<t[i]<<endl;
                    k=1;
                    h++;
                }
                else if(k==1){
                    cout<<"Closed by "<<t[i]<<endl;
                    k=0;
                    h++;
                }       
            }       
        }
        if(h==0){
            cout<<"Unknown "<<t[i]<<endl;
        }
        h=0;
    }
}

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

typedef map<string,bool> ID;

int main(){
  ID id;
  bool b = true;
  int n,m;
  
  cin >> n;
  for(int i = 0; i < n; i++){
    string str;
    cin >> str;
    id[str] = true;
  }
  
  cin >> m;
  for(int i = 0; i < m; i++){
    string str;
    cin >> str;
    if(id.count(str)){
      cout << (b ? "Opened by " : "Closed by ") ;
      b = !b;
    }else{
      cout << "Unknown ";
    }
    cout << str << endl;
  }
}

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;
}