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

using namespace std;

int main()
{
    set<string> si;
    bool open = false;

    int n;
    cin >> n;
    while (n--) {
        string u;
        cin >> u;
        si.insert(u);
    }

    int m;
    cin >> m;
    while (m--) {
        string t;
        cin >> t;
        if (si.find(t) == si.end()) {
            cout << "Unknown " << t << endl;
        } else {
            if (open)
                cout << "Closed by " << t << endl;
            else
                cout << "Opened by " << t << endl;
            open = !open;
        }
    }
    return 0;
}

C++: #include<bits/stdc++.h>

int main(){
　int N,M;
  int cnt1 = 0;
  int cnt2 = 0;
  string U[256];
  string 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<bits/stdc++.h>
using namespace std;

int main(){
  int N, M, a, O = 1, f = 0;
  string U[300], T;
  int i, j, k;
  cin>>N;
  for(i = 0; i < N; i++)cin>>U[i];
  
  cin>>M;
  
  for(i = 0; i < M; i++){
    	cin>>T;
	j = 0;
		while(j < N){
			f = 0;
			if((int)T.size() == (int)U[j].size()){
      				for(k = 0; k <(int)T.size(); k++){
					if(U[j][k] != T[k]){
						  break;
					}
				}
					if(k == (int)T.size()){
						if(O){
	 		 				cout<<"Opened by "<<T<<endl;
	  				 		 O = 0;
							f = 1;
							break;
						} else{
	 					  	cout<<"Closed by "<<T<<endl;
	  		 				 O = 1;
							f = 1;
							break;
						}
					}
				
    			 }
			if(f == 1) break;
			j++;
		}
		if(j == N) cout<<"Unknown "<<T<<endl;
	
	}
	
  return 0;
}

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

int main() {
  int n, m;
  bool key = 1;
  cin >> n;
  string A[n];
  rep(i, n) cin >> A[i];
  cin >> m;
  rep(i, m) {
    string S;
    cin >> S;
    rep(i, n) if (A[i] == S) {
      cout << (key ? "Opened" : "Closed") << " by " << S << endl;
      if (key)
        key = 0;
      else
        key = 1;
      goto end;
    }
    cout << "Unknown " << S << endl;
  end:;
  }
  return 0;
}

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

int main(){
	int n, m;
	string u[100010];
	string input;

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

		bool isExist = false;
		bool isOpen = false;
		for(int j=0; j < n; j++){
			if(u[j] == input){
				isExist = true;
			}
		}
		if(isExist){
			if(isOpen){
				cout << "Closed by " << input << endl;
				isOpen = false;
			}
			else {
				cout << "Opened by " << input << endl;
				isOpen = true;
			}
		}
		else {
			cout << "Unknown " << input << endl;
		}
	}
}

C++: #include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359
#define EPS 1e-12

int main(void)
{
  int n, m;
  string u[300], t;
  cin >> n;
  REP(i, n) cin >> u[i];
  cin >> m;
  bool key = true;
  REP(i, m) {
    cin >> t;
    bool f = false;
    REP(j, n) {
      if(t == u[j]) f = true;
    }
    if(f) {
      if(key) {
        cout << "Opened by " << t << endl;
        key = false;
      } else {
        cout << "Closed by " << t << endl;
        key = true;
      }
    }
    else {
      cout << "Unknown " << t << endl;
    }
  }

  return 0;
}

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

using namespace std;

#define INF 999999999

int main(){
	int n, m, i, j, door, who;
	vector<string> u, t;
	string s;
	
	door = 0;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> s;
		u.push_back(s);
	}
	cin >> m;
	for(j=0;j<m;j++){
		cin >> s;
		who = -1;
		for(i=0;i<n;i++) if(s == u[i])who = i;
		if(who >= 0){
			if(!door) cout << "Opened by " << u[who] << endl;
			else cout << "Closed by " << u[who] << endl;
			door = 1 - door;
		}
		else cout << "Unknown " << s << endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,count=0,b;
  string u[300],t[300];
  int a[300];
  cin >> n;
  for(int i=0; i<n; i++) cin >> u[i];
  cin >> m;
  for(int i=0; i<m; i++) cin >> t[i];
    
  b=0;
  for(int i=0; i<m; i++){
    for(int j=0; j<n; j++){
      if(t[i]==u[j]){
	    a[b] = 1;
	    break;
	  }
	  else a[b] = 0;
	}
	b++;
  }
  //for(int i=0; i<m; i++) cout << a[i] << " ";
  for(int i=0; i<m; i++){
    if(a[i]==1){
      if(count==0){
        cout << "Opened by " << t[i] << endl;
	    count = 1;
	    }
	    else if(count==1){
	    cout << "Closed by " << t[i] << endl;
	    count = 0;
	    }
	  }
    else cout << "Unknown " << t[i] << endl;
  }
  return 0;
}
//cout << "Opend by " << t[j] << endl;
//cout << "Closed by " << t[j] << endl;
//cout << "Unknown " << t[j] << endl;

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

#define CH(N,A,B) (A<=N&&N<B)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RREP(i,a,b) for(int i=(b-1);a<=i;i--)

using namespace std;

int N, M;
set<string> U;
string T;

int main() {
  cin>>N;
  REP(i,0,N) cin>>T, U.insert(T);
  cin>>M;
  int st = 0;
  REP(i,0,M){
    cin>>T;
    if(U.find(T) == U.end()) cout<<"Unknown "<<T<<endl;
    else if(st == 0)cout<<"Opened by "<<T<<endl, st = 1;
    else cout<<"Closed by "<<T<<endl, st = 0;
  }

  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,m;
    cin>>n;
    std::deque<string> id;
    string s,card;
    for (int i=0;i<n;i++) {
        cin>>s;
        id.emplace_back(s);
    }
    cin>>m;
    int flag=0;
    for (int j=0;j<m;j++) {
        cin>>card;
        if (find(id.begin(),id.end(),card)!=id.end()) {
            if (flag==0) {
                flag=1;
                cout<<"Opened by "<<card<<endl;
            } else {
                flag=0;
                cout<<"Closed by "<<card<<endl;
            }
        } else {
            cout<<"Unknown "<<card<<endl;
        }
    }
}

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

using namespace std;

int main(){
	int n;
	cin >> n;
	string str[256];
	for(int i = 0; i < n; i++){
		cin >> str[i];
	}
	int m;
	cin >> m;
	int cnt=0;
	for(int j = 0; j < m; j++){
		string str2;
		cin >> str2;
		for(int k = 0; k < n; k++){
			if(str[k] == str2){
				cnt++;
				if(cnt % 2 == 1) cout << "Opened by " << str2 << endl;
				else cout << "Closed by " << str2 << endl;
				break;
			}
			if(k == n-1){
				cout << "Unknown " << str2 << endl;
			}
		}
	}
	return 0;
}