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 <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define rep(i, n) for (int i = 0; i < n; i++)

using namespace std;

const int INF = 1 << 30;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100;

int M[N][N];

int main() {
	int n; cin >> n;
	rep(i, n) rep(j, n) M[i][j] = 0;
	rep(i, n) {
		int _n, n2; cin >> _n >> n2;
		rep(j, n2) {
			int k; cin >> k;
			M[i][k-1] = 1;
		}
	}
	rep(i, n) {
		rep(j, n) {
			if (j < n-1) cout << M[i][j] << ' ';
			else cout << M[i][j];
		}
		cout << endl;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define RF(i,L,R) for (int i = L; i > R; i--)
#define RFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define ll long long
#define INF 2000000000
#define nINF -2000000000
#define MOD 1e9+7
#define PI 3.1415926535897932384626
bool matrix[1005][1005];
int main(){
	//freopen("test.out","w",stdout);
	int n;
	scanf("%d",&n);
		int maxV=-INF;
		while(n--){
			VgetII(u,k);
			if(u>maxV) maxV=u;
			while(k--){
				VgetI(to);
				if(to>maxV) maxV=to;
				matrix[u-1][to-1]=1;
			}
		}
		F(i,0,maxV){
			F(j,0,maxV) j==maxV-1?printf("%d\n",matrix[i][j]):printf("%d ",matrix[i][j]);
			//if(i!=maxV-1) puts("");
		}
	//fclose(stdout);
}

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

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;

}