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>
#include <iostream>
#include <string>
#include <set>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    set<string> us;
    int n;
    cin >> n;
    rep (i, n) {
        string s;
        cin >> s;
        us.insert(s);
    }
    int m;
    cin >> m;
    bool f = false;
    rep (i, m) {
        string s;
        cin >> s;
        if (us.count(s)) {
            cout << (f ? "Closed" : "Opened") << " by " << s << endl;
            f = !f;
        }
        else {
            cout << "Unknown " << s << endl;
        }
    }
    return 0;
}

C++: 
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int n;
  cin>>n;
  vector<string>ch(n);
  for(int i=0;i<n;i++)
    cin>>ch[i];
  bool flag=false;
  int m;cin>>m;
  for(int i=0;i<m;i++){
    string str;cin>>str;
    int j;
    for(j=0;j<m;j++){
      if(ch[j]==str){
	if(flag){
	  cout<<"Closed by "<<str<<endl;
	  flag=false;
	  break;
	}else{
	  cout<<"Opened by "<<str<<endl;
	  flag=true;
	  break;
	}
      }
    }
    if(j==m)
      cout<<"Unknown "<<str<<endl;
  }
  return 0;
}

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

int main(){
	int n,m;
	vector<string> u;
	cin >> n;
	for(int i=0;i<n;i++){
		string U;
		cin >> U;
		u.push_back(U);
	}
	cin >> m;
	int ans=0;
	for(int i=0;i<m;i++){
		string T;
		cin >> T;
		int judge=0;
		for(int j=0;j<u.size();j++){
			if(T==u[j]){
				ans++;
				judge++;
			}
		}
		if(judge==0) cout << "Unknown " << T << endl;
		if(ans%2==1) cout << "Opened by " << T << endl;
		if(ans%2==0&&judge!=0) cout << "Closed by " << T << endl;
	}

}

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(count % 2 != 0) cout<<"Open by"<<" "<<s[i]<<endl;
    else cout<<"Closed by"<<" "<<s[i]<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <set>
using namespace std;
int main(void){
	int n,m;
	cin>>n;
	set<string> uids;
	for(int i=0;i<n;++i){
		string s;
		cin>>s;
		uids.insert(s);
	}
	bool locked=true;
	cin>>m;
	for(int i=0;i<m;++i){
		string s;
		cin>>s;
		if(uids.find(s)!=uids.end()){
			cout<<((locked)?"Opened by ":"Closed by ")<<s<<endl;
			locked=!locked;
		}
		else cout<<"Unknown "<<s<<endl;
	}
	
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main(){

  int n,m,count=0;
  char u[257][11],t[257][11];
  
  cin>>n;
  for(int i=0;i<n;i++)
    scanf("%s",u[i]);

  cin>>m;
  for(int i=0;i<m;i++)
    scanf("%s",t[i]);

  for(int i=0;i<m;i++)
    for(int j=0;j<n;j++)
      if(strcmp(t[i],u[j])==0){
	count++;
	if(count%2==1)
	  cout<<"Opened by "<<t[i]<<endl;
	else
	  cout<<"Closed by "<<t[i]<<endl;
	break;
      }
      else if(j==n-1)
	  cout<<"Unknown "<<t[i]<<endl;
  return 0;
}

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

int main()
{
    int n, m;
    string cipher[256], t;
    bool b = 0;

    cin >> n;

    for( int i = 0; i < n; i++ )
        cin >> cipher[i];

    cin >> m;

    for( int i = 0; i < m; i++ )
    {
        cin >> t;
        bool judge = false;
        for( int j = 0; j < n; j++ )
            if( t == cipher[j] )
            {
                if( b == 0 )
                    cout << "Opened by " << t << endl;
                else
                    cout << "Closed by " << t << endl;
                b = !b;
                judge = true;
            }
        if( !judge )
            cout << "Unknown " << t << endl;
    }
    
    return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#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("Closed by %s\n", U[j]);
		else if (flag == 1)
			printf("Opened by %s\n", U[j]);
		else
			printf("Unknown %s\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 <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FOREQ(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPEQ(i, n) FOREQ(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
#define LET(name, value) __typeof(value) name = (value)

template <typename T> inline int size(const T& x) { return x.size(); }
template <typename T1, typename T2> inline void
updateMax(T1& x, const T2& y) { if (y < x) { x = y; } }
template <typename T1, typename T2> inline void
updateMin(T1& x, const T2& y) { if (x < y) { x = y; } }
template <typename T1, typename T2, typename K1, typename K2> inline void
updateMax(T1& x, K1& i, const T2& y, const K2& j) { if (y < x) { x = y; i = j; } }
template <typename T1, typename T2, typename K1, typename K2> inline void
updateMin(T1& x, K1& i, const T2& y, const K2& j) { if (x < y) { x = y; i = j; } }

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

  int N;
  while (cin >> N) {
    vector<string> ids(N);
    REP(i, N) cin >> ids[i];
    sort(ALL(ids));

    int M; cin >> M;
    bool open = false;
    REP(i, M) {
      string id; cin >> id;
      LET(p, equal_range(ALL(ids), id));
      if (p.first != p.second) {
        open = !open;
        if (open) cout << "Opened by " << id << endl;
        else cout << "Closed by " << id << endl;
      } else {
        cout << "Unknown " << id << endl;
      }
    }
  }
}

C++: #include<iostream>
#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,m;
	cin>>n;
	string s[n],tmp;
	bool check=false;
	rep(i,n){
		cin>>s[i];
	}
	cin>>m;
	rep(i,m){
		cin>>tmp;
		bool uk=true;
		rep(j,n){
			if(tmp==s[j]){
				cout<<((check)?"Closed":"Opened")<<" by "<<s[j]<<endl;
				uk=false;
				check=!check;
				break;
			}
		}
		if(uk)cout<<"Unknown "<<tmp<<endl;
	}
	return 0;
}