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 <algorithm>
#include <stdlib.h>
#include <string>
#include <queue>
#include <map>
using namespace std;

int main(){
map<string,int> hito;
int n,m;
string s;
cin>>n;
for(int q=0;q<n;q++){
cin>>s;
hito[s]=1;
}
cin>>m;
int j=0;
for(int q=0;q<m;q++){
cin>>s;
if(hito.find(s)==hito.end()) cout<<"Unknown "<<s<<endl;
else{
if(j%2==1)cout<<"Closed by "<<s<<endl;
else cout<<"Opened by " <<s<<endl;
j++;
}
}

C++: #include<iostream>
#include<string>
#include<vector>
using namespace std;
bool find(vector<string>l,string s) {
	bool b = false;
	for (int i = 0; i < l.size(); i++){
		if (l[i] == s) {
			b = true;
			break;
		}
	}
	return b;
}
int main() {
	int n; cin >> n;
	vector<string>l;
	for (int i = 0; i < n; i++){
		string s; cin >> s;
		l.push_back(s);
	}
	cin >> n;
	bool b = false;//false->closed
	for (int i = 0; i < n; i++){
		string s; cin >> s;
		if (find(l,s) == true) {
			if (b){
				cout << "Closed by " << s << endl;
				b = false;
			}
			else{
				cout << "Opened by " << s << endl;
				b = true;
			}
		}
		else{
			cout << "Unknown " << s << endl;
		}
	}
	return 0;
}

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

int main() {
  int N;
  cin >> N;

  map<string, int> U;
  for (int i = 0; i < N; i++) {
    string u;
    cin >> u;

    U[u] = 1;
  }

  bool open = false;

  int M;
  cin >> M;
  for (int i = 0; i < M; i++) {
    string t;
    cin >> t;

    if (U[t] == 0) {
      cout << "Unknown ";
    } else {
      if (open) {
	cout << "Closed by ";
      } else {
	cout << "Opened by ";
      }
      open = !open;
    }

    cout << t << endl;
  }

  return 0;
}

C++: #include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int main() {
  int N; cin >>N;
  set<string> U;
  REP(i, N){
    string s; cin >>s;
    U.insert(s);
  }
  bool o = false;
  int M; cin >>M;
  REP(i, M){
    string s; cin >>s;
    if(U.find(s) == U.end()) cout <<"Unknown " <<s <<endl;
    else{
      cout <<(!o ? "Opened by " : "Closed by ") <<s <<endl;
      o = (o + 1) % 2;
    }
  }
  return 0;
}

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

#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

int main(void) {
	int n, m;
	bool flag = false;
	
	cin >> n;
	vector<string>u(n + 1);
	FOR(i, 1, n) {
		cin >> u[i];
	}
	cin >> m;
	vector<string>t(m + 1);
	FOR(i, 1, m) {
		cin >> t[i];
	}

	FOR(i, 1, m) {
		FOR(j, 1, n) {
			if (t[i] == u[j]) {
				if (flag==false) {
					cout << "Opened by ";
					flag = true;
				}
				else {
					cout << "Closed by ";
					flag = false;
				}
				
				cout << t[i] << endl;
				break;
			}
			if (j == n) {
				cout << "Unknown ";
				cout << t[i] << endl;
			}
		}
	}

	
}

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

int main(){
  int n,m;
  cin >> n;
  map<string,int> flg;
  for(int i=0;i<n;i++){
    string str;
    cin >> str;
    flg[str] = 1;
  }
  cin >> m;
  int now = 1;
  for(int i=0;i<m;i++){
    string str;
    cin >> str;
    if(flg[str] == 1){
      if(now) {
	cout << "Opened by " << str << endl;
	now = 0;
      }
      else {
	cout << "Closed by " << str << endl;
	now = 1;
      }
    }
    else {
      cout << "Unknown " << str << endl;
    }
  }
}

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

int main(){

	int N;
	int state = 1; //??????
	cin >> N;
	char ID[N][11];
	for (int i = 0; i <= N-1; i++){
		cin >> ID[i];
	}

	int M;
	cin >> M;
	char IC[M][11];

	for (int i = 0; i <= M-1; i++){
		cin >> IC[i];
		int check = 0;
		for (int j = 0; j<= N-1; j++){
			if(strcmp(IC[i],ID[j]) == 0){
				if (state == 1){
					state = 0;
					check = 1;
					cout << "Opened by" << " " << ID[j] << endl;
				}
				else if (state == 0){
					state = 1;
					cout << "Closed by" << " " << ID[j] << endl;
					check = 1;
				}
			}
		}
		if (check == 0){
				cout << "Unknown" << " " << IC[i] << endl;
			}
	}
}

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

int main(){
  int num_1,num_2;
  int i,j;
  string ID[257];
  string ID_2;
  int flg=0; //flg = 0→施錠 flg = 1→開錠 
  cin >> num_1;
  for(i = 0 ; i < num_1 ; i++){
    cin >> ID[i];
  }

  cin >> num_2;

  for(i = 0 ; i < num_2 ; i++){
    int flg_2 = 0;
    cin >> ID_2;
    for(j = 0 ; j < num_1 ; j++){
      if(ID_2==ID[j]&&flg==0){
	flg = 1;
	flg_2 = 1;
	cout << "Opened by" << " " << ID_2 << endl;
      }else if(ID_2==ID[j]&&flg==1){
	flg = 0;
	flg_2 =1;
	cout << "Closed by" << " " << ID_2 << endl;
      }else{
	continue;
      }
    }
    if(flg_2 == 0){
      cout << "Unknown" << " " << ID_2 << endl;
    }
  }
  return 0;
}

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

int main(){
  int n,m;
  set<string> id;

  cin >> n;
  for(int i=0;i<n;i++){
    string s;
    cin >> s;
    id.insert(s);
  }

  cin >> m;
  int open = 0;
  for(int i=0;i<m;i++){
    string s;
    cin >> s;
    if(id.count(s) == 0)cout << "Unknown " << s << endl;
    else {
      cout << (open?"Closed":"Opened") <<  " by " << s << endl;
      open = 1-open;
    }
  }
}

C++: #include <cstdio>
#include <iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
string u[256];
int main(){
	int n,m;
	cin >> n;
	bool op=0;
	rep(i,n) cin >> u[i];
	cin >> m;
	rep(i,m){
		string s;
		cin >> s;
		bool ok=false;
		rep(j,n){
			if(s==u[j]){
				if(op) cout << "Closed by " << s << endl;
				else cout << "Opened by " << s << endl;
				op=!op;
				ok=true;
				break;
			}
		}
		if(!ok) cout << "Unknown " << s << endl;
	}
	return 0;
}

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

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