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>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
//ranker
using namespace std;

#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using psi = pair<string, int>;
using D = double;


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

  int N;

  cin >> N;

  string U[N];

  REP(i, N) cin >> U[i];

  int M;
  cin >> M;

  string moji;
  int door = 0;
  REP(i, M){
    int cnt = 0;
    cin >> moji;
    REP(i, N){
      if(moji == U[i]){
        cnt = 1;
        door++;
        break;
      }else{
        cnt = 0;
      }
  }
  if(cnt == 1 && door%2 == 1) cout <<  "Opened by" << " " << moji << endl;
  else if(cnt == 1 && door%2 == 0) cout <<  "Closed by" << " " << moji << endl;
  else cout <<  "Unknown" << " " << moji << endl;
}
  return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
using namespace std;

// s.....0=�{�� 1=����
int n, m, s = 0, c = 0;
char u[256][11] = {}, t[256][11] = {};

int check(int a, int b);

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%s", &u[i]);
	}
	scanf("%d", &m);
	for (int i = 0; i < m; i++) {
		scanf("%s", &t[i]);
	}

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

		for (int j = 0; j < n; j++) {
			if (check(j, i)) {
				c = 1;
				if (s == 0) {
					printf("Opened by %s\n", t[i]);
					s = 1;
					break;
				}
				if (s == 1) {
					printf("Closed by %s\n", t[i]);
					s = 0;
					break;
				}
			}
		}

		if (c == 0) {
			printf("Unknown %s\n", t[i]);
		}
	}
	return 0;
}

int check(int a, int b) {
	for (int i = 0; i < 10; i++) {
		if (u[a][i] != t[b][i])
			return 0;
		if (u[a][i] == t[b][i] && u[a][i] == 0)
			return 1;

	}
	//printf("fadsfasf");
	return 0;
}

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

int main(){
	map<string,int> M;

	int n;	cin>>n;
	vector<string> ID(n);
	for(int i=0;i<n;i++){
		cin>>ID[i];
	}

	bool opened=false;

	int m;	cin>>m;
	string t;
	for(int i=0;i<m;i++){
		cin>>t;
		bool flag=false;

		for(int i=0;i<n;i++){
			if(ID[i]==t){
				flag=true;
				if(opened){
					opened=false;
					cout<<"Closed by ";
				}else{
					opened=true;
					cout<<"Opened by ";
				}
				cout<<t<<endl;
				break;
			}
		}
		if(flag==false){
			cout<<"Unknown "<<t<<endl;
		}
	}


	return 0;
}

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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	int n;
	cin >> n;
	map<string, bool> u;
	for(int i=0; i<n; i++){
		string t;
		cin >> t;
		u[t] = false;
	}

	int m;
	cin >> m;
	bool f = false;
	for(int i=0; i<m; i++){
		string t;
		cin >> t;
		if(u.find(t) == u.end()){
			cout << "Unknown " << t << endl;
		}else if(f == false){
			cout << "Opened by " << t << endl;
			f = true;
		}else{
			cout << "Closed by " << t << endl;
			f = false;
		}
	}
	
	return 0;
}

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

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

int n, m;
string u[257], t;
bool is_locked = true, flag;

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

    cin >> n;
    rep(i,n) {
        cin >> u[i];
    }
    cin >> m;
    rep(i,m) {
        cin >> t;
        flag = false;
        rep(j,n) {
            if (u[j] == t) {
                if (is_locked) {
                    cout << "Opened by " << t << endl;
                    is_locked = false;
                } else {
                    cout << "Closed by " << t << endl;
                    is_locked = true;
                }
                flag = true;
                break;
            }
        }
        if (!flag) cout << "Unknown " << t << endl;
    }
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n, m;
  string s[300], k[300];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>k[i];
  }
  cin>>m;
  for(int i=0;i<m;i++){
    cin>>s[i];
  }
  int count=0,c[300]={};
  for(int i=0;i<m;i++){
    for(int j=0;j<n;j++){
      if(s[i] == k[j]){
	count++;
	c[i]++;
	break;
      }
    }
    if(c[i] == 0) cout<<"Unknown"<<" "<<s[i]<<endl;
    else if(c[i] != 0 && count % 2 != 0) cout<<"Open by"<<" "<<s[i]<<endl;
    else if(c[i] != 0 && count % 2 == 0) cout<<"Closed by"<<" "<<s[i]<<endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
	int n; cin >> n;
    set<string> st;
    rep(i,n){
        string s; cin >> s;
        st.insert(s);
    }

    int m; cin >> m;

    bool jud = true;
    rep(i,m){
        string t; cin >> t;
        if(st.count(t)){
            if(jud){
                cout << "Opened by " << t << endl;
                jud = false;
            }
            else{
                cout << "Closed by " << t << endl;
                jud = true;
            }
        }

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

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

using namespace std;



int N, M;
string open="Opened by ", close="Closed by ", unk = "Unknown ";

int main() {
	cin >> N;
	
	set<string> users;
	for (int i=0; i<N; i++) {
		string user; cin >> user;
		users.insert(user);
	}
	
	cin >> M;
	bool opened = false;
	for (int i=0; i<M; i++) {
		string comes; cin >> comes;
		if (users.find(comes) != users.end()) {
			if (!opened) cout << open << comes << endl;
			else cout << close << comes << endl;
			opened = !opened;
		} else {
			cout << unk << comes << endl;
		}
	}
	
	return 0;
}

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

int main() {
	map<string, int> lst;
	int n, m; string s;
	bool isOpen = false;
	cin >> n;
	for(int i=0; i<n; ++i) {
		cin >> s;
		lst[s] = 1;
	}
	cin >> m;
	for(int i=0; i<m; ++i) {
		cin >> s;
		if(lst.count(s)==0) {
			cout << "Unknown " << s << endl;
		}else {
			isOpen = !isOpen;
			cout << (isOpen ? "Opened by " : "Closed by ") << s << endl;
		}
	}
	return 0;
}

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

int main(){

  string str[256], man;
  int n, m, judge;

  cin >> n;

  for(int i = 0; i < n; i++){
    cin >> str[i];
  }

  cin >> m;

  for(int i = 0; i < m; i++){
    cin >> man;
    for(int j = 0; j < n; j++){
      if(str[j] == man){
	if(judge == 0){
	  cout << "Opened by " << man << endl;
	  judge = 1;
	  break;
	}else {
	  cout << "Closed by " << man << endl;
	  judge = 0;
	  break;
	}
      }else if(j == n - 1) cout << "Unknown " << man << endl;
    }
  }

  return 0;
}