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<string>
using namespace std;
int main(){
  int n,m,f=0,c=0;
  string u[300],t;
  cin>>n;
  for(int i=0;i<n;i++)cin>>u[i];
  cin>>m;
  for(int i=0;i<m;i++){
    c=0;
    cin>>t;
    for(int j=0;j<n;j++){
      if(t==u[j]){
	if(f==0){
	  cout<<"Opened by "<<t<<endl;
	  f=1;
	  c++;
	}else{
	  cout<<"Closed by "<<t<<endl;
	  f=0;
	  c++;
	}
      }
    }if(c==0)cout<<"Unknown "<<t<<endl;
  }
  return 0;
}

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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

signed main(){
	int N=read();
	string U[N];
	REP(i,N){
		cin >> U[i];
	}
	int M=read();
	string T[M];
	bool keyOpend = false; 
	REP(i,M){
		cin >> T[i];
		REP(j,N){
			if(T[i].compare(U[j])==0){
				if(keyOpend){
					cout << "Closed by " << T[i] << endl;
				}
				else{
					cout << "Opened by " << T[i] << endl;
				}
				keyOpend = !keyOpend;
				break;
			}
			if(j==N-1) cout << "Unknown " << T[i] << endl;
		}
	}
}

C++: #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <valarray>
#include <vector>

#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(__typeof((X).begin()) it=(X).begin();it!=(X).end();it++)
#define ite iterator
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define sec second
#define sz(x) ((int)(x).size())

using namespace std;

struct timer{
	time_t start;
	timer(){start=clock();}
	~timer(){cerr<<1.*(clock()-start)/CLOCKS_PER_SEC<<" secs"<<endl;}
};

typedef istringstream iss;
typedef long long ll;
typedef pair<int,int> pi;
typedef stringstream sst;
typedef vector<int> vi;



int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	
	int N,M;
	cin>>N;
	set<string> S;
	rep(i,N){
		string s;
		cin>>s;
		S.insert(s);
	}
	cin>>M;
	int open=0;
	rep(i,M){
		string s;
		cin>>s;
		if(!S.count(s))cout<<"Unknown "<<s<<endl;
		else{
			if(!open)cout<<"Opened by "<<s<<endl;
			else cout<<"Closed by "<<s<<endl;
			open^=1;
		}
	}
}

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

using namespace std;

#define rep(i,b) for(int i=0; i<b; i++)

int main(){
    set<string> ids;
    int n; cin>>n;
    rep(i,n){
        string id; cin >> id;
        ids.insert(id);
    }
    int m; cin >> m;
    bool open = true;
    string s[2]={"Opened by","Closed by"};

    rep(i,m){
        string id; cin >> id;
        auto it=ids.find(id);
        if(it!=ids.end()){
            cout << s[open=1-open] << *it << endl;
        } else {
            cout << "Unknown " << id << endl;
        }
    }
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001


int main(){
    cin.sync_with_stdio(false);
    int n;
    cin >> n;
    unordered_map<string, int> mp;
    rep(i, n) {
        string s;
        cin >> s;
        mp[s] = 1;
    }
    int m;
    cin >> m;
    bool close = true;
    rep(i, m) {
        string s;
        cin >> s;
        if (mp[s] == 0) {
            cout << "Unknown " << s << endl;
        } else if (close) {
            cout << "Opened by " << s << endl;
            close = false;
        } else{
            cout << "Closed by " << s << endl;
            close = true;
        }
    }

    return 0;
}

C++: #include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

long long int N, M, K, Q, W, H, L, R;
long long int ans;

using namespace std;


int main() {
	ios::sync_with_stdio(false);
	cin >> N;
	string s[1000] = {};
	for (int i = 0; i < N; i++)cin >> s[i];
	cin >> M;
	string t;
	for (int i = 0; i < M; i++) {
		cin >> t;
		bool f = false;
		for (int j = 0; j < N; j++) {
			if (t == s[j])f = true;
		}
		if (f) {
			cout << "Opened by " << t << endl;
		}
		else {
			cout << "Unknown " << t << endl;
		}
	}
	return 0;
}

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

int main() {
    int N, M;
    cin >> N;
    vector<string> vn(N);
    for (auto& i : vn) cin >> i;
    cin >> M;

    bool flag = false;
    while (M--) {
        string s;
        cin >> s;
        if (find(vn.begin(), vn.end(), s) != vn.end()) {
            if (flag) cout << "Closed by " << s << endl;
            else cout << "Opened by " << s << endl;

            flag = !flag;
        } else {
            cout << "Unknown " << s << endl;
        }
    }

    return 0;
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-6;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

const int64 mod = 1e9+7;

int main(void){
	int32 N, M;
	set<string> st;
	cin >> N;
	string s;
	REP(i, N){
		cin >> s;
		st.insert(s);
	}
	cin >> M;
	bool closing = 1;
	REP(i, M){
		cin >> s;
		if(st.find(s) != st.end()){
			if(closing) cout << "Opened by " << s << endl;
			else cout << "Closed by " << s << endl;
			closing = !closing;
		}else{
			cout << "Unknown by " << s << endl;
		}
	}
}