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<cstdio>
#include<cstring>
using namespace std;
int main(){
?? int n,m,count=0;
?? char u[257][11],t[257][11];
?? 
?? cin>>n;
?? for(int i=0;i<n;i++)
?????? scanf("%s",u[i]);

?? cin>>m;
?? for(int i=0;i<m;i++)
?????? scanf("%s",t[i]);


?? for(int i=0;i<m;i++)
?????? for(int j=0;j<n;j++)
?????????? if(strcmp(t[i],u[j])==0){
??count++;
??if(count%2==1)
???? cout<<"Opened by "<<t[i]<<endl;
??else
???? cout<<"Closed by "<<t[i]<<endl;
??break;
?????????? }
?????????? else if(j==n-1)
???? cout<<"Unknown "<<t[i]<<endl;
?? return 0;
}

C++: #include <cstdio>
#include <string>
#include <set>
using namespace std;

int M, N;
bool open = false;
char c[16];
set<string> U;

int main(){
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%s", c, 16);
		U.insert((string)c);
	}
	scanf("%d", &M);
	for (int i = 0; i < M; i++) {
		scanf("%s", c, 16);

		if (U.find((string)c) != U.end()) {
			if (open) {
				printf("Closed by %s\n", c);
			}
			else {
				printf("Opened by %s\n", c);
			}
			open = !open;
		}
		else {
			printf("Unknown %s\n", c);
		}
	}

	return 0;
}

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

using namespace std;

int main()
{
    bool isLocked = true;
    vector<int> map;
    int N, M;
    cin >> N;
    
    map.clear();
    map.resize(N);
    for (int i = 0; i < N; ++i) {
        int id;
        cin >> id;
        map[i] = id;
    }
    
    cin >> M;
    for (int i = 0; i < M; ++i) {
        int id;
        cin >> id;
        auto itr = find(map.begin(), map.end(), id);
        if (itr != map.end()) {
            if (isLocked) {
                cout << "Opened by " << id << "\n";
            } else {
                cout << "Closed by " << id << "\n";
            }
            isLocked = ~isLocked;
        } else {
            cout << "Unknown " << id << "\n";
        }
    }
    
    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 << "Opened 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;
}

C++: #include<iostream>
#include<string.h>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> pii;

int main()
{
  int m,n;
  char u[300][15]={};
  char t[300][15]={};
  int i,j;

  cin>>n;
  rep(i,n)
    cin>>u[i];
  cin>>m;
  bool ans=false;//close
  rep(i,m){
    cin>>t[i];
    rep(j,n)
      if(strcmp(t[i],u[j])==0){
	if(ans){
	  ans=false;
	  printf("Closed by ");
	}else{
	  ans=true;
	  printf("Opened by ");
	}
	cout<<t[i]<<endl;
	goto END;
      }
    printf("Unknown %s\n",t[i]);
  END:;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define let auto const

int main() {
  i64 N;
  cin >> N;
  set<string> st;
  rep(i,0,N) {
    string u;
    cin >> u;
    st.insert(u);
  }
  i64 M;
  cin >> M;
  vector<string> T(M);
  rep(i,0,M) cin >> T[i];
  i64 op = 0;
  rep(i,0,M) {
    string t = T[i];
    if(st.count(t)) {
      op ^= 1;
      if(op) {
        cout << "Opened by " << t << endl;
      }
      else {
        cout << "Closed by " << t << endl;
      }
    }
    else {
      cout << "Unknown " << t << endl;
    }
  }
}

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

using namespace std;

int main() {
    int n, m;
    string u, t;
    set<string> u_set;
    bool is_opened = false;
    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> u;
        u_set.insert(u);
    }
    cin >> m;
    for (int i=0; i<m; i++) {
        cin >> t;
        if (u_set.find(t) != u_set.end()) {
            if (is_opened) {
                cout << "Closed by " << t << endl;
                is_opened = false;
            }
            else {
                cout << "Opened by " << t << endl;
                is_opened = true;
            }
        }
        else {
            cout << "Unknown " << t << endl;
        }
    }

    return 0;
}

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

int main(){
	int kc;
    vector<string> key;
	cin>>kc;
	key.resize(kc);
    for (int i = 0; i < kc; i++) cin>>key[i];
    bool isOpen = false;
    int oc;
	cin>>oc;
    for (int i = 0; i < oc; i++)
	{
        string tkey;
		cin>>tkey;
        bool isOK = false;
        for (vector<string>::iterator ita=key.begin;ita!=key.end;++ita)
		{
			if(*ita==tkey)
			{
				isOK=true;
				break;
			}
		}		
        if (!isOK)
        {
            cout<<"Unknown "<<tkey<<endl;
        }
        else if (isOpen)
        {
            cout<<"Closed by "<<tkey<<endl;
            isOpen = false;
        }
        else
        {
            cout<<"Opened by "<<tkey<<endl;
            isOpen = true;
        }
	}
}

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

#define PI 4*atan(1)
#define INF 1e8

int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};

int main(){
  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];
  }
  int s = -1;
  for(int i = 0; i < M; i++){
    bool flag = false;
    for(int j = 0; j < N; j++){
      if(T[i] == U[j]){
        if(s == -1)cout << "Opened by " << T[i] << endl;
        else cout << "Closed by " << T[i] << endl;
        s *= -1;
        flag = true;
        break;
      }
    }
    if(!flag)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 (auto &a : U)
    {
        cin >> a;
    }
    int M;
    cin >> M;
    int flag = 0, auth;
    for (int i = 0; i < M; i++)
    {
        string s;
        cin >> s;
        auth = 0;
        for (int j = 0; j < N; j++)
        {
            if (U[j] == s)
            {
                if (flag == 0)
                {
                    cout << "Opened by " << s << endl;
                    flag = 1;
                }
                else
                {
                    cout << "Closed by " << s << endl;
                    flag = 0;
                }
                auth = 1;
                break;
            }
            if (auth)
                break;
        }
        if (auth == 0)
            cout << "Unknown " << s << endl;
    }
    return 0;
}