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

int N, M;
vector<string> id;
bool locked = true;

bool search(string tmp){
  for(int i = 0; i < id.size(); i++){
    if(id[i] == tmp) return true;
  }
  return false;
}

int main(void){
  string tmp;
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> tmp;
    id.push_back(tmp);
  }
  cin >> M;
  for(int i = 0; i < M; i++){
    cin >> tmp;
    if(search(tmp)){
      if(locked){
        cout << "Opened by " << tmp << endl;
        locked = false;
      }else{
        cout << "Closed by " << tmp << endl;
        locked = true;
      }
    }else{
      cout << "Unknown " << tmp << endl;
    }
  }
  return 0;
}

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

using namespace std;

int main()
{
    int n, m;
    char str[128];
    set<string> s;
    
    scanf("%d", &n);
    
    for (int i = 0; i < n; i++){
        scanf("%s", str);
        s.insert((string)str);
    }
    
    int stat = 0;
    
    scanf("%d", &m);
    
    for (int i = 0; i < m; i++){
        scanf("%s", str);
        if (s.find((string)str) == s.end()){
            printf("Unknown %s\n", str);
        }
        else {
            printf("%s by %s\n", stat ? "Closed" : "Opened", str);
            stat ^= 1;
        }
    }
    
    return (0);
}

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 << "Opend by " << T <<endl;
				}
				
				break;
			}
			if(i==N-1){
				cout << "Unknown " << T << endl;
			}
		}
	}


	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int n;
  string s;
  set<string> keys;
  cin>>n;
  rep(i,n){
    cin>>s;
    keys.insert(s);
  }
  cin>>n;
  bool now = true;
  rep(i,n){
    cin>>s;
    //    cout<<keys.find(s)<<endl;
    if(keys.find(s)!=keys.end()){
      if(now){
	cout<<"Opened by ";
      }else{
	cout<<"Closed by ";
      }
      now = !now;
    }else{
      cout<<"Unknown  ";
    }
    cout<<s<<endl;
  }


}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)

typedef set<string> ss;

int main()
{
	int N; cin >> N;
	ss U;
	rep(i, 0, N)
	{
		string s; cin >> s; U.insert(s);
	}

	int M; cin >> M;
	int f = 0;
	rep(i, 0, M)
	{
		string s; cin >> s;
		if (U.find(s) == U.end())
		{
			cout << "Unknown " + s << endl;
			continue;
		}

		if (f == 0)
			cout << "Opened by " + s << endl;
		else
			cout << "Closed by " + s << endl;

		f = (f + 1) % 2;
	}
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

const string meg[3] = {"Opened by", "Closed by", "Unknown" };

int main()
{
	set<string> id; id.clear();
	ios_base::sync_with_stdio(0);
	int N; cin >> N;
	rep (i, N ){
		string s; cin >> s;
		id.insert (s );
	} // end rep
	bool state = false;	// close state
	int M; cin >> M;
	rep (j, M ){
		string t; cin >> t;
		if (!id.count (t ) ){
			cout << meg[2] << ' ' << t << endl;
		}else{
			cout << meg[state] << ' ' << t << endl;
			state =!state;
		} // end if
	} // end rep
	
	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;}
 
int main(){

  int n,m;
  bool open=true;

  cin >> n;
  string tou[500];
  REP(i,n){
	cin >> tou[i];
  }
  cin >> m;
  string kita;
  REP(i,m){
	cin >> kita;
	REP(j,n){
	  if(kita == tou[j]){
		if(open){
		  cout<<"Opened by "<<kita<<endl;
		  open = (not open);
		  break;
		}else{
		  cout<<"Closed by "<<kita<<endl;
		  open = (not open);
		  break;
		}
	  }
	  if(j==n-1)  cout<<"Unknown "<<kita<<endl;
	}
  }
}

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

int main(){

  string str[256], man;
  int n, m, judge;

  cin >> n;

  for(int i = 0; i < n; i++){
    cin >> str[i];
  }

  cin >> m;

  for(int i = 0; i < m; i++){
    cin >> man;
    for(int j = 0; j < n; j++){
      if(str[j] == man){
	if(judge == 0){
	  cout << "Opened by " << man << endl;
	  judge = 1;
	  break;
	}else {
	  cout << "Closed by " << man << endl;
	  judge = 0;
	  break;
	}
      }else if(j == n - 1) cout << "Unknown add " << man << endl;
    }
  }

  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 "<<pass[I]<<endl;
    else if(a%2==0) cout<<"Closed by "<<pass[I]<<endl;
    else if(a%2!=0) cout<<"Opened by "<<pass[I]<<endl;
    b=0;
      
  }

  return 0;
}