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 <stdio.h>
#include <string.h>
int main(){
  int count,oorc,flag,n,m,i,j,k,len;
  char u[258][11],t[258][11];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",u[i]);
  }
  oorc=0;
  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%s",t[i]);
    flag=0;
    len=strlen(t[i]);
   
  
    for(j=0;j<n;j++){
      count=0;
      for(k=0;k<len;k++){
    if(t[i][len]=='\0'&&u[j][len]!='\0'){
          break;
    }
    if(t[i][k]==u[j][k]){
      count++;
    }
        if(count==len){
          flag=1;
          break;
    }
      }
    }
    if(flag==1&&oorc==0){
      oorc=1;
      printf("Opened by ");
      for(j=0;j<len;j++){
    printf("%c",t[i][j]);
      }
      printf("\n");
    }
    else if(flag==1&&oorc==1){
      oorc=0;
      printf("Closed by ");
      for(j=0;j<len;j++){
    printf("%c",t[i][j]);
      }
      printf("\n");
    }   
    else if(flag==0){
      printf("Unknown ");
      for(j=0;j<len;j++){
    printf("%c",t[i][j]);
      }
      printf("\n");
    }
  }
  return 0;
}

C++: using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

using CHY72;

namespace CHY72{
    
    public class PointXY<T>where T:IComparable {
        public T X , Y;
        public bool Flag = false;
        public PointXY(T _X,T _Y) {
            X = _X; Y = _Y;
        }
        public static bool operator ==(PointXY<T> P1, PointXY<T> P2) {
            return (P1.X.CompareTo( P2.X) == 0 && P1.Y.CompareTo (P2.Y) == 0);
        }
        public static bool operator !=(PointXY<T> P1, PointXY<T> P2) {return !(P1 ==P2);}
        public override int GetHashCode() {return X.GetHashCode() ^ Y.GetHashCode();}
        public override bool Equals(object obj) {
            if (obj == null || this.GetType() != obj.GetType()) {return false;}
            return (this == (PointXY<T>)obj);
        }         

    }
    
}    

public class Program {
    static bool ReadLine_1(ref int num1, bool Fin0 = true) {
        string str = Console.ReadLine();
        num1 = int.Parse(str);
        return (Fin0 && num1 == 0);
    }
    static int  ReadLine_1() {
        return  int.Parse(Console.ReadLine());
    }
    static bool ReadLine_2(ref int num1, ref int num2, char Spliter = ' ', bool Fin0 = true) {
        string str = Console.ReadLine();
        num1 = int.Parse(str.Split(Spliter)[0]);
        num2 = int.Parse(str.Split(Spliter)[1]);
        return (Fin0 && num1 == 0);
    }
    static int[] ReadLine72(char Spliter = ' ') {
        return Console.ReadLine().Split(Spliter).Select(s => int.Parse(s)).ToArray();
    }

    const int DefaultMax = 727272;



    static void Main(string[] args) {
        int iMax = ReadLine_1();
        var IDs = new string[iMax];
        //var IDs = new Dictionary<string,bool>();
        for (int i = 0; i < iMax; i++) {
            IDs[i] = Console.ReadLine();
            //IDs.Add( Console.ReadLine(),false );
        }
        iMax = ReadLine_1();
        bool isOpen = false;
        for (int i = 0; i < iMax; i++) {
            string Commer = Console.ReadLine();
            //if (IDs.ContainsKey(Commer)) {
            if (IDs.Contains(Commer)) {
                if (!isOpen ) { Console.WriteLine("Opened by " + Commer); }
                else { Console.WriteLine("Closed by " + Commer); }
                isOpen = !isOpen;
            }else {
                Console.WriteLine("Unknown " + Commer);
            
            }
        
        }

    }
}

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

int main(){
  int n;
  int m;
  cin>>n;
  vector<string> users(n);
  bool flag=false;
  for(int i=0;i<n;i++)
    cin>>users[i];

  cin>>m;
  for(int i=0;i<m;i++){
    string str;
    cin>>str;
    vector<string>::iterator it;
    if((it=find(users.begin(),users.end(),str))!=users.end()){
      if(flag){
	cout<<"Closed by "<<*it<<endl;
	flag=false;
      }else{
	cout<<"Opened by "<<*it<<endl;
	flag=true;
      }
    }else{
      cout<<"Unknown "<<str<<endl;
    }
  }

  return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int n;
    cin >> n;
    string id[11];
    for(int i = 0; i < n; i++){
        cin >> id[i];
    }
    int lock = 0;
    int m;
    cin >> m;
    string x;
    for(int i = 0; i < m; i++){
        int cnt = 0;
        cin >> x;
        for(int j = 0; j < n; j++){
            if(x == id[j]){
                if(lock == 0){
                    lock = 1;
                    cout << "Opened by " << x << endl;
                }
                else{
                    lock = 0;
                    cout << "Closed by " << x << endl;
                }
                continue;
            }
            else cnt++;
        }
        if(cnt == n){
            cout << "Unknown " << x << endl;
        }
    }
        
    return 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>
#include<cstring>

using namespace std;

int fg = 0;

void syutu(char[]);

int main(void){
    int N,M,chk=0;
    cin>>N;
    char U[N][256];
    for(int lop=0;lop<N;lop++){
        cin>>U[lop];
    }
    cin>>M;
    char T[M][256];
    for(int lop=0;lop<M;lop++){
        cin>>T[lop];
    }

    for(int lop=0;lop<M;lop++){
        for(int lop2=0;lop2<N;lop2++){
            //cout<<T[lop]<<"  "<<U[lop2]<<endl;
            //cout<<strcmp(T[lop],U[lop2])<<endl;
            if(strcmp(T[lop],U[lop2])==0){
                
                syutu(T[lop]);
                chk=1;
                break;
            }
        }
        if(chk == 0){
            cout<<"Unknown "<<T[lop]<<endl;
        }else{
            chk = 0;
        }
    }


    return 0;
}

void syutu(char moji[]){
    if(fg == 0){
        cout<<"Opened by "<<moji<<endl;
        fg =1;
    }else{
        cout<<"Closed by "<<moji<<endl;
        fg =0;
    }
    return;
}