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

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

using namespace std;

int main(void) {
	int n;
	string id;
	set<string> sU;
	bool opened = false;
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> id;
		sU.insert(id);
	}
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> id;
		if(sU.find(id) == sU.end()) {
			cout << "Unknown " << id << endl;
		} else {
			cout << (opened ? "Closed by " : "Opened by ") << id << endl;
			opened = !opened;
		}
	}
	return 0;
}

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

using namespace std;
 
int main(){
    int n;
    string str;
    vector<string> v;
     
    cin >> n;
    for(int i = 0 ; i < n ; i++){
        cin >> str;
        v.push_back(str);
    }
    cin >> n;
    int st = 0; //0 Closed , 1 Opened
    for(int i = 0 ; i < n ; i++){
        int flg = 0;
        cin >> str;
        for(int j = 0 ; j < v.size() ; j++){
            if(str == v[j]){
                if(!st){
                    cout << "Opened by " << str << endl;
                    st = 1;
                }
                else{
                    cout << "Closed by " << str << endl;
                    st = 0;
                }
                flg = 1;
                break;
            }
        }
        if(!flg) cout << "Unknown " << str << endl;
    } 
    return 0;
}

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 <iostream>
#include <string>


using namespace std;

int main(){
	int n,m;
	string *u,*t;

	cin>>n;
	u = new string [n];

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

	cin>>m;
	t = new string [m];
	for(int i=0;i<m;i++)cin>>t[i];

	int state=0;
	int flag=0;

	for(int i=0;i<m;i++){
		flag=0;
		for(int j=0;j<n;j++){
			if(t[i] == u[j]){
				flag=1;
				if(state==0){
					cout<<"Opened by "<<t[i]<<endl;
				}
				else{
					cout<<"Closed by "<<t[i]<<endl;
				}
				state++;
				state%=2;
				break;
			}
		}
		if(flag==0){
			cout<<"Unknown "<<t[i]<<endl;
		}
	}

	return 0;
}

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

int N,M;
set<string> S;
int main(){
  cin >> N;
  for(int i=0;i<N;i++){
    string s; cin >> s; S.insert( s );
  }
  cin >> M;
  bool f = false;
  for(int i=0;i<M;i++){
    string s; cin >> s;
    if( S.find( s ) != S.end() ){
      if( !f ){
        cout << "Opened"; f = true;
      } else {
        cout << "Closed"; f = false;        
      }
      cout << " by ";
    } else
      cout << "Unknown ";
    cout << s << endl;
  }
}

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

#define pb         push_back

const int INF = 100000000;

int main(void) {
	int n, m;
	set<string> id;
	cin >> n;
	for(int i=0; i<n; i++){
		string t;
		cin >> t;
		id.insert(t);
	}
	cin >> m;
	int state = 1;
	for(int i=0; i<m; i++){
		string t;
		cin >> t;
		if(id.find(t) == id.end()){
			cout << "Unknown " << t << endl;
		}else if(state == 1){
			cout << "Opened by " << t << endl;
			state = 0;
		}else if(state == 0){
			cout << "Closed by " << t << endl;
			state = 1;
		}
	}
	
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int n; cin >> n;
  map<string, bool> mp;
  for(int i=0;i<n;++i) {
    string s; cin >> s;
    mp[s] = true;
  }
  int m; cin >> m;
  bool op = false;
  for(int i=0;i<m;++i) {
    string s; cin >> s;
    if(mp[s]) {
      if(op) {
        cout << "Closed by " << s << endl;
        op = false;
      } else {
        cout << "Opened by " << s << endl;
        op = true;
      }
    } else {
      cout << "Unknown " << s << endl;
    }
  }
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
#include<cstring>
#include <algorithm>

using namespace std;

int main()
{
	int N,M,CP=0,flag=0;
	char U[1000][1000],T[1000];
	
	cin >> N;
	for(int i=0;i<N;i++)cin>>U[i];
	
	cin >> M;
	for(int i=0;i<M;i++)
	{
		cin>>T;
		for(int j=0;j<N;j++)
		{
			int count=0;
			flag=0;
			
			for(int k=0;k<=strlen(T)-1;k++)if(U[j][k]==T[k])count++;

			
			if(count==strlen(T))
			{
				flag=1;
				CP++;
				break;
			}
		}
		if(flag==1)
		{
			if(CP%2==1)cout << "Opened by " << T <<endl;
			else cout << "Closed by " << T <<endl;
		}
		else cout << "Unknown " << T <<endl;
	}
	
	return 0;
}

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

int main(){
	int kc;
    vector<string> key;
	cin>>kc;
	key.resize(kc);
    for (int i = 0; i < kc; i++) cin>>key[i];
    bool isOpen = false;
    int oc;
	cin>>oc;
    for (int i = 0; i < oc; i++)
	{
        string tkey;
		cin>>tkey;
        bool isOK = false;
        for (vector<string>::iterator ita=key.begin();ita!=key.end();++ita)
		{
			if(*ita==tkey)
			{
				isOK=true;
				break;
			}
		}		
        if (!isOK)
        {
            cout<<"Unknown "<<tkey<<endl;
        }
        else if (isOpen)
        {
            cout<<"Closed by "<<tkey<<endl;
            isOpen = false;
        }
        else
        {
            cout<<"Opened by "<<tkey<<endl;
            isOpen = true;
        }
	}
}