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 <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <stack>

using namespace std;

#define Getsign(n) ((n > 0) - (n < 0))
#define QWERTYR(c) (c == 'y' || c == 'u' || (c >= 'h' && c <= 'p') ?	true : false)
typedef vector<int> Ivec;
typedef pair<int, int> pii; // (cst, to)

int main() {
	int n, m;
	map<string, bool> IDs;
	scanf("%d", &n);
	for (int i = 0; n > i; i++) {
		char str[11];
		scanf("%s", str);
		IDs[string(str)] = true;
	}
	scanf("%d", &m);
	bool state = false;
	for (int i = 0; m + i; i++) {
		char str[11];
		scanf("%s", str);
		if (IDs[string(str)]) {
			state = 1 - state;
			printf("%sed by %s\n", state ? "Open" : "Clo", str);
		}
		else {
			printf("Unknown %s\n", str);
		}
	}

	return 0;
}

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

using namespace std;

int main(int argc, char *argv[]) {
  int n, m;
  vector<string> id;
  bool close = true;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    id.push_back(s);
  }

  cin >> m;
  for (int i = 0; i < m; i++) {
    string s;
    cin >> s;
    if (find(id.begin(), id.end(), s) != id.end()) {
      if (close) {
        cout << "Opened by " << s << endl;
        close = false;
      } else {
        cout << "Closed by " << s << endl;
        close = true;
      }
    } else {
      cout << "Unknown " << s << endl;
    }
  }
  return 0;
}

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

using namespace std;

int n, m;
vector<string> ids;

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        ids.push_back(s);
    }

    cin >> m;
    bool locked = true;
    for (int i = 0; i < m; ++i) {
        string s;
        cin >> s;
        auto itr = find(ids.begin(), ids.end(), s);
        if (itr != ids.end()) {
            if (locked) cout << "Opened by " << s << endl;
            else cout << "Closed by " << s << endl;
            locked = !locked;
        } else {
            cout << "Unknown " << s << endl;
        }
    }
}

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

int main(){
　int N,M;
  int cnt1 = 0;
  int cnt2 = 0;
  int U[256];
  int T[256];
  cin>>N;
  for(int i=0;i<N;i++) cin>>U[i];
  cin>>M;
  for(int j=0;j<M;j++) cin>>T[j];
  for(int j=0;j<M;j++){
  for(int i=0;i<N;i++){
  if(T[j] == U[i]) cnt1++;
  else cnt2++;
 }
  if(cnt1 % 2 == 1 && cnt2 != N) cout<<"Opened by"<<" "<<T[j]<<endl;
  if(cnt2 % 2 == 0 && cnt2 != N) cout<<"Closed by"<<" "<<T[j]<<endl;
  if(cnt2 == N) cout<<"Unknown"<<" "<<T[j]<<endl;
  cnt2 = 0;
 }
 return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(void){
    int i,n,m;
    cin>>n;
    vector<string> u(n);
    for(i=0;i<n;i++)
    cin>>u[i];
    int lock=1;
    cin>>m;
    vector<string> t(m);
    for(i=0;i<m;i++){
cin>>t[i];
int l=0;
for(int j=0;j<n;j++){
    if(t[i]==u[j]){
        l++;
        lock=-lock;
        if(lock==-1)
        cout<<"Opened by "<<t[i]<<endl;
        else
        cout<<"Closed by "<<t[i]<<endl;
        break;
    }
}if(l==0)
    cout<<"Unknown "<<t[i]<<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
  int n,m;
  string user[1000];
  
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>user[i];
  }
  
  bool locked=true;
  cin>>m;
  for(int i=0;i<m;i++){
    string str;
    cin>>str;
    bool found=false;
    for(int i=0;i<n&&!found;i++){
      if(user[i]==str){
	found=true;
	if(locked){
	  cout<<"Opened by "<<user[i]<<endl;
	  locked=false;
	}else{
	  cout<<"Closed by "<<user[i]<<endl;
	  locked=true;
	}
      }
    }
    if(!found){
      cout<<"Unknown "<<str<<endl;
    }
  }
  return(0);
}

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

bool search(string* array, int length,  string target)
{
  string array_last = array[length - 1];
  array[length - 1] = target;
  
  int i;
  for (i = 0; array[i] != target; i++)
  {
  }
  array[length - 1] = array_last;
  if (i < length-1)
  {
    return true;
  }
  else if (array_last == target)
  {
    return true;
  }
  else
  {
    return false;
  }
}

int main(void)
{
  bool open = false;
  int n;
  cin >> n;
  string* u = new string[n];
  for (int i = 0; i < n; i++)
  {
    cin >> u[i];
  }

  int m;
  cin >> m;
  for (int i = 0; i < m; i++)
  {
    string t;
    cin >> t;
    if (search(u, n, t) )
    {
      if (open)
      {
        cout << "Closed by ";
      }
      else
      {
        cout << "Opened by ";
      }
      open = !open;
    }
    else
    {
      cout << "Unknown ";
    }
    cout << t << endl;
  }

  delete[] u;
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>
#include <bitset>

using namespace std;
typedef long long ll;

set<string> s;

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        string ss;
        cin >> ss;
        s.insert(ss);
    }
    int m;
    cin >> m;
    bool now = false;
    for (int i = 0; i < m; i++) {
        string a;
        cin >> a;
        if (s.count(a)) {
            now = !now;
            if (now) {
                cout << "Opened by " << a << endl;
            } else {
                cout << "Closed by " << a << endl;
            }
        } else {
            cout << "Unknown " << a << endl;
        }
    }
    return 0;
}