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>
using namespace std;

int main(){
    int n;
    string str;
    vector<string> v;
    
    cin >> n;
    for(int i = 0 ; i < n ; i++){
        cin >> str;
        v.push_back(str);
    }
    cin >> n;
    int st = 0; //0 Closed , 1 Opened
    for(int i = 0 ; i < n ; i++){
        int flg = 0;
        cin >> str;
        for(int j = 0 ; j < v.size() ; j++){
            if(str == v[j]){
                if(!st){
                    cout << "Opened by " << str << endl;
                    st = 1;
                }
                else{
                    cout << "Closed by " << str << endl;
                    st = 0;
                }
                flg = 1;
                break;
            }
        }
        if(!flg) cout << "UnKnown " << str << endl;
    }
    
    return 0;
}

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

int main(void) {

    int N; cin >> N;
    set<string> U;
    for (int i = 0; i < N; i++) {
        string s; cin >> s;
        U.insert(s);
    }

    int M; cin >> M;
    bool islocked = true;
    for (int i = 0; i < M; i++) {
        string T; cin >> T;

        if (U.find(T) != U.end()) {
            if (islocked) {
                cout << "Opened by " << T << endl;
            } else {
                cout << "Closed by " << T << endl;
            }
            islocked = !islocked;
        } else {
            cout << "Unknown " << T << endl;
        }
    }
    return 0;
}

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

using namespace std;

int main() {
    int N, M;
    string s;

    cin >> N;

    set<string> U;

    for (int i = 0; i < N; i++) {
        cin >> s;
        U.insert(s);
    }

    cin >> M;

    bool lock = true;

    for (int i = 0; i < M; i++) {
        cin >> s;
        if (U.find(s) == U.end()) {
            cout << "Unknown " << s << endl;
        } else if (lock) {
            cout << "Opened by " << s << endl;
            lock = false;
        } else {
            cout << "Closed by " << s << endl;
            lock = true;
        }
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
using namespace std;
 
int main() {
    vector<string> a;
    string b;
    int n,m;
    cin >> n;
    for(int i = 0;i < n;i++){
        cin >> b;
        a.push_back(b);
    }
    cin >> m;
    int flag;
    int tobira = 0;
    for(int i = 0;i < m;i++){
        flag = 0;
        cin >> b;
        for(int j = 0;j < a.size();j++){
            if(b == a[j]){
                flag = 1;
                break;
            }
        }
        if(flag == 1){
            if(tobira == 0){
                cout << "Opened by " << b <<endl;
                tobira = 1;
            }
            else if(tobira == 1){
                cout << "Closed by " << b <<endl;
                tobira = 0;
            }
        }
        else if(flag == 0){
            cout << "Unknown " << b << endl;
        }
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <stack>

using namespace std;

#define Getsign(n) ((n > 0) - (n < 0))
#define QWERTYR(c) (c == 'y' || c == 'u' || (c >= 'h' && c <= 'p') ?	true : false)
typedef vector<int> Ivec;
typedef pair<int, int> pii; // (cst, to)

int main() {
	int n, m;
	map<string, bool> IDs;
	scanf("%d", &n);
	for (int i = 0; n > i; i++) {
		char str[11];
		scanf("%s", str);
		IDs[string(str)] = true;
	}
	scanf("%d", &m);
	bool state = false;
	for (int i = 0; m > i; i++) {
		char str[11];
		scanf("%s", str);
		if (IDs[string(str)]) {
			state = 1 - state;
			printf("%sed by %s\n", state ? "Open" : "Clos", str);
		}
		else {
			printf("Unknown %s\n", str);
		}
	}

	return 0;
}

C++: #include<iostream>
#include<map>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int n;
	cin>>n;
	map<string,bool> dt;
	string s;
	rep(i,n){
		cin>>s;
		dt[s]=true;
	}
	cin>>n;
	bool door=false;
	rep(i,n){
		cin>>s;
		if(dt[s]){
			if(door){
				cout<<"Closed by "<<s<<endl;
			}else{
				cout<<"Opened by "<<s<<endl;
			}
			door=!door;
		}else cout<<"Unknown "<<s<<endl;
	}
	return 0;
}

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

int main(){
	int n,m;
	cin>>n;
	
	vector<string>v;
	for(int i=0;i<n;i++){
		string s;
		cin>>s;
		v.push_back(s);
		}
		
		cin>>m;
		int flg=0;
		for(int j=0;j<m;j++){
			string s;
			cin>>s;
			int match=0;
			for(int i=0;i<n;i++){
				if(s==v[i]){
					match=1;
					break;
					}
				}
				
			if(match==0)cout<<"Unknown "<<s<<endl;
			else{
				if(flg==0){
					cout<<"Opened by "<<s<<endl;
					flg=1;
					}
				else{
					cout<<"Closed by"<<s<<endl;
					flg=0;
					}	
				}	
			}
			return 0;
	}

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

using namespace std;

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

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

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

C++: #include <stdio.h>
   #include <string.h>

int main() {
   char T[256][11],U[256][11];
   int n,N,i,j,close=1,flag;
   
   scanf("%d",&n);
   for(i=0;i<n;i++){
       scanf("%s",T[i]);
   }
   
   scanf("%d",&N);
   for(i=0;i<N;i++){
       scanf("%s",U[i]);
   }
   for(j=0;j<N;j++){
       flag=0;
   for(i=0;i<n;i++){
       if(strcmp(T[i],U[j])==0){
           close=(close==1)?0:1;
           flag=1;
       }    
   }
   if(close==1 &&flag==1)
       printf("%s Closed\n",U[j]);
   else if(flag==1)
       printf("%s Opened\n",U[j]);
   else
       printf("%s is Unknown\n",U[j]);
   }

   return 0;
}
/*
<input example>
3 //register three ID
Ant
Antonio
Android
4 //Check four ID
Android
Anko
Antonio
Alex
<output>//At first door is closed.
Android Opened
Anko is Unknown
Antonio Closed
Alex is Unknown
*/

C++: #include<iostream>
#include<map>
#include<string>
using namespace std;int f,n;main(){string u;map<string,int>s;for(cin>>n;n--;s[u]=1)cin>>u;for(cin>>n;cin>>u;)cout<<(s[u]?++f&1?"Opened by ":"Closed by ":"Unknown ")<<u<<'\n';}