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>
#include <vector>
#include <algorithm>
#include <map>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
    int n;
    cin >> n;

    map<string,bool> ma;
    rep(i,n) {
        string s;
        cin >> s;
        ma[s] = true;
    }

    int m;
    cin >> m;

    bool lock = true;
    rep(i,m) {
        string s;
        cin >> s;

        if(!ma[s]) cout << "Unknown " << s << endl;
        else {
            if(lock) cout << "Opened by " << s << endl;
            else cout << "Closed by " << s << endl;
            lock = !lock;
        }
    }
    
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
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;
    bool locked = true;
    for(int i=0; i<m; ++i) {
        string t;
        cin >> t;
        if(find(begin(u), end(u), t) != end(u)) {
            if(locked) {
                cout << "Opened by " << t << "\n";
            } else {
                cout << "Closed by " << t << "\n";
            }
            locked = !locked;
        } else {
            cout << "Unknown " << t << "\n";
        }
    }
}

C++: #include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
  int n1,n2,flag=0,oc=0;
  string dam;
  vector<string>id;
  cin >> n1;
  for(int i=0;i<n1;i++){
    cin >> dam;
    id.push_back(dam);
  }
  cin >> n2;
  for(int i=0;i<n2;i++){
    cin >> dam;
    flag=0;
    for(int j=0;j<n1;j++){
      if(dam==id[j]){
	flag=1;
	if(oc==0){
	  cout << "Opened by "<< dam<<endl;
	  oc=1;
	  break;
	}
	else {
	  cout << "Closed by "<< dam<<endl;
	  oc=0;
	  break;
	}
      }
    }
    if(flag==0){
      cout << "Unknown "<< dam << endl;
    }
  }
  return 0;
}

C++: #include <stdio.h>
int main(){

  int n,m,i,j,c=0;

  char a[20][300];
  char b[20][300];

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%s",a[i]);
  }


  scanf("%d",&m);

  for(j=1;j<=m;j++){
    scanf("%s",b[j]);
  }



  // for(i=1;i<=n;i++){
  // printf("%s\n",a[i]);
  //  }
  

  for(i=1;i<=m;i++){
    for(j=1;j<=n;j++){

      if(strcmp(a[j],b[i])==0){
	c++;
	break;
      }
    }
    if(strcmp(a[j],b[i])!=0){
      printf("Unknown %s\n",b[i]);
    }
    else{
      if(c%2!=0&&c!=0){
	printf("Opened by %s\n",a[j]);
      }
      if(c%2==0&&c!=0){
	printf("Closed by %s\n",a[j]);
      }
    }
  }





  return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <sstream>
#include <numeric>
#include <set>
#include <map>
//#include <bits/stdc++.h>

#define rep(i, j) for(int i = 0; i < j; i++)
#define all(i) i.begin(), i.end()
#define ll long long
#define bl bool
#define nn printf("\n");
#define mod 1000000007

using namespace std;

struct inout { int cri; string name; };
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N; cin >> N;
	vector<inout> dat(N + 2);
	rep(i, N) 
	{
		cin >> dat[i].name; 
		dat[i].cri = 0;
	}
	int M; cin >> M;
	int l = 0;
	rep(i, M)
	{
		string tar; cin >> tar;
		int k = 0;
		rep(j, N)
		{
			if (dat[j].name == tar)
			{
				if(l == 0)
				{
					cout << "Opened by " << dat[j].name << "\n";
					l = 1;
					break;
				}
				else if (l == 1)
				{
					cout << "Closed by " << dat[j].name << "\n";
					l = 0;
					break;
				}
			}
			k++;
			if (k > N - 1) { cout << "Unknown " << tar << "\n"; }
		}
	}

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lpin(a,i,n) for(int i=0;i<n;i++){cin>>a[i];}
string a[300];

int main(){
  int co=0;
  int n;
  cin>>n;
  lp(i,n){
    cin>>a[i];
  }
  int m;
  cin>>m;
  lp(i,m){
    string x;
    cin>>x;
    int check=0;
    lp(j,n){
      if(a[j]==x){
	check=1;
	break;
      }
    }
    if(check==1) {
      if(co==0){
	cout<<"Opened by "<<x<<endl;
	co=1;
      }
      else if(co==1){
	cout<<"Closed by "<<x<<endl;
	co=0;
      }
    }
    else cout<<"Unknown "<<x<<endl;
  }
  return 0;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001


int main(){
    cin.sync_with_stdio(false);
    int n;
    cin >> n;
    unordered_map<string, int> mp;
    rep(i, n) {
        string s;
        cin >> s;
        mp[s] = 1;
    }
    int m;
    cin >> m;
    bool close = true;
    rep(i, m) {
        string s;
        cin >> s;
        if (mp[s] == 0) {
            cout << "Unknown " << s << endl;
        } else if (close) {
            cout << "Opened by " << s << endl;
            close = false;
        } else{
            cout << "Closed by " << s << endl;
            close = true;
        }
    }

    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
int main(){
    string log[]={"Opened by ","Closed by ","Unknown "};
    int state=0;
    map<string,int>M;
    int n;
    cin>>n;
    while(n--){
        string str;
        cin>>str;
        M[str]=1;
    }
    cin>>n;
    while(n--){
        string str;
        cin>>str;
        if(M.find(str)!=M.end())cout<<log[state]<<str<<endl;
        else{
            cout<<log[2]<<str<<endl;
            continue;
        }
        state=1-state;
    }
    return 0;
}

C++: #include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

set<string> users;

int main(){ _;
  int n,m;
  string user;
  bool opened=false;
  cin>>n;
  REP(i,n){
    cin>>user;
    users.insert(user);
  }
  cin>>m;
  REP(i,m){
    cin>>user;
    if(users.count(user)==1){
      if((opened=!opened)){
	cout<<"Opened by "<<user<<endl;
      }else{
	cout<<"Closed by "<<user<<endl;
      }
    }else{
      cout<<"Unknown "<<user<<endl;
    }
  }
}