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>
#include<cstdio>
#include<string>
#include<algorithm>

using namespace std;

//??\???????????????
//4
//1 2 2 4
//2 1 4
//3 0
//4 1 3

bool Path[101][101] = {false};

int main(){
    int  N;
    cin >> N;
    int bb;
    for (int i = 1; i <= N; i++) {
        int K;
        scanf("%d %d",&bb,&K);
        for (int k = 0; k < K; k++) {
            int p;
            scanf("%d",&p);
            
            Path[i][p] = true;
        }
    }
    
    for (int r = 1; r <= N; r++) {
        for (int c = 1; c <= N; c++) {
            printf("%d ",Path[r][c]);
        }
        printf("\n");
    }
    return 0;
}

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

int main() {
	int n, u, k, x;
	int matrix[101][101] = {};

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

C++: #include<bits/stdc++.h>
using namespace std;
int g[101][101];
int main(void){
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    int u,k;
    cin>>u>>k;
    for(int j=0;j<k;j++){
      int v;
      cin>>v;
      g[u][v]=1;
    }
  }
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      cout<<g[i][j]<<" \n"[j==n];
    }
  }
  return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
static const int MAX  = 100;
int main ()
{
  int n,u,k,v;
  cin>>n;
  int M[MAX][MAX];
  for(int i  = 0;i<n;i++)
    {
      for(int j = 0;j<n;j++)
        {
          M[i][j] = 0;
        }
    } 
  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<<" ";
         else cout<<M[i][j];
     }
     cout<<endl;
   }
  return 0 ;
}

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

#define N_MAX 100

int main() {
    long n, v, deg_out, e;
    cin >> n;

    long G[N_MAX][N_MAX] = {};

    for (long i = 0; i < n; i++) {
        cin >> v >> deg_out;
        for (long j = 0; j < deg_out; j++) {
            cin >> e;
            G[v - 1][e - 1] = 1;
        }
    }

    for (long i = 0; i < n; i++) {
        for (long j = 0; j < n; j++) {
            if (j != 0) { cout << " "; }
            cout << G[i][j];
        }
        cout << endl;
    }

    return 0;
}

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

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

C++: #include<cstdio>
#include<iostream>
using namespace std;
const int MAXN = 100+10 ;

int a[MAXN][MAXN];

int main(void)
{
    int n,u,v,t;
    cin>>n;
    for(int i = 1; i <= n; ++i)
    {
        cin>>u>>t;
        for(int j = 1; j <= t; ++j)
        {
            cin>>v;
            a[u][v] = 1;
        }
    }
    for(int i = 1; i <= n; ++i)
    {
        for(int j = 1; j < n; ++j)
        {
            cout<<a[i][j]<<' ';
        }
        cout<<a[i][n]<<'\n';
    }
}

C++: #include <iostream>
#include <vector>
using namespace std;
vector<vector<int>> adjlist;
vector<vector<int>> adjmatrix;
void input(int n){
  for(int i=0;i<n;i++){
    vector<int> list;
    int ln;
    cin>>ln;
    list.push_back(ln);
    cin>>ln;
    list.push_back(ln);
    for(int j=0;j<ln;j++){
      int an;
      cin>>an;
      list.push_back(an);
    }
    adjlist.push_back(list);
  }
}

void mk_am(int n){
  adjmatrix=vector<vector<int>>(n,vector<int>(n,0));
  for(vector<int> list:adjlist){
    for(int i=0;i<list[1];i++){
      adjmatrix[list[0]-1][list[2+i]-1]=1;
    }
  }
}
 
void print(int n){
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      cout<<adjmatrix[i][j];
      if(j!=n-1) cout<<' ';
    }
    cout<<endl;
  }
}
int main(){
  int n;
  cin>>n;
  input(n);
  mk_am(n);
  print(n);
  return 0;
}

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

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

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

int main()
{
    int M[N][N];
    int n,u,k,v;
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            M[i][j]=0;
        }
    }
    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>
#define SIZE 100

using namespace std;

int main(void) {

	int n, c, v;
	int G[SIZE][SIZE];
	int A[SIZE][SIZE];

	cin >> n;

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

	for (int i = 0; i < n; i++) {
		cin >> v;
		cin >> c;
		for (int j = 0; j < c; j++) {
			cin >> G[i][j];
			int tmp = G[i][j];
			if (tmp > 0) {
				A[i][tmp - 1] = 1;
			}
		}
	}

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

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

int main() {
	int verNum;
	int vertexs[100][100];

	for (int i = 0; i < 100; i++)
		for (int j = 0; j < 100; j++)
			vertexs[i][j] = 0;
	cin >> verNum;
	for (int i = 0; i < verNum; i++) {
		int num; cin >> num; num--;
		int outNum;	cin >> outNum;
		for (int j = 0; j < outNum; j++) {
			int outVertex; cin >> outVertex;
			vertexs[i][--outVertex] = 1;
		}
	}

	for (int i = 0; i < verNum; i++) {
		for (int j = 0; j < verNum; j++) {
			if (j) cout << " ";
			cout << vertexs[i][j];
		}
		cout << endl;
	}
	return 0;
}