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 <stdio.h>
int main(){

  int n,m,i,j,c=0;

  char a[300][12];
  char b[300][12];

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%s",a[i]);
  }


  scanf("%d",&m);

  for(j=1;j<=m;j++){
    scanf("%s",b[j]);
  }



  // for(i=1;i<=n;i++){
  // printf("%s\n",a[i]);
  //  }
  

  for(i=1;i<=m;i++){
    for(j=1;j<=n;j++){

      if(strcmp(a[j],b[i])==0){
	c++;
	break;
      }
    }
    if(strcmp(a[j],b[i])!=0){
      printf("Unknown %s\n",b[i]);
    }
    else{
      if(c%2!=0&&c!=0){
	printf("Opened by %s\n",a[j]);
      }
      if(c%2==0&&c!=0){
	printf("Closed by %s\n",a[j]);
      }
    }
  }





  return 0;
}

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

int main() {
    int N; cin >> N;
    vector<string> v;
    for(int i=0; i<N; ++i){
        string str; cin >> str;
        v.push_back(str);
    }
    int cnt=0, M;
    cin >> M;
    for(int i=0; i<M; ++i){
        bool flag = false;
        string str; cin >> str;
        for(int j=0; j<N; ++j){
            if(v[j]==str){
                if(cnt%2==0) cout << "Opened by " << str << endl;
                else cout << "Closed by " << str << endl; 
                flag = true;
                cnt++;
            }
            if(flag) break;
        if(j==N-1){
            cout << "Unknown " << str << endl;
        }
        }
        
               
    }
    return 0;
}

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

int main(void){
    int n; cin >> n;
    set<string> s;
    for(int i = 0; i < n; i++){
        string input; cin >> input;
        s.insert(input);
    }

    int m; cin >> m;
    int t = 0;
    for(int i = 0; i < m; i++){
        string input; cin >> input;
        if(s.find(input) != s.end()){
            if(t % 2 == 0) cout << "Opened by " << input << endl;
            else cout << "Closed by " << input << endl;
            t++;
        }else{
            cout << "Unknown " << input << 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;
    set<string> registered;
    for (int i=0;i<N;++i){
        string U; cin >> U;
        registered.insert(U);
    }
    int M; cin >> M;
    int now=0;
    for (int i=0;i<M;++i){
        string T; cin >> T;
        if (registered.count(T)){
            cout << (now?"Closed by ":"Opened by ") << T << endl;
            now^=1;
        } else cout << "Unknown " << T << endl;
    }
}

C++: #include <bits/stdc++.h>
#include <string>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
using namespace std;

int main() {
  int N, M, key = 0;
  string U[256], T;
  cin >> N;
  rep(i, N) cin >> U[i];
  cin >> M;
  rep(i, M) {
    cin >> T;
    rep(i, N) {
      if (U[i] == T && key == 0) {
        cout << "Opened by " << T << endl;
        key = 1;
        break;
      } else if (U[i] == T && key == 1) {
        cout << "Closed by " << T << endl;
        key = 0;
        break;
      } else if (U[i] != T) {
        cout << "Unknown " << T << endl;
        break;
      }
    }
  }
  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 << "Opend by " << T[i] << endl;
				}
				keyOpend = !keyOpend;
				break;
			}
			if(j==N-1) cout << "Unknown " << T[i] << endl;
		}
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    while(cin>>N) {
        set<string> S;
        for(int i=0;i<N;i++) {
            string U;
            cin>>U;
            S.insert(U);
        }
        bool close=1;
        int M;
        cin>>M;
        for(int i=0;i<M;i++) {
            string T;
            cin>>T;
            if(S.find(T)!=S.end()) {
                if(close) cout<<"Opened by "<<T<<endl;
                else cout<<"Closed by "<<T<<endl;
                close^=1;
            }else {
                cout<<"Unknown "<<T<<endl;
            }
        }
    }
}

C++: #include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
 
using namespace std;

int main()
{
    int n, m;
    string pass[256];
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> pass[i];
    }
    cin >> m;
    string input;
    bool isopen = false;
    for(int i = 0; i < m; i++){
        cin >> input;
        bool isfound = false;
        for(int j = 0; j < n; j++){
            if(pass[j] == input){
                isfound = true;
                break;
            }
        }
        if(isfound){
            if(!isopen) cout << "Opened by " << input << endl;
            else cout << "Closed by " << input << endl;
            isopen = !isopen;
        } else cout << "Unknown " << input << endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
    map<string, bool> doors;
    int n, m, i;
    cin >> n;
    string id;
    bool st = true;
    for (i=0;i<n;i++){
        cin >> id;
        doors[id]=true;
    }
    cin >> m;
    for (i=0;i<m;i++){
        cin >> id;
        if (doors.find(id)==doors.end()){
            cout << "Unknown " << id << endl;
        }else if(st){
            cout << "Opened by " << id << endl;
            st=false;
        }else{
            cout << "Closed by " << id << endl;
            st=true;
        }
    }
}

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

using namespace std;
#define loop(i,a,b) for(int i=(a); i<int(b); i++)
#define rep(i,b) loop(i,0,b)

int main(){
	int n;
	while(cin>>n){
		set<string> se;
		rep(i,n){
			string s;
			cin>> s;
			se.insert(s);
		}
		bool open = false;
		int m; cin >> m;
		rep(i,m){
			string s; cin >> s;
			if(se.count(s)==1){
				if(open) cout << "Closed by " << s << endl;
				else cout << "Opened by "<< s << endl;
				open^=1;
			}else{
				cout << "Unknown " << s << endl;
			}
		}
			
	}
}