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;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-9

int n, m;
map<string, bool> u;
string s;
bool flag;

int main()
{
  cin >> n;
  while(n--){
    cin >> s;
    u[s] = true;
  }

  cin >> m;
  while(m--){
    cin >> s;
    if(u[s]){
      cout << (flag ? "Closed" : "Opened") << " by " << s << endl;
      flag = !flag;
    }
    else{
      cout << "Unknown " << s << endl;
    }
  }

  return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	int n,m,f=-1;
	cin>>n;
	vector<string> u(n);
	string t;
	rep(i,0,n) cin>>u[i];
	cin>>m;
	sort(all(u));
	rep(i,0,m){
		cin>>t;
		if(binary_search(all(u),t)){
			cout<<(f==-1?"Opened by ":"Closed by ");
			cout<<t<<endl;
			f*=-1;
		}else{
			cout<<"Unknown "<<t<<endl;
		}
	}
}

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

#define REP(i, n) for(int (i) = 0; (i) < (n); i++)

using namespace std;

inline int nextInt()       { int d;    cin >> d; return d; }
inline string nextString() { string s; cin >> s; return s; }

int main() {
  int N = nextInt();
  
  unordered_set<string> IDs;
  
  REP(i, N) {
    string str = nextString();
    IDs.insert(str);
  }
  
  int M = nextInt();
  
  bool isOpen = false;
  REP(i, M) {
    string str = nextString();
    if (IDs.find(str) != IDs.end()) {
      // if ID found
      if (isOpen) {
        cout << "Closed by " << str << endl;
      } else {
        cout << "Opened by " << str << endl;
      }
      isOpen = !isOpen;
    } else {
      // Not found
      cout << "Unknown " << str << endl;
    }
  }
  
  return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<map>
using namespace std;
bool fi(vector<string>id,string now){
	for(int i=0;i<id.size();i++){if(now==id[i])return true;}
	return false;
}
int main(){
	int n,m;
	//bool key[2000]={1};
	cin>>n;
	vector<string>id;
	map<string,bool>key;
	for(int i=0;i<n;i++){
		string tmp;
		cin>>tmp;
		id.push_back(tmp);
		key[tmp]=true;
	}
	cin>>m;
	bool flag=1;
	for(int i=0;i<m;i++){
		string now;
		cin>>now;
		if(fi(id,now)==false){
			cout<<"Unknown"<<" "<<now<<endl;
		}
		
		else {
			if(flag==true){
				cout<<"Opened by"<<" "<<now<<endl;
				flag=false;
			}
			else if(flag==false){
				cout<<"Closed by"<<" "<<now<<endl;
				flag=true;
			}
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
vector<string>v;
vector<string>ansl;
string s;
int ary[100005] = {0};
int main(){
  int N,M,flag = 0;
  string opn = "Opened by ",cls = "Closed by ",unk = "Unknown ";

  cin >>N;
  for (int i = 0;i<N;i++){
    cin >>s;
    v.push_back(s);
  }


  cin >>M;
  for(int i = 0;i<M;i++){
    cin >>s;
    int now_flg = flag;
    for(int j = 0;j<N;j++){
      if(s == v[j]){
        if(flag){
          flag = 0;
          ansl.push_back(cls + s);
        }else{
          flag = 1;
          ansl.push_back(opn + s);
        }
      }
    }
    if(now_flg == flag){
      ansl.push_back(unk + s);
    }
  }

  for(int i = 0;i<M;i++){
    cout <<ansl[i]<<endl;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
typedef unsigned int ui;
int main(){
	int n, m;
	vector<string>s; string t;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> t;
		s.push_back(t);
	}
	cin >> m;
	int now = 0;
	for (int i = 0; i < m; i++) {
		cin >> t;
		bool f = false;
		for (int j = 0; j < n; j++) {
			if (s[j] == t)f = true;
		}
		if (f) {
			if (now == 0) {
				now = 1; cout << "Opened by " << t << endl;
			}
			else {
				now = 0; cout << "Closed by " << t << endl;
			}
		}
		else cout << "Unknown " << t << endl;
	}
	return 0;
}

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

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

    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> u;
        key.emplace(u);
    }

    cin >> m;
    bool locked = true;

    for(int i = 0; i < m; i++){
        cin >> u;
        if(key.count(u)){
            if(locked)  cout << "Opened by " << u << endl;
            else        cout << "Closed by " << u << endl;
            locked = !locked; 
        }else{
            cout << "Unknown " << u << endl;
        }
    }
    return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <complex>
#include <vector>
#include <cstdio>
#include <cmath>
#include <time.h>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n)
#define vsort(v) sort(v.begin(),v.end())
#define vvsort(v) sort(v.begin(),v.end(),greater<int>())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
int n;
string u[257];
int m;
string t[257];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++)cin >> u[i];
	cin >> m;
	for (int i = 0; i < m; i++)cin >> t[i];
	bool open = 0;
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
			if (t[i] == u[j]) {
				if (!open) {
					cout << "Opened by ";
					cout << t[i] << endl;
					open = 1;
					break;
				}
				else {
					cout << "Closed by ";
					cout << t[i] << endl;
					open = 0;
					break;
				}
			}
			if (j == n - 1) {
				cout << "Unknown ";
				cout << t[i] << endl;
			}
		}
	}
}