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 mat[101][101];

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

C++: #include <bits/stdc++.h>
using namespace std;
// #define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
#define ITR(v,c) for(auto v=begin(c);v!=end(c);v++)
#define FORE(x,c) for(auto &x:c)
#define FOR(v,a,n) for(int v=a;v<(int)(n);v++)
#define REP(v,n) FOR(v,0,n)
#define RREP(v,n) for(int v=((int)(n)-1);v>=0;v--)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define SZ(c) ((int)c.size())
const int DX[9]={0,1,0,-1,1,1,-1,-1,0}, DY[9]={-1,0,1,0,-1,1,1,-1,0};
const int INF=1e9; const long long INFLL=1e18;
template<class T> ostream& operator << (ostream &os, const vector<T> &v) {
    ITR(i,v) os<<*i<<(i==end(v)-1?"":" "); return os; }
template<class T> istream& operator >> (istream &is, vector<T> &v) {
    ITR(i,v) is>>*i; return is; }
//------------------------------------------------------------------------------

signed main() {
    int n;
    cin>>n;
    vector<vi> a(n);
    REP(i,n) {
        int m;
        cin>>m>>m;
        REP(j,m) {
            int v;
            cin>>v;
            a[i].push_back(v-1);
        }
    }

    REP(i,n) {
        REP(j,n) {
            cout<<(find(ALL(a[i]),j)!=end(a[i]));
            if(j!=n-1) cout<<" ";
            else cout<<endl;
        }
    }
    return 0;
}

C++: // 無向グラフの作成

#include <iostream>
#include <algorithm>
using namespace std;
static const int N = 100; // 配列の最大次元

int main() {
	int M[N][N]; // 0オリジンの隣接配列
	int n, u, k, v;

	cin >> n;

	// 隣接配列を0で初期化
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) M[i][j] = 0;
	}


	// 無向グラフを作成する(u-v間に辺を張る、配列番号u-vに1を立てる)
	for (int i = 0; i < n; i++) {
		cin >> u >> k; // 頂点番号u, 出次数k
		u--;
		for (int j = 0; j < k; j++) {
			cin >> v; // 隣接ノード追加
			v--; // 0オリジンへ変換
			M[u][v] = 1; // uとvの間に辺を張る
		}
	}

	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 <stdio.h>

int map_max;
int map[100][100];
int rows;
int cols[100];
int mat[100][100];

void get_map();
void print_map();
void conv_map();
void print_mat();

int main()
{

  get_map();
  //print_map();
  conv_map();
  print_mat();
  return 0;
}

void get_map()
{

  int k;
  scanf("%d", &map_max);//<100

  for(int i=0;i<map_max;i++)
    {
      scanf("%d", &k);
      scanf("%d", &cols[i]);
      for(int j=0;j<cols[i];j++)
	{
	  map[i-1][j-1]=0;
	  scanf("%d", &map[i-1][j-1]);
	}
    }

  
  return ;
}

void print_map()
{
  for(int i=0;i<map_max;i++)
    {
      for(int j=0;j<cols[i];j++)
	{
	  printf("%d", map[i-1][j-1]);
	}
      puts("");
    }
return ;
}


void conv_map()
{
  for(int i=0;i<map_max;i++)
    {
      for(int j=0;j<cols[i];j++)
	{
	  mat[i][map[i-1][j-1]-1]=1;
	}
    }
  return ;
}

void print_mat()
{
  for(int i=0;i<map_max;i++)
    {
      for(int j=0;j<map_max;j++)
	{
	  printf("%d ", mat[i][j]);
	}
      puts("");
    }
}

C++: #include <iostream>

using namespace std;



int main(){

  int n,u,k,x;
  int array[124][124] = {{}};
  cin >> n;



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