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<vector>
#include<stdio.h>
#include<algorithm>
using namespace std;

vector<string> U(260); 
vector<string> T(260); 
int n,m;
int key=0;

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];
  }
  
  sort(U.begin(),U.end());

  for(int i=0;i<n;i++){
    
    if(*lower_bound(U.begin(),U.end(),T[i])==T[i]){
      if(key==0){ key=1; cout<<"Opened by "<<T[i]<<endl;}
      else {key=0; cout<<"Closed by "<<T[i]<<endl;}
    }
    
    else{cout<<"Unknown "<<T[i]<<endl;}
  }

  return 0;}

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

using namespace std;

int main(){
	int N,M;
	scanf("%d",&N);
	int flag=0,oc=0,i,j;
	char U[256][11];
	for(i=0;i<N;i++){
		scanf("%s",U[i]);
	}
	scanf("%d",&M);
	char T[11];
	for(i=0;i<M;i++){
		flag=0;
		scanf("%s",T);
		for(j=0;j<N;j++){
			if(strcmp(U[j],T)==0){
				flag=1;
				break;
			}
		}
		if(flag==0){
			cout<<"Unknown "<<T<<endl;
		}else if(oc==0){
			cout<<"Opened by "<<T<<endl;
			oc=1;
		}else{
			cout<<"Closed by "<<T<<endl;
			oc=0;
		}
	}


	return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
using namespace std;
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.begin(), l.end(), s) != l.end()) {
			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 <string>
using namespace std;

int n;
string u[256];
int m;
string t;

int main() {
	int i, j;
	
	cin >> n;
	for (i = 0; i < n; i++) cin >> u[i];
	cin >> m;
	
	bool isOpen = false;
	for (i = 0; i < m; i++) {
		cin >> t;
		for (j = 0; j < n; j++) {
			if (t == u[j]) {
				break;
			}
		}
		if (j < n) {
			isOpen = !isOpen;
			if (isOpen) { cout << "Opened by " << t << endl; }
			else { cout << "Closed by " << t << endl; }
		}
		else {
			cout << "Unknown " << t << endl;
		}
	}
	
	return 0;
}

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

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

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

int main(){
  int N;
  while(cin>>N){
    map<string, int> memo;
    REP(i, N){
      string s; cin>>s;
      memo[s] = 0;
    }
    int M;
    cin>>M;
    bool open = false;
    REP(i, M){
      string s;
      cin>>s;
      if(memo.count(s)){
        if(open){
          cout<<"Closed by "<<s<<endl;
          open = false;
        }else{
          cout<<"Opened by "<<s<<endl;
          open = true;
        }
      }else{
        cout<<"Unknown "<<s<<endl;
      }
    }
  }
  return 0;
}

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

int main(){
    int n,m; cin>>n;
    vector<string> id(n);
    for(int i=0; i<n; i++)cin>>id[i];

    cin>>m;
    vector<string> have(m);
    for(int i=0; i<m; i++)cin>>have[i];

    bool flag = false,search;

    for(int i=0; i<m; i++){
        search = false;
        for(int j=0; j<n; j++){
            if(have[i] == id[j]) search = true;
        }
        if(search && flag){
            cout<<"Closed "<<"by "<<have[i]<<endl;
            flag = false;
        }

        else if(search && !flag){
            cout<<"Opened "<<"by "<<have[i]<<endl;
            flag = true;
        }

        else cout<<"Unknown "<<have[i]<<endl;
    }

    return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int n;
    cin >> n;
    string keys[n];
    for (int i = 0; i < n; ++i) {
        cin >> keys[i];
    }
    int m;
    cin >> m;
    bool isOpen = false;
    for (int i = 0; i < m; ++i) {
        string key;
        cin >> key;
        string result = "Unknown ";
        for (int j = 0; j < n; ++j) {
            if (keys[j] == key) {
                result = isOpen ? "Closed by " : "Opened by ";
                isOpen = !isOpen;
            }
        }
        cout << result << key << endl;
    }
}

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

#define rep(i,x) for(int i=0;i<x;i++)	
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rep_to(a,i,x) for(int i=a;i<x;i++)

using namespace std;

int main()
{
	int n;
	map<string,int>F1;
	cin >> n;
	while(n--)
	{
		string s;
		cin >> s;
		F1[s]=1;
	}

	int m,ct=0;
	cin >> m;
	while(m--)
	{
		string s;
		cin >>s;
		if(F1[s])
		{
			ct++;
			if(ct%2)cout << "Opened by " << s << endl;
			else cout << "Closed by " << s << endl;
		}
		else 
			cout << "Unknown " << s << endl;
	}
	return 0;
}

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

int main()
{
	int N, M, oc = 1;
	string us;
	cin >> N;
	vector<string> users(N,"");
	for (int i = 0; i < N; i++) {
		cin >> users[i];
	}
	cin >> M;
	for (int i = 0;i < M;i++) {
		cin >> us;
		if (find(users.begin(), users.end(), us) != users.end()) {
			if (oc) {
				cout << "Opened by " << us << endl;
				oc = 0;
			} else {
				cout << "Closed by " << us << endl;
				oc = 1;
			}
		} else {
			cout << "Unknown " << us << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;

int main()
{
	int N,M;
	char U[256][11];
	char T[11];
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> U[i];
	}
	cin >> M;
	int cnt = 0;
	for (int i = 0; i < M; i++)
	{
		bool find = false;
		cin >> T;

		for (int j = 0; j < N; j++)
		{
			int c = strcmp(U[j], T);
			if (c == 0)
			{
				find = true;
				cnt++;
				break;
			}
		}

		if (find)
		{
			if (cnt % 2== 1)
			{
				cout << "Opened by "<< T << endl;
			}
			else
			{
				cout << "Closed by " << T << endl;
			}
		}
		else
		{
			cout << "Unknown " << T << endl;
		}
	}
	return 0;
}