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 <string>
using namespace std;
int main(){
	int N,M;
	int frag = 0;
	string U[256];
	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 <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 <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <set>

#define rep2(i, b, n) for(int i=b; i < n; ++i)
#define repm(i, b, n) for(int i=b; i > n; --i)
#define rep(i, n) rep2(i, 0, n)

using namespace std;

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

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

#define int long long
#define DEBUG(x) cerr <<#x<<":"<<x<<endl;
#define DEBUG2(x, y) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<endl;
#define DEBUG3(x, y, z) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl;
#define DEBUGVC(x) cerr <<#x<<": "; for(auto a:x) cerr << a <<" "; cerr << endl;
#define DEBUGMP(x) cerr <<#x<<":"<<endl; for(auto a:x) cerr << a.first <<" "<< a.second << endl;
#define MAX_N (1000006)
#define INF (1LL << 60)
const int MOD = (int)1e9+7;


signed main() {
    //while(1) {
        int n;
        cin >> n;
        vector<string> u(n);
        for(int i=0; i<n; i++) cin >> u[i];
        int m;
        cin >> m;
        vector<string> t(m);
        for(int i=0; i<m; i++) cin >> t[i];

        bool isOpen = false;
        for(int i=0; i<m; i++) {
            bool isUnknown = true;
            for(int j=0; j<n; j++) {
                if(t[i]==u[j]){
                    isUnknown = false;
                    if(isOpen){
                        cout << "Closed by " << t[i] << endl;
                        isOpen = false;
                        break;
                    } else {
                        cout << "Opened by " << t[i] << endl;
                        isOpen = true;
                        break;
                    }
                }
            }
            if(isUnknown) {
                cout << "Unknown " << t[i] << endl;
            }
        }
    //}
}

C++: #include <iostream>
#include <vector>
#include <string>
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;
  cin >> m;
  string t;
  bool flag = false;
  for(int i=0; i<m; i++){
    cin >> t;
    bool known = false;
    for(int j=0; j<n; j++){
      if(t == u[j]){
        if(flag){
          cout << "Closed by " << t << endl;;
        }else{
          cout << "Opened by " << t << endl;
        }
        known = true;
        flag = !flag;
        break;
      }
    }
    if(!known)
      cout << "Unknown " << t << endl;
  }
  
  return 0;
}

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

int main() {
	map<string,bool> IDlist;
	int n;
	cin >> n;
	string str;
	for (int i = 0; i < n; ++i) {
		cin >> str;
		IDlist.insert(make_pair(str, false));
	}
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> str;
		auto itr = IDlist.find(str);
		if (itr != IDlist.end()) {
			if (IDlist[str] == false) {
				cout << "Opened by " << str << endl;
				IDlist[str] = true;
			}
			else {
				cout << "Closed by " << str << endl;
				IDlist[str] = false;
			}
		}
		else {
			cout << "Unknown " << str << endl;
		}
	}
	return 0;
}

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

  int n,m,lock=1;
  string namelist[256];
  string in;
  bool check;
  
  cin >>n;
  
  for(int i=0 ; i < n ; i++)cin >>namelist[i];

  cin >>m;
  
  for(int i=0 ; i < m ; i++){
    cin >>in;
    check=true;
    for(int j=0 ; j < n ;j++){
      if(namelist[j]==in){
	if(lock){
	  cout <<"Opened by ";
	  lock=0;
	}else{
	  cout <<"Closed by ";
	  lock=1;
	}
	cout <<in<<endl;
	check=false;
	break;
      }
    }
    if(check){
      cout <<"Unknown "<<in<<endl;
    }
  }		   
  
  return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int n,m,f;
string u[333];
int main(void){
  cin >> n;
  for(int i = 0; i < n; i++) cin >> u[i];
  cin >> m;
  for(int i = 0; i < m; i++){
    string k;
    cin >> k;
    int j;
    for(j = 0; j < n; j++) if(k == u[j]) break;
    if(n-j){
      cout <<(f?"Closed":"Opened") << " by " << k << endl;
      f^=1;
    }else{
      cout << "Unknown " << k << endl;
    }
  }
}

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
typedef long long ll;
typedef pair<int,int> P;

template<typename A,typename B> inline void chmin(A &a,B b){if(a>b) a=b;}
template<typename A,typename B> inline void chmax(A &a,B b){if(a<b) a=b;}
//-----------------------------------------------------------------------

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n; cin>>n;
    vector<string> vs(n);
    REP(i,n){
        string s; cin>>s;
        vs.pb(s);
    }
    sort(ALL(vs));

    int m; cin>>m;
    bool f=false;
    REP(i,m){
        string s; cin>>s;
        if(!binary_search(ALL(vs),s)){
            cout<<"Unknown "<<s<<endl;
        } else{
            f=!f;
            if(f) cout<<"Opened by "<<s<<endl;
            else cout<<"Closed by "<<s<<endl;
        }
    }

}