Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	scn := bufio.NewScanner(os.Stdin)
	scn.Split(bufio.ScanWords)
	nextInt := func() int { scn.Scan(); r, _ := strconv.Atoi(scn.Text()); return r }
	w := bufio.NewWriter(os.Stdout)

	n := nextInt()
	v := make([][]int, n)
	for i := 0; i < n; i++ {
		u := nextInt()
		k := nextInt()
		for j := 0; j < k; j++ {
			v[u-1] = append(v[u-1], nextInt())
		}
	}

	for _, vvs := range v {
		for j := 1; j <= n; j++ {
			if j > 1 {
				fmt.Fprint(w, " ")
			}
			p := sort.SearchInts(vvs, j)
			if p < len(vvs) && vvs[p] == j {
				fmt.Fprint(w, 1)
			} else {
				fmt.Fprint(w, 0)
			}
		}
		fmt.Fprintln(w)
	}

	w.Flush()
}

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

int a[102][102];
int main(){
	int n, u, k, t;
	scanf("%d", &n);
	for(int i = 0;i < n;i++){
		scanf("%d%d", &u, &k);
		for(int j = 0;j < k;j++){
			scanf("%d", &t);
			a[u][t] = 1;
		}
	}
	for(int i = 1;i <= n;i++){
		for(int j = 1;j < n;j++)printf("%d ", a[i][j]);
		printf("%d\n", a[i][n]);
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio> 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
using namespace std;
/*---------------------------------------------------*/

int n,u,k,v;
int g[105][105];

int main(){
  scanf("%d",&n);

  rep(i,n){
    scanf("%d%d",&u,&k);
    rep(i,k){
      scanf("%d",&v);
      g[u][v]=1;
    }
  }
  
  REP(i,1,n+1){
    printf("%d",g[i][1]);
    REP(j,2,n+1){
      printf(" %d",g[i][j]);
    }
    printf("\n");
  }
  return 0;
}

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

int main(){

  int n,k,v,u;
  cin>>n;

  double V[n][n];

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

      V[i][j]=0;
    }
  }
  for(int i=0;i<n;i++){
    cin>>u;
    cin>>k;
    for(int j=0;j<k;j++){
      cin>>v;
      V[u-1][v-1]=1;
    }


  }

  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      cout<<V[i][j]<<" ";
  }
    cout<<endl;
  }

  return 0;
}

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

int main()
{
	int i,j,n,u,k,a;
	int v[100][100];
	cin >> n;
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			v[i][j]=0;
		}
	}
	for(i=0;i<n;i++){
		cin >> u;
		cin >> k;
		for(j=0;j<k;j++){
			cin >>a;
			v[u-1][a-1]=1;
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			cout << v[i][j];
			if (i!=n-1) cout << " ";
		}
		cout<<endl;
	}
}

C++: #include <iostream>
using namespace std;
static const int N = 100;

int main(){

   int M[N][N];
   int a, b, i, j, n, k;

   cin >> n;

   for(i = 0; i < n; i++) {
      for(j = 0; j < n; j++) {
         M[i][j] = 0;
      }
   }

   for(i = 0; i < n; i++) {
      cin >> a >> k;
      a--;
      for(j = 0; j < k; j++) {
         cin >> b;
         b--;
         M[a][b] = 1;
      }
   }

   for(i = 0; i < n; i++) {
      for(j = 0; j < n; j++) {
         if (j) cout << " ";
         cout << M[i][j];
      }
      cout << endl;
   }
   return 0;
}

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

static const int M_SIZE = 100;

int main() 
{
    int adj_M[M_SIZE][M_SIZE];
    int n, v_id, v_degree, adj_v;
    cin >> n;

    // init
    for (int i = 0; i < n; ++i) 
    {
        for (int j = 0; j < n; ++j) 
        {
            adj_M[i][j] = 0;
        }
    }


    for (int i = 0; i < n; ++i) 
    {
        cin >> v_id >> v_degree;
        v_id--;
        for (int j = 0; j < v_degree; ++j) 
        {
            cin >> adj_v;
            adj_v--;
            adj_M[v_id][adj_v] = 1;
        }
    }

    for (int i = 0; i < n; ++i) 
    {
        for (int j = 0; j < n; ++j) 
        {
            if (j) cout << " ";
            cout << adj_M[i][j];
        }
        cout << endl;
    }
}

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

