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 <cstdio>
#include <vector>

int main(){
	std::vector< std::vector<int> > M;
	int n, r, k, c;
	scanf("%d", &n);
	M.resize(n);
	for (int i=0;i<n;i++){
		M[i].resize(n);
		scanf("%d %d", &r, &k);
		for (int j=0; j<k;j++){
			scanf("%d", &c);
			M[i][c-1]=1;
		}
	}
	for (int i=0;i<n;i++){
		for (int j=0;j<n;j++){
			printf("%d", M[i][j]);
                        if (j!=n-1) printf(" ");
		}
		printf("\n");
	}
	return 0;
}

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

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

int main(){
  int a,m[101][101],b,c,d;
  cin >> a;
  for(int i=1;i<=a;i++){
    for(int j=1;j<=a;j++){
      m[i][j]=0;
    }
  }
  for(int i=1;i<=a;i++){
    cin >> b >> c;
    for(int j=0;j<c;j++){
      cin >> d;
      m[i][d]=1;
    }
  }
  for(int i=1;i<=a;i++){
    for(int j=1;j<=a;j++){
      cout << m[i][j];
    }
    cout << endl;
  }
  return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
  int n,u,m,c;
  int b[1000][1000] = {};
  int a[1000][1000] = {};

  cin >> n;//点の数を入力する

  for(int i = 1;i <=n ;i++){
    cin >> u >> m;//次数を入力する
    for(int j = 1;j <= m;j++){
      cin >> b[u][j];//b[点の番号][接続先]
    }
  }

  for(int i = 1;i <= n;i++){
    for(int j = 1;j <= n;j++){
      if(b[i][j] != 0){
	c = b[i][j];
	a[i][c] = 1;
      }
      if(j != n){
	cout << a[i][j] << " ";
      }else{
	cout << a[i][j] << endl;
      }
    }
  }
  return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#pragma warning(disable:4996)
int main()
{
	int u, k, n, v;
	int i, j;
	int matrix[100][100] = {0};

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


	return 0;

}

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

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

C++: #include <iostream>

#define MAX 110
using namespace std;

int main(){
    int num; cin >> num;
    int matrix[MAX][MAX];
    for(int i=0;i<MAX;i++){
        for(int j=0;j<MAX;j++){
            matrix[i][j] = 0;
        }
    }
    for(int i=1;i<=num;i++){
        int v; cin >> v;
        int tmp; cin >>tmp;
        for(int j=0;j<tmp;j++){
            int vi; cin >> vi;
            matrix[v-1][vi-1] = 1;
        }
    }
    for(int i=0;i<num;i++){
        for(int j=0;j<num;j++){
            if(j==0)
                cout << matrix[i][j];
            else
                cout << " " << matrix[i][j];
        }
        cout << endl;
    }
}

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

#define N 100

int main() {
  int i, j, n, u, k, v;
  int A[N+1][N+1];  // 隣接行列

  cin >> n;
    
  // 初期化
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      A[i][j] =  0;
    }
  }    

  // 隣接行列表現に直す
  for (i = 0; i < n; i++) {
    cin >> u >> k;
    for (j = 0; j < k; j++) {
      cin >> v;
      A[u][v] = 1;
    }
  }

  // 出力
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if (j > 1) cout << " ";
      cout << A[i][j];
    }
    cout << endl;
  }

  return 0;
}

C++: #include <iostream>
#define N 110

int main(){
  int A[N][N];
  int n;
  std::cin >> n;

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

  return 0;
}

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

void fnInput(vector<vector<int>> &rvvnAdjcy)
{
  int nMaxSiz;
  cin >> nMaxSiz;

  rvvnAdjcy.resize(nMaxSiz + 1, vector<int>(nMaxSiz + 1, 0));
  for (int i = 0; i < nMaxSiz; i++)
  {
    int nx, nSecSiz;
    cin >> nx >> nSecSiz;
    for (int j = 0; j < nSecSiz; j++)
    {
      int ny;
      cin >> ny;
      rvvnAdjcy[nx][ny] = 1;
    }
  }
}

void fnResult(const vector<vector<int>> &cnrvvnAdjcy)
{
  for (int i = 1; i < cnrvvnAdjcy.size(); i++)
  {
    for (int j = 1; j < cnrvvnAdjcy[i].size(); j++)
    {
      if (j != 1) cout << " ";
      cout << cnrvvnAdjcy[i][j];
    }
    cout << endl;
  }
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<vector<int>> vvnAdjcy;

  fnInput(vvnAdjcy);
  fnResult(vvnAdjcy);

  return 0;
}

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

int A[100][100];

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

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;
            M[u][v] = 1;
        }
    }

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