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 <algorithm>

using namespace std;

int N, M;
string U[257];

int main() {
  char s[14];
  scanf("%d", &N);
  for (int i=0;i<N;i++) {
    scanf("%s", s);
    U[i] = s;
  }
  scanf("%d", &M);
  bool opened = false;
  for (int i=0;i<M;i++) {
    scanf("%s", s);
    const string* p = find(U, U+N, (string)s);
    if (!p->empty()) {
      opened = !opened;
      printf("%s by %s\n", (opened ? "Opened" : "Closed"), s);
    } else {
      printf("Unknown %s\n", s);
    }
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main() {
    int a,b,d=0,r;
    string key[257],s[2]={"Opened by ","Closed by "},in;
    for(cin>>a;a>0;a--)cin>>key[a];
    for(cin>>b;b>0;b--){
        cin>>in;
        r=1;
        for(int j=1;j<257;j++)if(key[j]==in){
            cout<<s[d]<<in<<endl;
            d=++d%2;
            r=0;
        }
        if(r)cout<<"Unknown "<<in<<endl;
    }
}

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

int main() {

  long long int n;

  while( cin >> n ) {

    vector< string > id;

    for ( long long int i = 0; i < n; i++ ) {

      string in;
      cin >> in;
      id.push_back( in );

    }

    sort( id.begin(), id.end() );

    long long int m;
    cin >> m;

    long long int k = 0;

    for ( long long int i = 0; i < m; i++ ) {

      string in;
      cin >> in;

      if ( binary_search( id.begin(), id.end(), in ) ) {
	if ( k == 0 ) {
	  k = 1;
	  cout << "Opened by " << in << endl;
	}else {
	  k = 0;
	  cout << "Closed by " << in << endl;
	}
      }else {
	cout << "Unknown " << in << endl;
      }

    }

  }

  return 0;

}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  string table[256],man[256];
  int n,m;
  bool b=true;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>table[i];
  }
  cin>>m;
  for(int i=0;i<m;i++){
    cin>>man[i];
    for(int j=0;j<n;j++){
      if(man[i]==table[j] && b){
	cout<<"Opened"<<" "<<"by"<<" "<<table[j]<<endl;
	b=false;
	break;
      }else if(man[i]==table[j] && !b){
	cout<<"Closed"<<" "<<"by"<<" "<<table[j]<<endl;
	b=true;
	break;
      }
      if(j==n-1) cout<<"Unknown"<<" "<<man[i]<<endl;
    }
  }
  return 0;
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;


bool solve(){
	int n, m;
	cin>> n;
	vector<string> ID(n);
	for(int i=0;i<n;i++){
		string str;
		cin>> str;
		ID[i] = str;
	}
	cin>> m;	//ココ...
	int cnt = 0;
	for(int i=0;i<m;i++){
		string in;
		cin>> in;
		int status = 0;
		for(int j=0;j<n;j++){
			if(in == ID[j]){
				status++;
				break;
			}
		}
		if(!status){
			cout<< "Unknown ";
		}else{
			if(cnt%2){
				cout<< "Closed by ";
			}else{
				cout<< "Opened by ";
			}
			cnt++;
		}
		cout<< in<< endl;
	}
	
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	solve();

	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
#include<cstring>
#include <algorithm>

using namespace std;

int main()
{
	int N,M,flag=0,CP=0;
	char U[1000][1000],T[1000];
	
	cin >> N;
	for(int i=0;i<N;i++)cin>>U[i];
	
	cin >> M;
	for(int i=0;i<M;i++)
	{
		cin>>T;
		
		for(int j=0;j<N;j++)
		{
			int count=0;
			
			for(int k=0;k<strlen(T);k++)if(U[j][k]==T[k])count++;

			
			if(count==strlen(T))
			{
				flag=1;
				CP++;
				break;
			}
			else flag=0;
		}
		
		if(flag==1)
		{
			if(CP%2==1)cout << "Opened by " << T <<endl;
			else cout << "Closed by " << T <<endl;
		}
		else cout << "Unknown " << T <<endl;
	}
	
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
using namespace std;

// s.....0=�{�� 1=����
int n, m, s = 0, c = 0;
char u[256][11] = {}, t[256][11] = {};

int check(int a, int b);

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%s", &u[i]);
	}
	scanf("%d", &m);
	for (int i = 0; i < m; i++) {
		scanf("%s", &t[i]);
	}

	for (int i = 0; i < m; i++) {
		c = 0;

		for (int j = 0; j < n; j++) {
			if (check(j,i)) {
				c = 1;
				if (s == 0) {
					printf("Opened by %s\n", t[i]);
					s = 1;
					break;
				}
				if (s == 1) {
					printf("Closed by %s\n", t[i]);
					s = 0;
					break;
				}
			}
		}

		if (c == 0) {
			printf("Unknown %s\n", t[i]);
		}
	}
	return 0;
}

int check(int a, int b) {
	for (int i = 0; i < 10; i++) {
		if (u[a][i] != t[b][i])
			return 0;
	}
	return 1;
}

C++: #include <cstdio>
#include <string>
#include <algorithm>

using namespace std;

int N, M;
string U[257];

int main() {
  char s[11];
  scanf("%d", &N);
  for (int i=0;i<N;i++) {
    scanf("%s", s);
    U[i] = s;
  }
  scanf("%d", &M);
  bool opened = false;
  for (int i=0;i<M;i++) {
    scanf("%s", s);
    const string* p = find(U, U+N, (string)s);
    if (!p->empty()) {
      opened = !opened;
      printf("%s by %s\n", (opened ? "Opened" : "Closed"), s);
    } else {
      printf("Unknown %s\n", s);
    }
  }
  return 0;
}

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

using namespace std;

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

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

int main(){
    int n, m;
    string username;
    map<string, int> user;
    cin >> n;
    for(int i=0;i<n;++i){
        cin >> username;
        user.insert(make_pair(username, 1));
    }
    cin >> m;
    for(int i=0;i<m;++i){
        cin >> username;
        if(user.find(username)==user.end()) cout << "Unknown ";
        else{
            if(user[username]) cout << "Opened by ";
            else cout << "Closed by ";
            user[username] = 1-user[username];
        }
        cout << username << endl;
    }
}