int N;
int G[110][110];
int main(){
	while(cin >> N && N>0){
		vector<vector<int> > g(110,vector<int>(110,0));
		int u,k;
		for(int i=0;i<N;i++){
			cin >> u >> k;
			for(int j=0;j<k;j++){
				int a;
				cin >> a;
				g[u-1].push_back(a); 
			}
		}
		for(int i=0;i<N;i++){
			for(int j=0;j<g[i].size();j++){
				int f = g[i][j];
				G[i][f-1] = 1;
			}
		}
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				if(j!=N-1){
				cout << G[i][j] << " ";
				}else{
					cout << G[i][j] << endl;
				}
			}
		}
	}
}

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

#define N 100

int main() {
  int n;
  cin >> n;

  int G[N + 1][N + 1];
  for ( int i = 0; i <= n; i++ ) {
    for ( int j = 0; j <= n; j++ ) {
      G[i][j] = 0;
    }
  }

  for ( int i = 1; i <= n; i++ ) {
    int a, b;
    cin >> a >> b;
    for ( int j = 1; j <= b; j++ ) {
      int c;
      cin >> c;
      G[a][c] = 1;
    }
  }

  for ( int i = 1; i <= n; i++ ) {
    for ( int j = 1; j <= n; j++ ) {
      if ( j > 1 ) printf(" ");
      printf("%d", G[i][j]);
    }
    printf("\n");
  }

  return 0;
}

C++: #include <iostream>
#include <stdio>

using namespace std;

int main(){
  int g[10010][10010]={};//要素を0で初期化
  int n,a,b,c;
  cin >> n;
  for (int i = 0; i < n; ++i)
   {
     cin >> a >> b ;
     for (int i = 0; i < b; ++i)
     {
       cin >> c;
       g[a-1][c-1]=1;/* code */
     }
   }
   for (int i = 0; i < n; ++i)
   {
     for (int j = 0; j < n; ++i)
     {
      if (j==n-1)
      {
        cout << g[i][j] << endl;
      }else{
        cout << g[i][j] <<" ";
      }
     }
   }

}

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

static const int N = 100;

int main() {

    int n;
    cin >> n;

    int M[N][N];
    int u, k, v;
    for (int i = 0; i < n; ++i) {
        cin >> u >> k;
        --u;
        for (int j = 0; j < k; ++j) {
            cin >> v;
            --v;
            M[u][v] = 1;
        }
    }

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if (j) cout << " ";
            cout << M[i][j];
        }
        cout << endl;
    }

    return 0;
}

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

int main(){
        int N;
        cin >> N;
        int a[110][110]={{0}};
        for(int i=0; i<N; i++){
                int v,n;
                cin >> v;
                cin >> n;
                for(int j=0; j<n; j++){
                        int V;
                        cin >> V;
                        a[v-1][V-1]=1;
                }
        }
        for(int i=0; i<N; i++){
                for(int j=0; j<N; j++){
                        cout << a[i][j];
                        if(j!=N)cout << " ";
                }
                cout << endl;
        }
}

C++: #include<stdio.h>
#define N 100
int main(){
  int a[N][N],v[N];
  int n,i,j,u,k;

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      a[i][j]=0;
    }
  }

  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d %d",&u,&k);
    if(k!=0)for(j=1;j<=k;k++){
	scanf("%d",&v[j]);
	a[u][v[j]]=1;
      }
  }

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      printf("%d",a[i][j]);
      printf(" ");
    }
    printf("\n");
  }

  
  return 0;
}

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

const int Max = 105;
int G[Max][Max];
int u, k, v[Max], n;

int main()
{
    cin >> n;
    for(int i=0; i<n; i++)
    {
        cin >> u >> k;
        for(int j=0; j<k; j++)
        {
            cin >> v[j];
            G[i][v[j]-1] = 1;
        }
    }
    for(int i=0; i<n; i++)
    {
        cout << G[i][0];
        for(int j=1; j<n; j++)
        {
            cout << " " << G[i][j];
        }
        cout << endl;
    }
    return 0;
}