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;
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; }
using ll = long long;
using P = pair<ll, ll>;
const long double PI = acos(-1.0L);
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

int n, m;

int main() {
    cin >> n;
    set<string> U;
    for(int i = 0; i < n; ++i) {
        string s; cin >> s;
        U.insert(s);
    }
    cin >> m;
    int cnt = 0;
    for(int i = 0; i < m; ++i) {
        string t; cin >> t;
        if(U.find(t) != U.end()) {
            if(cnt == 0) {
                cout << "Opened by " << t << endl;
            }else {
                cout << "Closed by " << t << endl;
            }
            cnt = (cnt+1)%2;
        }else {
            cout << "Unknown " << t << endl;
        }
    }

}

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

string op="Opened by ";
string cl="Closed by ";
string un="Unknown ";
string ID[257];
string IC;
int n;
int flag=0;

void search(){
  for(int i=0;i<n;i++){
    if(IC==ID[i] && flag==0){
      flag=1;
      cout << op << IC << endl;
      return;
    }else if(IC==ID[i] && flag==1){
      flag=0;
      cout << cl << IC << endl;
      return;
    }
  }
    cout << un << IC << endl;
}

int main(){
  int m,i;
  
  cin >> n;
  for(i=0;i<n;i++){
    cin >> ID[i];
  }
  cin >> m;
  for(i=0;i<m;i++){
    cin >> IC;
    search();
  } 		  
}

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

using namespace std;

int main(){
	int n;
	cin >> n;
	string str[100];
	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 << "Open by " << str2 << endl;
				else cout << "Closed by " << str2 << endl;
				break;
			}
			if(k == n-1){
				cout << "Unknown " << str2 << 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 ? "Opened" : "Closed")<<" by "<<s<<endl;
			locked = !locked;
		}else {
			cout<<"Unknown "<<s<<endl;
		}
	}

	return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n,m;
  cin >> n;
  bool locked=true;
  string u[n],t;
  for(int i=0;i<n;i++) cin >> u[i];
  cin >> m;
  for(int i=0;i<m;i++){
    cin >> t;
    bool touroku=false;
    for(int j=0;j<n;j++){
      if(t==u[j]) touroku=true;
    }
    if(touroku){
      if(locked) cout << "Opened by " << t << endl;
      else cout << "Closed by " << t << endl;
      locked = !locked;
    }
    else cout << "Unknown " << t << endl;
  }
}

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 <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <complex>
#include <fstream>
#include <stdio.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VEC;
typedef vector<VEC> MAT;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define T1 first
#define T2 second.first
#define T3 second.second


//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EPS 1e-8

set<string> sstr;

int main(){
	int n;
	cin>>n;
	REP(i,n){
		string tmp;
		cin>>tmp;
		sstr.insert(tmp);
	}
	cin>>n;
	int flag = 0;
	REP(i,n){
		string tmp;
		cin>>tmp;
		if(EXIST(sstr, tmp)){
			if(flag){
				cout << "Closed by " << tmp << endl;
			}else{
				cout << "Opened by " << tmp << endl;
			}
			flag = !flag;
		}else{
			cout << "Unknown" << 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;

int main ()
{
    int n;
    cin >> n;
    set<string> str;
    while (n--) {
        string tmp;
        cin >> tmp;
        str.insert(tmp);
    }

    cin >> n;
    int key = 0;
    while (n--) {
        string tmp;
        cin >> tmp;
        if (str.find(tmp) == str.end()) {
            cout << "Unknown " << tmp << endl;
        } else {
            cout << (key ? "Closed by " : "Opened by ") << tmp << endl;
            key = key ? 0 : 1;
        }
    }

    return 0;
}