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 ll = long long;
#define int long long

// [a -> b-1]
#define reps(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
// [0 -> a-1]
#define rep(i, a) reps(i, 0, (a))
// [a-1 -> b]
#define rreps(i, a, b) for (int i = (int)((a)-1); i >= (int)(b); i--)
// [a-1 -> 0]
#define rrep(i, a) rreps(i, a, 0)
#define all(v) (v).begin(), (v).end()
// next_permutation(all(v))
#define PERM(v) next_permutation(all(v))
/*sort(all(v));
 * (v).erase(unique(all(v)), v.end())*/
#define UNIQUE(v)\
	sort(all(v));\
	(v).erase(unique(all(v)), v.end())
#define MINV(v) min_element(all(v))
#define MAXV(v) max_element(all(v))
#define MIN3(a, b, c) min(min(a, b), c)
#define MIN4(a, b, c, d) min(MIN3(a, b, c), d)
#define MIN5(a, b, c, d, e) min(MIN4(a, b, c, d), e)
#define MIN6(a, b, c, d, e, f) min(MIN5(a, b, c, d, e), f)
#define MAX3(a, b, c) max(max(a, b), c)
#define MAX4(a, b, c, d) max(MAX3(a, b, c), d)
#define MAX5(a, b, c, d, e) max(MAX4(a, b, c, d), e)
#define MAX6(a, b, c, d, e, f) max(MAX5(a, b, c, d, e), f)
// b is [a, c)
#define RANGE(a, b, c) ((a) <= (b) && (b) < (c))
// c is [a, e) && d is [b, f)
#define RANGE2D(a, b, c, d, e, f) (RANGE((a), (c), (e)) && RANGE((b), (d), (f)))
#define chmin(a, b) a = min(a, (b))
#define chmin3(a, b, c) a = MIN3(a, (b), (c))
#define chmin4(a, b, c, d) a = MIN4(a, (b), (c), (d))
#define chmin5(a, b, c, d, e) a = MIN5(a, (b), (c), (d), (e))
#define chmin6(a, b, c, d, e, f) a = MIN6(a, (b), (c), (d), (e), (f))
#define chmax(a, b) a = max(a, (b))
#define chmax3(a, b, c) a = MAX3(a, (b), (c))
#define chmax4(a, b, c, d) a = MAX4(a, (b), (c), (d))
#define chmax5(a, b, c, d, e) a = MAX5(a, (b), (c), (d), (e))
#define chmax6(a, b, c, d, e, f) a = MAX6(a, (b), (c), (d), (e), (f))
#define fcout cout << fixed << setprecision(15)
#define YES(f) cout << ((f) ? YES_STR : NO_STR) << endl;

using namespace std;

// int solve(int m) {
// }

signed main() {
	int n, m; cin >> n;
	map<string, int> M;
	rep(i, n) {
		string x; cin >> x; M[x] = 1;
	}
	bool open = false;
	cin >> m;
	rep(i, m) {
		string id; cin >> id;
		if (M[id]) {
			if (!open) cout << "Opened by " << id << endl;
			else cout << "Closed by " << id << endl;
			open = !open;
		} else {
			cout << "Unknown " << id << endl;
		}
	}
}

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

// BEGIN CUT HERE
#ifdef _MSC_VER
#include <agents.h>
#endif
// END CUT HERE 

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) begin(v), end(v)
#define REV(v) rbegin(v), rend(v)
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define MP make_pair
#define MT make_tuple
#define X first
#define Y second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

int main(){
	ios::sync_with_stdio(false);

	set<string> st;
	int n;
	cin >> n;
	rep(i, n){
		string s;
		cin >> s;
		st.insert(s);
	}
	int m;
	cin >> m;
	int cnt = 0;
	string out[] = { "Opened by ", "Closed by " };
	rep(i, m){
		string s;
		cin >> s;
		if (st.count(s)){
			cout << out[cnt++&1];
		}
		else{
			cout << "Unknown ";
		}
		cout << s << endl;
	}

	return 0;
}

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

using namespace std;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    vector<string> users(n);

    for( auto &x : users )
        cin >> x;

    int m;
    cin >> m;

    int state = 0;

    for(int i = 0; i < m; i++){

        string t;
        cin >> t;

        if( find(users.begin(), users.end(), t) != users.end() ){

            state ^= 1;

            if(state)
                cout << "Opened by ";
            else
                cout << "Closed by ";

            cout << t << endl;

        } else {
            cout << "Unknown " << t << endl;
        }

    }

    return 0;

}

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

using namespace std;

int main(){
	int N, M;
	while(cin >> N){
		set<string> S;
		for(int i=0;i<N;i++){
			string s; cin >> s;
			S.insert(s);
		}
		cin >> M;
		int open = 0;
		for(int i=0;i<M;i++){
			string s; cin >> s;
			if(S.count(s)){
				if(open) cout << "Closed by ";
				else     cout << "Opened by ";
				cout << s << endl;
				open = !open;
			} else {
				cout << "Unknown " << s << endl;
			}
		}
	}
}

C++: 
#include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <stdlib.h>
#include <math.h>
#include <list>
#include <algorithm>

using namespace std;

int main(void){
	//FILE* fp_in = freopen("data.txt", "r", stdin);

	int N, M;
	bool s = true;
	vector<string> ID;
	string message[] = {
		"Opened by ",
		"Closed by ",
		"Unknown "
	};
	cin >> N;

	for(int i = 0; i < N; i++) {
		string tmp;
		cin >> tmp;
		ID.push_back( tmp );
	}
	cin >> M;
	for(int i = 0; i < M; i++) {
		string tmp;
		cin >> tmp;
		bool flg = false;
		for(int j = 0; j < N; j++) {
			if( tmp == ID.at(j) ) {
				flg = true;
				s = 1 - s;
				cout << message[s] << tmp << endl;
				break;
			}
		}
		if( flg == false ) {
			cout << message[2] << tmp << endl;
		}
	}

	//while(1){}
	return 0;
}

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

int main() {
	int n, m;
	string u, t;
	map<string, bool> IC;
	bool flag = false;
	cin >> n;
	for(int i = 0; i < n; ++i){
		cin >> u;
		IC[u] = true;
	}
	cin >> m;
	for(int i = 0; i < m; ++i){
		cin >> t;
		if(IC[t]){
			if(flag){
				cout << "Closed by " << t << endl;
			}
			else{
				cout << "Opened by " << t << endl;
			}
			flag ^= 1;
		}
		else{
			cout << "Unknown " << t << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<cstring>
#include<utility>
#include<set>
#include<stack>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int>PI;
using namespace std;
#define MAX  999999
int main(){
    vs s(10000);
    int  n; cin >> n;
    rep(i,n) cin >> s[i];
    int t; cin >> t; vs h(10000);
    rep(i,t) cin >> h[i];
    bool check = true; bool belong = false;
    rep(i,t){
        belong = false;
        rep(j,n){
        if(h[i] ==s[j]){
            belong = true;
            if(check){cout<< "Opened by " << h[i] << endl; check = false;}
            else {cout << "Closed by " << h[i] << endl; check = true;}
            break;
            }
        }
        if(!belong) cout << "Unknown " << h[i] << endl;
    }
}