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 <algorithm>
#include <numeric>
#include <vector>
#include <cassert>
#include <string>
#include <memory.h>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <set>
#include <map>
#include <cctype>
#include <iomanip>
#include <sstream>
#include <cctype>
#include <fstream>
#include <cmath>
using namespace std;

#define REP2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define REP(i, n) REP2(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
#define ITER(c) __typeof((c).begin())
#define PB(e) push_back(e)
#define FOREACH(i, c) for(ITER(c) i = (c).begin(); i != (c).end(); ++i)
#define MP(a, b) make_pair(a, b)
#define PARITY(n) ((n) & 1)

typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1000 * 1000 * 1000 + 7;
const double EPS = 1e-10;

bool locked;
set<string> registered;

int main(){
  int n, m;
  string str;
  cin >> n;
  locked = true;
  for(int i = 0; i < n; i++){
    cin >> str;
    registered.insert(str);
  }
  cin  >> m;
  for(int j = 0; j < m; j++){
    cin >> str;
    if(registered.count(str) > 0){
      if(locked){
        locked = false;
        cout << "Opened by " << str << endl;
      }else{
        locked = true;
        cout << "Closed by " << str << endl;
      }
    }else{
      cout << "Unknown " << str << endl;
    }
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,count=0,b;
  string u[300],t[300];
  int a[300];
  cin >> n;
  for(int i=0; i<n; i++) cin >> u[i];
  cin >> m;
  for(int i=0; i<m; i++) cin >> t[i];
    
  b=0;
  for(int i=0; i<m; i++){
    for(int j=0; j<n; j++){
      if(t[i]==u[j]){
	    a[b] = 1;
	    break;
	  }
	  else a[b] = 0;
	}
	b++;
  }
  //for(int i=0; i<m; i++) cout << a[i] << " ";
  for(int i=0; i<m; i++){
    if(a[i]==1){
      if(count==0){
        cout << "Opend by " << t[i] << endl;
	    count = 1;
	    }
	    else if(count==1){
	    cout << "Closed by " << t[i] << endl;
	    count = 0;
	    }
	  }
    else cout << "Unknown " << t[i] << endl;
  }
  return 0;
}
//cout << "Opend by " << t[j] << endl;
//cout << "Closed by " << t[j] << endl;
//cout << "Unknown " << t[j] << endl;

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

using namespace std;

int main()
{
    int n, m;
    string u, t;
    map<string, bool> ic;
    bool open = true;

    cin >> n;
    while (n--) {
        cin >> u;
        ic[u] = true;
    }

    cin >> m;
    while (m--) {
        cin >> t;
        if (ic.count(t) == 0)
            cout << "Unknown " << t << endl;
        else {
            if (open) 
                cout << "Opened by " << t << endl;
            else
                cout << "Closed by " << t << endl;

            open = !open;
        }
    }

    return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
  string kagi[256];
  string pass[256];
  int n,i,N,a=0,I,b=0;
  cin>>n;
  for(i=0;i<n;i++){
    cin>>kagi[i];
  }
 
  cin>>N;
  for(i=0;i<N;i++){
    cin>>pass[i];
  }
    for(I=0;I<N;I++){
      for(i=0;i<n;i++){
	if(kagi[i]==pass[I]) {
	  a++;
	  break;
	}
	else b++;
      } 
      if(b==n) cout<<"Unknown"<<endl;
      else if(a%2==0) cout<<"Closed by"<<pass[I]<<endl;
      else if(a%2!=0) cout<<"Opened by"<<kagi[I]<<endl;
      b=0;
      
    }

  return 0;
}

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

using namespace std;

int n, m;
vector<string> ids;

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        ids.push_back(s);
    }

    cin >> m;
    bool locked = true;
    for (int i = 0; i < m; ++i) {
        string s;
        cin >> s;
        auto itr = find(ids.begin(), ids.end(), s);
        if (itr != ids.end()) {
            if (locked) cout << "Opened by " << s << endl;
            else cout << "Closed by " << s << endl;
            locked = !locked;
        } else {
            cout << "Unknown " << s << endl;
        }
    }
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
	int N,M;
	int frag = 0;
	string U[255];
	string T; 
	cin >> N;
	for(int i = 0;i<N;i++){
		cin >> U[i];
	}
	cin >> M;
	for(int j=0;j<M;j++){
		cin >>T;
		for(int i = 0;i<N;i++){
			if(T==U[i]){
				frag +=1;
				
				if(frag%2==0){
					cout << "Closed by "<< T << endl;
				}
				
				else{
					cout << "Opened by " << T <<endl;
				}
				
				break;
			}
			if(i==N-1){
				cout << "Unknown " << T << endl;
			}
		}
	}


	return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class T>
inline bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T>
inline bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N; cin >> N;
    map<string,bool> m;
    rep(i,N){
        string s; cin >> s;
        m[s]=true;
    }
    int M; cin >> M;
    int frag=1;
    rep(i,M){
        string s; cin >> s;
        if(m[s]) {
            if(frag) cout << "Opened by ";
            else cout << "Closed by ";
            frag=1-frag;
        }
        else {
            cout << "Unknown ";
        }
        cout << s << "\n";
    }

}

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

int main(){
  int n, m;
  std::cin >> n;
  set<string> u;
  for (int i = 0; i < n; i++) {
    string s;
    std::cin >> s;
    u.insert(s);
  }
  std::cin >> m;
  string t;
  bool lock = 1;
  for (int i = 0; i < m; i++) {
    std::cin >> t;
    if(u.find(t) != u.end()){
      if(lock == 1){
        std::cout << "Opened by " << t << std::endl;
      }else{
        std::cout << "Closed by " << t << std::endl;
      }
      lock = 1 - lock;
    }else{
      std::cout << "Unknown " << t << std::endl;
    }
  }
  return 0;
}

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

int main(){
	int n,m,flag=0,i,j;
	char s[256][16],t[16];
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%s",s[i]);
	scanf("%d",&m);
	for(i=0;i<m;i++){
		scanf("%s",t);
		for(j=0;j<n;j++){
			if(!strcmp(t,s[j])){
				if(!flag){
					printf("Opened by %s\n",t);
					flag=1;
					break;
				}else{
					printf("Closed by %s\n",t);
					flag=0;
					break;
				}
			}
		}
		if(j==n)printf("Unknown %s\n",t);
	}
	return 0;
}