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<set>

using namespace std;

int main() {
  int n;
  set<string> registered;
  cin>>n;
  for(int i=0; i<n; i++) {
    string str;
    cin>>str;
    registered.insert(str);
    //cout<<str<<endl;
  }
  string state = "closed";
  int m;
  cin>>m;
  for(int i=0; i<m; i++) {
    string str;
    cin>>str;
    set<string>::iterator itr;
    itr = registered.find(str);
    if(itr != registered.end()) {
      if(state == "closed") {
	cout<<"Opened by "<<str<<endl;;
	state = "opened";
      }
      else {
	cout<<"Closed by "<<str<<endl;
	state = "closed";
      }
    }
    else {
      cout<<"Unknown "<<str<<endl;
    }
  }
}

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <complex>
#include <fstream>
#include <stdio.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VEC;
typedef vector<VEC> MAT;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define T1 first
#define T2 second.first
#define T3 second.second


//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EPS 1e-8

set<string> sstr;

int main(){
	int n;
	cin>>n;
	REP(i,n){
		string tmp;
		cin>>tmp;
		sstr.insert(tmp);
	}
	cin>>n;
	int flag = 0;
	REP(i,n){
		string tmp;
		cin>>tmp;
		if(EXIST(sstr, tmp)){
			if(flag){
				cout << "Closed by " << tmp << endl;
			}else{
				cout << "Opened by " << tmp << endl;
			}
			flag = !flag;
		}else{
			cout << "Unknown " <<tmp << endl;
		}
	}
	return 0;
}

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

char id[260][20];

bool isin(int n, char s[20]){
    for(int i=0;i<n;++i){
        if(!strcmp(id[i], s)) return true;
    }
    return false;
}

int main(void){
    int n, m;
    bool isOpen = false;
    char user[20];
    cin >> n;
    for(int i=0;i<n;++i){
        cin >> id[i];
    }
    cin >> m;
    for(int i=0;i<m;++i){
        cin >> user;
        bool in = isin(n, user);
        if(in){
            if(isOpen){
                cout << "Closed by " << user << endl;
                isOpen = false;
            }else{
                cout << "Opened by " << user << endl;
                isOpen = true;
            }
        }else{
            cout << "Unknown " << user << endl;
        }
    }
}

C++: #include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <map>
using namespace std;

#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define REPI(i, s, e) for (int i = (s); i <= (e); i++)
#define rep(i, n) REP(i, 0, n)
#define repi(i, n) REPI(i, 0, n)
#define ALL(v) (v).begin(), (v).end()

#define dump(x) (cout << #x << " = " << x << endl)
#define dump2(x, y) (cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl)

typedef long long ll;
typedef pair<int, int> pii;

#define MAX 257

int main(void)
{
	int n;
	cin >> n;
	vector<string> us = vector<string>(n);
	rep(i, n) cin >> us[i];

	int m;
	cin >> m;
	vector<string> ts = vector<string>(m);
	rep(i, m) cin >> ts[i];

	bool closed = true;
	rep(i, ts.size()) {
		bool f = true;
		rep(j, us.size())
			if (ts[i] == us[j]) {
				printf("%s by %s\n", (closed?"Opened":"Closed"), us[j].c_str());
				closed = !closed;
				f = false;
				break;
			}
		if (f)
			printf("Unknown %s\n", ts[i].c_str());
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

vector<string> nlist;
bool isinclude(string tmp){
  REP(i,nlist.size()){
    if(nlist[i]==tmp) return true;
  }
  return false;
}

int main(){
  int n;
  cin >> n;
  REP(i,n){
    string tmp;
    cin >> tmp;
    nlist.pb(tmp);
  }
  int nows = 0;
  cin >> n;
  REP(i,n){
    string tmp;
    cin >> tmp;
    if(find()){
      if(nows == 1){
        cout << "Closed by " << tmp << endl;
      }else{
        cout << "Opened by " << tmp << endl;
      }
      nows = 1 - nows;
    }else{
      cout << "Unknown " << tmp << endl; 
    }
  }
  return 0;
}

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

using namespace std;

int main()
{
  int n, m;
  string key;
  vector<string> vec_keys;
  bool isOpend = true;
  
  cin >> n;
  cin.ignore();
  while (n--) {
    cin >> key;
    cin.ignore();
    vec_keys.push_back(key);
  }

  cin >> m;
  cin.ignore();
  while (m--) {
    cin >> key;
    cin.ignore();
    auto itr = find(vec_keys.begin(), vec_keys.end(), key);
    if (itr != vec_keys.end()) {
      isOpend ? cout << "Opened by " << key << endl :
        cout << "Closed by " << key << endl;
      isOpend ^= 0x01;
    } else {
      cout << "Unknown " << key << endl;
    }
  }
}

C++: /*
	2440:Kagisys
*/
#include	<iostream>
#include	<string>

using namespace std;

int main(void) {
	int N, M;
	string IDs[256];
	bool oc = false;
	
	cin >> N;
	for(int i = 0; i < N; i++) {
		string buff;
		
		cin >> buff;
		IDs[i] = buff;
	}
	cin >> M;
	for(int i = 0; i < M; i++) {
		string buff;
		bool isHit = false;
		
		cin >> buff;
		for(int j = 0; j < N; j++) {
			if(IDs[j] == buff) {
				isHit = true;
				break;
			}
		}
		if(isHit == true) {
			if(oc == false) {
				cout << "Opened by " << buff << endl;
				oc = true;
			} else {
				cout << "Closed by " << buff << endl;
				oc = false;
			}
		} else {
			cout << "Unknown " << buff << endl;
		}
	}
	return 0;
}