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 <algorithm>
#include <vector>
#include <utility>
#include <cstring>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;

int main() {
	int n, m;
	cin >> n;
	vector<string> sn(n);
	rep(i, n) {
		cin >> sn[i];
	}
	cin >> m;
	bool open = false;
	rep(i, m) {
		string in;
		cin >> in;
		bool match = false;
		rep(j, n) {
			if( sn[j] == in ) {
				match = true;
				break;
			}
		}
		if(match) {
			cout << (open ? "Opened by " : "Closed by ");
			open = !open;
		} else {
			cout << "Unknown ";
		}
		cout << in << endl;
	}
	return 0;
}

C++: #include <string>
#include <iostream>
#include <set>
#include <stdio.h>
using namespace std;
int main()
{
  int i,M,N,f=1;
  set<string> U;
  char str[15];
  std::cin >> N;
  for (i=0;i<N;i++){
    std::cin >> str;
    U.insert(str);
  }
  std::cin >> M;
  for (i=0;i<M;i++){
    std::cin >> str;
    set<string>::iterator t=U.find(str);
      if (t==U.end())
        printf("Unknown %s\n",str);
      else{
        if (f==1){
          printf("Opened by %s\n",str);
          f=0;
        }else{
          printf("Closed by %s\n",str);
          f=1;
        }
      }
  }

  return 0;
}

C++: #include<stdio.h>
#include<string.h>
 
int main(){
    int n,m,flag=0,i,j;
    char s[256][16],t[16];
    scanf("%d",&n);
    for(i=0;i<n;i++)scanf("%s",s[i]);
    scanf("%d",&m);
    for(i=0;i<m;i++){
        scanf("%s",t);
        for(j=0;j<n;j++){
            if(!strcmp(t,s[j])){
                if(!flag){
                    printf("Opened by %s\n",t);
                    flag=1;
                    break;
                }else{
                    printf("Closed by %s\n",t);
                    flag=0;
                    break;
                }
            }
        }
        if(j==n)printf("Unknown %s\n",t);
    }
    return 0;
}

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

#define lambda(RES_TYPE, ...) (function<RES_TYPE(__VA_ARGS__)>)[&](__VA_ARGS__) -> RES_TYPE
#define method(FUNC_NAME, RES_TYPE, ...) function<RES_TYPE(__VA_ARGS__)> FUNC_NAME = lambda(RES_TYPE, __VA_ARGS__)

#define range(i, l, r) for (int i = l; i < (int)(r); ++i)

signed main(){
  int N, M;
  set<string> s;

  cin>>N;

  for(int i = 0; i < N; i++){
    string x;

    cin>>x;
    s.insert(x);
  }

  cin>>M;
  
  for(int i = 0, j = 0; i < M; i++){
    string y;

    cin>>y;
    
    if(s.count(y)) {
      if(j) {
        cout<<"Closed by "<<y<<endl;
      } else {
        cout<<"Opened by "<<y<<endl;
      }
      
      j = !j;
    } else {
      cout<<"Unknown "<<y<<endl;
    }
  }
  
  return 0;
}

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

int main(){
	int N;
	map<string,int> info;
	int M;
	
	cin >> N;
	for(int i = 0 ; i < N ; i++){
		string s; cin >> s;
		info[s] = 0;
	}
	int T = 0;
	cin >> M;
	for(int i = 0 ; i < M ; i++){
		string t;
		cin >> t;
		if( info.count(t) == 0 ){
			cout << "Unknown" << " " << t << endl;
			continue;
		}else if(T == 0 ){
			cout << "Opened by " << t << endl;
		}else{
			cout << "Closed by " << t << endl;
		}
		T ^= 1;
	}
}

C++: #include <iostream>
#include <set>
using namespace std;
int main()
{
  int n;
  cin >> n;
  set<string> s;
  for(int i=0; i<n; i++){
    string str;
    cin >> str;
    s.insert(str);
  }
  int m;
  cin >> m;
  bool bOpen = false;
  for(int i=0; i<m; i++){
    string str;
    cin >> str;
    if(s.find(str) == s.end()){
      cout << "Unknown " << str << endl;
    }else{
      if(bOpen){
        cout << "Closed by " << str << endl;
      }else{
        cout << "Opened by " << str << endl;
      }
      bOpen = !bOpen;
    }
  }
  return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<complex>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF (long long)1000000000
#define MOD 1000000007
#define EPS (long double) 1e-8
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};

int main(void) {
	int n;
	cin>>n;
	set<string> s;
	REP(i, n) {
		string buf;
		cin>>buf;
		s.insert(buf);
	}
	int m;
	cin>>m;
	int d = 0;
	REP(i, m) {
		string buf;
		cin>>buf;
		if(s.count(buf) == 0) {
			cout<<"Unknown "<<buf<<endl;
		} else {
			if(d) cout<<"Closed by "<<buf<<endl;
			else cout<<"Opened by "<<buf<<endl;
			d = !d;
		}
	}
}

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

typedef std::int_fast32_t  s32;
typedef std::uint_fast32_t u32;
typedef std::int_fast64_t  s64;
typedef std::uint_fast64_t u64;

int main(void) {

  int N, M;
  std::string U[256];
  std::string T[256];

  std::cin >> N;
  for(int i = 0; i < N; ++i) {
    std::cin >> U[i];
  }
  std::cin >> M;
  for(int i = 0; i < M; ++i) {
    std::cin >> T[i];
  }

  int state = false;
  for(int i = 0; i < M; ++i) {
    for(int j = 0; j < N; ++j) {
      if( T[i] == U[j] ) {
        if( state ) {
          std::cout << "Closed by " << T[i] << std::endl;
        }
        else {
          std::cout << "Opened by " << T[i] << std::endl;
        }
        state = not state;
        goto label_1;
      }
    }
    std::cout << "Unknown " << T[i] << std::endl;
  label_1:;
  }
  
  return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <cctype>

#include <iostream>
#include <vector>
#include <deque>
#include <queue>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i,l,n) for(int (i)=(int)(l);(i)<(int)(n);(i)++)
#define d_arr(arr, h, w) rep(i,(h) ){ cout << "["; rep(j,(w) ) { cout << (arr)[i][j] << ", "; } cout << "]" << endl;}
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x);

typedef pair<int ,int> P;

class car
{
    int id;
    int num;
    public:
        car(int x, int y){ id=x; num=y; }
};


int main()
{
    int N,M;
    set<string> u;
    vector<string> t;
    //しまってる　0 　空いている 1
    int state = 0;
    //vector<int> state;
    cin >> N;
    string tmp;
    rep(i,N)
    {
        cin >> tmp;
        u.insert(tmp);
    }
    cin >> M;
    rep(i,M)
    {
        cin >> tmp;
        t.push_back(tmp);
    }
    rep(i,M)
    {
        if ( u.find( t[i] ) == u.end() ) { cout << "Unknown " << t[i] << endl; }
        else if(state == 0) {cout << "Opened by " << t[i] << endl; state = 1; }
        else if(state == 1) {cout << "Closed by " << t[i] << endl; state = 0; }
    }
}