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;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

int main(void){
    int n; cin>>n;
    vs def(n);
    rep(i,n)cin>>def[i];
    int m; cin>>m;
    bool isOpen=false;
    rep(i,m){
        string s;
        cin>>s;
        if(find(all(def),s)!=def.end()){
            isOpen^=true;
            cout<<(isOpen?"Opened by ":"Closed by ")<<s<<endl;
        }else{
            cout<<"Unknown "<<s<<endl;
        }
    }
}

C++: #include <iostream>
#include <string>
using namespace std;
 
int main(){
  int n;
  cin >> n;
   
  string u[257];
  for(int i=0;i<n;i++)cin >> u[i];
 
  int m;
  cin >> m;
   
  string t;
  int sta = 1;
  for(int i=0;i<m;i++){
    cin >> t;
     
    int flg = 0;
    for(int i=0;i<n;i++){
      if(t == u[i]) {
    flg = 1;
    sta++;
    break;
      }
    }
 
    if(flg == 1){
      if(sta%2 == 1) cout << "Closed by ";
      else cout << "Opened by ";
      cout << t << endl;
    }
    else cout << "Unknown "<<t<<endl;
     
  }
  return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <sstream>
#include <numeric>
#include <set>
#include <map>
//#include <bits/stdc++.h>

#define rep(i, j) for(int i = 0; i < j; i++)
#define all(i) i.begin(), i.end()
#define ll long long
#define bl bool
#define nn printf("\n");
#define mod 1000000007

using namespace std;

struct inout { int cri; string name; };
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N; cin >> N;
	vector<inout> dat(N + 2);
	rep(i, N) 
	{
		cin >> dat[i].name; 
		dat[i].cri = 0;
	}
	int M; cin >> M;
	rep(i, M)
	{
		string tar; cin >> tar;
		int k = 0;
		rep(j, N)
		{
			if (dat[j].name == tar)
			{
				if(dat[j].cri == 0)
				{
					cout << "Opened by " << dat[j].name << "\n";
					dat[j].cri = 1;
					break;
				}
				else
				{
					cout << "Closed by " << dat[j].name << "\n";
					dat[j].cri = 0;
					break;
				}
			}
			k++;
			if (k > N - 1) { cout << "Unknown " << tar << "\n"; }
		}
	}

	return 0;
}

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


int main(){
  vector<string> mem;
  string s;
  int n;
  bool flag=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>s;
    mem.push_back(s);
  }
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>s;
    for(int j=0;j<mem.size();j++){
      if(mem[j]==s){
	if(flag==0) cout<<"Opened by "<<s<<endl;
	else cout<<"Closed by "<<s<<endl;
	flag=~flag;
	break;
      }
      if(j==mem.size()-1)cout<<"Unknown "<<s<<endl;
    }
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
#define pb(a) push_back(a)
#define pr(a) cout<<(a)<<endl
#define PR(a,b) cout<<(a)<<" "<<(b)<<endl
#define F first
#define S second
#define ll long long
bool check(int n,int m,int x,int y){return (x<0||x>=n||y<0||y>=m)?false:true;}
const ll MAX=1000000007,MAXL=1LL<<60,dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
typedef pair<int,int> P;

int main() {
  int n,m;
  cin >> n;
  string t;
  set<string> s;
  rep(i,n) {
    cin >> t;
    s.insert(t);
  }
  cin >> m;
  bool c=true;
  rep(i,m) {
    cin >> t;
    if(s.count(t)) {
      if(c) pr("Opened by "+t);
      else pr("Closed by "+t);;
      c=!c;
    }
    else pr("Unknown "+t);
  }
  return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<utility>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
 
using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+9
#define EPS 1e-9
#define rep(i,j) for(int i = 0; i < (j); i++)
#define reps(i,j,k) for(int i = j; i < (k); i++)
typedef long long ll;
int main(){
    int n;
    vector<string> ok;
    scanf("%d",&n);
    rep(i,n){
        string str;
        cin >> str;
        ok.push_back(str);
    }
    int m;
    bool f = false;
    scanf("%d",&m);
    rep(i,m){
        bool c = false;
        string str;
        cin >> str;
        rep(j,n){
            if(ok[j] == str){
                (f) ? f = false : f = true;
                c = true;
                (f) ? printf("Opened by ") : printf("Closed by");
                cout << str << endl;
            }
        }
        if(!c)printf("Unknown ");
        cout << str << endl;
    }
    return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

typedef pair<string, int> pp;

int main()
{
	int n, m;
	string s;
	map<string, int> l;
	cin >> n;
	REP(n){ cin >> s ; l.insert(pp(s, 1));}
	cin >> m;
	REP(m)
	{
		cin >> s;
		if(l.find(s) != l.end())
			cout <<"Opened by " << s << endl; 
		else
			cout << "Unknown " << s << endl;
	
	}

	return 0;
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#pragma warning(disable:4996)
using namespace std;

const int My_Inf=2147483647;
const long long int My_LInf=9223372036854775807;

int main() {
	int n; cin >> n;
	set<string>sts;
	for (int i = 0; i < n; ++i) {
		string st; cin >> st;
		sts.emplace(st);
	}
	int m; cin >> m;
	bool close = true;
	for (int i = 0; i < m; ++i) {
		string st; cin >> st;
		if (sts.find(st) != sts.end()) {
			if (close) {
				cout << "Opened by " << st << endl;
			}
			else {
				cout << "Closed by " << st << endl;
			}
			close = !close;
		}
		else {
			cout << "Unknown " << st << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<map>
using namespace std;
int N,M;
bool flg;
map<string,bool> used;
int main(){
  cin>>N;
  for(int i=0;i<N;i++){
    string str;
    cin>>str;
    used[str]=true;
  }
  cin>>M;
  for(int i=0;i<M;i++){
    string str;
    cin>>str;
    if(used[str]){
      flg^=true;
      if(flg)cout<<"Opened by ";
      else cout<<"Closed by ";
    }else{
      cout<<"Unknown ";
    }
    cout<<str<<endl;
  }
  return 0;
}

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

using namespace std;


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