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 <vector>
#include <complex>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <stack>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <cassert>

using namespace std;

typedef long long ll;
typedef ll li;
typedef pair<int,int> PI;
#define EPS (1e-10L)
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define F first
#define S second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(),a.end()
#define FOR(it,a) for(__typeof(a.begin())it=a.begin();it!=a.end();++it)
void pkuassert(bool t){t=1/t;};

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

int main(int argc, char *argv[])
{
  map<string,int> key;
  int n;
  cin >> n;
  string in;
  int op=0;
  rep(i,n){
    cin >> in;
    key[in]=0;
  }

  cin >> n;
  rep(i,n){
    cin >> in;
    if(key.count(in)){
      cout << (!op?"Opened":"Closed") << " " << in << endl;
      op^=1;
    }else cout << "Unknown " << in << endl;
  }
  
  return 0;
}

C++: #include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define sint(x) cout <<#x<<" = "<<(x)<<endl
#define spair(p) cout <<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define sset(s) cout<<#s<<":";each(i,s)cout <<" "<<i;cout<<endl

using namespace std;


typedef pair<int,int>P;

const int MAX_N = 100005;

int main()
{
    int n,m;
    cin >> n;
    map<string,int> mp;
    int pos = 1;
    rep(i,n){
        string s;
        cin >> s;
        mp[s] = i+1;
    }
    cin >> m;
    rep(i,m){
        string s;
        cin >> s;
        if(mp[s] == 0){
            cout << "Unknown " << s << "\n";
        }else{
            if(pos == 0){
                cout << "Closed by " << s << "\n";
                pos = 1;
            }else{
                cout << "Opened by " << s << "\n";
                pos = 0;
            }
        }
    }
}

C++: // Author :
// Date :
// Problem:
// Solution:
// Comment:

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstring>

#define pp push
#define pb push_back
#define mp make_pair
#define xx first
#define yy second

using namespace std;

main(){
    vector <string> name;
    int n,m;
    string q;
    
    cin >> n;
    
    for(int i = 0 ; i < n ; i++){
        cin >> q;
        name.pb(q);
    }
    
    cin >> m;
    
    int condition = 0;
    for(int i = 0 ; i < m ; i++){
        cin >> q;
    
        int flag = 0;    
        for(int i = 0 ; i < n ; i++){
            if(q == name[i]) flag = 1;
        }
        
        if(flag == 1){
            if(condition == 0){
                cout << "Opened by " << q << endl;
                condition = 1;
            }
            else{
                cout << "Closed by " << q << endl;
                condition = 0;
            }
        }
        else{
            cout << "Unknown " << q << endl;
        }
    }
    #ifdef GEREL
        for(;;);
    #endif

    return 0;
}

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

int main(){

  string tmp[256];
  bool lock;
  string in;
  int n,m;
  
  cin >> n;

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

  
  cin >> m;
  for(int i=0; i<m; i++){
    cin >> in;
    int j;
    for(j=0; j<n; j++){
      if(tmp[j] == in){
	if(lock == true){
	  lock = false;
	  cout << "Opened by " << in << endl;
	}
	else{
	  lock = true;
	  cout << "Closed by " << in << endl;
	}
	
	break;
      }
    }
    if(j==n){ cout << "Unknown " << in << 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"<<endl;
      else if(a%2==0) cout<<"Closed by"<<pass[I]<<endl;
      else if(a%2!=0) cout<<"Opened by"<<kagi[I]<<endl;
      b=0;
      
    }

  return 0;
}

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

using namespace std;

int main(){
	
	int n;
	
	cin >> n;
	
	string u[n];
	
	for(int i=0;i<n;i++){
		cin >> u[i];
	}
	
	int m;
	
	bool open=false;
	
	cin >> m;
	
	for(int i=0;i<m;i++){
		string t;
		cin >> t;
		
		for(int j=0;j<=n;j++){
			if(j==n){
				cout << "Unknown " << t << endl;
			}
			if(u[j]==t){
				if(open==true){
					cout << "Closed by " << t << endl;
					open=false;
				}else{
					cout << "Opened by " << t << endl;
					open = true;
				}
				break;
			}
		}
	}
					
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
  int N,M,d;
  bool c=true;
  string s,list[256];

  cin >> N;
  for(int i=0;i<N;i++){
    cin >> list[i];
  }
  cin >> M;
  for(int i=0;i<M;i++){
    d = 0;
    cin >> s;
    for(int j=0;j<N;j++){
      if(list[j]==s){
	if(c == true){
	  c = false;
	  d = 1;
	  cout << "Opened by " << s << endl;
	}else{
	  c = true;
	  d = 1;
	  cout << "Closed by " << s << endl;
	}
      }
    }
    if(d==0){
      cout << "Unknown " << s <<endl;
    }
  }
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
#include <set>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    int n;

    cin >> n;
    string s;
    set<string> st;
    REP(i,n){
        cin >> s;
        st.insert(s);

    }
    cin >> n;
    bool is_open = false;
    REP(i,n){
        cin >> s;
        auto it = st.find(s);
        if(it!=st.end()){
            if(!is_open){
                cout << "Opened by " << s << endl;
            }else{
                cout << "Closed by " << s << endl;
            }
            is_open = !is_open;
        }else{
            cout << "Unknown " << s << endl;
        }
    }
    return 0;
}