Go: package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	g := make([][]int, N)
	for i, _ := range g {
		g[i] = make([]int, N)
	}
	for i := 0; i < N; i++ {
		u, k := sc.nextInt(), sc.nextInt()
		for j := 0; j < k; j++ {
			g[u-1][sc.nextInt()-1] = 1
		}
	}

	for _, r := range g {
		for i, num := range r {
			if i > 0 {
				fmt.Fprint(wtr, " ")
			}
			fmt.Fprint(wtr, num)
		}
		fmt.Fprintln(wtr)
	}
	wtr.Flush()
}

C++: #include <iostream>
using namespace std;
//using ll = long long;

int main(void) {
  int n; int i, j;
  cin >> n; //頂点の数
  int adj[n+1][n+1]; //隣接リスト
  for (i = 1; i < n+1; i++)
    for (j = 1; j < n+1; j++)
      adj[i][j] = 0;
  
  for (i = 1; i <= n; i++) {
    int u, k;
    cin >> u >> k;
      for (j = 1; j <= k; j++) {
        int m;
        cin >> m;
        adj[u][m]++;
      }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      cout << adj[i][j] ;
      if (j != n) cout << " ";
    }
    cout << endl;
  }
}

C++: #include <iostream>
#include <vector>
#include <numeric>

using namespace std;

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

    vector<bool> A(n*n);
    fill(A.begin(), A.end(), false);

    for (int32_t i = 0; i < n; i++) {
        int32_t u, k;
        cin >> u >> k;

        for (int32_t j = 0; j < k; j++) {
            int32_t v;
            cin >> v;

            A[(u-1)*n+(v-1)] = true;
        }
    }

    for (int32_t i = 0; i < n; i++) {
        cout << A[i*n];
        for (int32_t j = 1; j < n; j++) {
            cout << " " << A[i*n+j];
        }
        cout << endl;
    }

    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int N;
  bool info[100][100] = {{}};
  cin >> N;
  for(int i = 0; i < N; i++){
    int u, k;
    cin >> u >> k;
    while(k--){
      int v;
      cin >> v;
      info[u - 1][v - 1] = true;
    }
  }
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      cout << info[i][j] << (j + 1 == N ? '\n' : ' ');
    }
  }
}

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

int main(){
  int n,u,k,v;
  int A[101][101];

  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>>u;
    cin>>k;
    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;j++){
      if(j!=0) cout<<" ";
      cout<<A[i][j];
    }
    cout<<endl;
  }
  
  return 0;
}

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


int main()
{
    int n, m[101][101] = {0};
    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;
            m[u][v] = 1;
        }
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++) {
            if(j != 1) cout << " ";
            cout << m[i][j];
        
        }
        cout << endl;
    }
    
    
    
    
    return 0;
}

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

struct Node{
    int k;int u;
};

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

C++: #include <iostream>
using namespace	std;
int main(){

  int n,graph[100][100]={},a,b,tmp;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a>>b;
    for(int j=0;j<b;j++){
      cin>>tmp;
      graph[a-1][tmp-1]=1;
    }
  }

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

  return 0;

}

C++: #include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>

using namespace std;
    
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <limits>
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<vector<int>> vec(n);
    vector<int> SIZE;
    for(int i=0;i<n;i++){
        int x;
        cin >> x;
        int num;
        cin >> num;
        SIZE.push_back(num);
        for(int j = 0;j< num;j++){
            int y;
            cin >> y;
            vec[x-1].push_back(y-1) ;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            bool hantei=0;
            for(int k=0;k<SIZE[i];k++){
                if(vec[i][k]==j) {cout << 1 <<" "; hantei=1;}
            }
            if(hantei==0) cout <<0<<" ";
        }cout << endl;
    }cout << endl;
}cout << endl;

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

int G[110][110] ={0};

int main(){
  int n;
  cin >> n;
  int u, k;
  int v[100000];
  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;
    }
  }
  for(int i=0; i<n; i++){
    for(int j=1; j<n+1; j++){
      cout << G[i][j] << " ";
    }
    cout << endl;
  }
    
    
}

C++: #include <iostream>
#include <algorithm>
#include <stack>
#include <string>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <map>
#define INFTY (1<<30)
#define MAX 100000000

using namespace std;

int main() {
	int n, m[100][100] = {};
	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;
			m[i][v] = 1;
		}
	}
	for( int i = 0; i < 100; i++) {
		for( int j = 0; j < 100; j++) {
			cout << m[i][j] << ' ';
		}
		cout << endl;
	}

    return 0;
}