Go: package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	g := make([][]int, n)

	for i := 0; i < n; i++ {
		g[i] = make([]int, n)
	}

	for i := 0; i < n; i++ {
		u := getNextInt(scanner)
		k := getNextInt(scanner)
		u--
		for ii := 0; ii < k; ii++ {
			v := getNextInt(scanner)
			v--
			g[u][v] = 1
		}
		fmt.Fprintln(writer, joinint(g[u], " "))
	}

	writer.Flush()
}

func joinint(a []int, sep string) string {
	n := len(a)
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		ss[i] = fmt.Sprintf("%d", a[i])
	}
	return strings.Join(ss, sep)
}

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;
}

C++: #include <iostream>

using namespace std;

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

}