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 <vector>
#include <cstdio>
using namespace std;

int main()
{
	int n, k, u, v;
	cin >> n;
	// N * N matrix filled with 0
	vector< vector<int> > mat(n, vector<int>(n, 0));

	for(int i=0; i<n; i++){
		cin >> u >> k;
		// adjust 0 origen
		u--;
		for(int j=0; j<k; j++){
			cin >> v;
			//cout << "vertex: " << v << '\n';
			// adjust 0 origen
			v--;
			mat[u][v] += 1;
		}
		//cout << '\n';
	}

	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			if(j==0) printf("%d", mat[i][j]);
			else printf(" %d", mat[i][j]);
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
    int n,x,y,z;
    cin>>n;
    int a[n+1][n+1];
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            a[i][j]=0;
        }
    }
    for(int i=0;i<n;i++){
        cin>>x>>y;
        if(y!=0){
            for(int j=0;j<y;j++){
                cin>>z;
                a[x][z]=1;
            }
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<n;j++){
            cout<<a[i][j]<<" ";
        }
        cout<<a[i][n]<<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<algorithm>

using namespace std;

int main(){
    int n;
    cin>>n;
    int g[n+1][n+1];

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

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
const int N=100;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,a[N][N];
	CLR(a);
	cin >> n;
	FOR(i,0,n){
		int k,l;
		cin >> k >> l;
		FOR(j,0,l){
			int m;
			cin >> m;
			++a[i][m-1];
		}
	}
	FOR(i,0,n){
		FOR(j,0,n){
			if(j!=0)cout << " ";
			cout << a[i][j];
		}
		cout << endl;
	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   for(int i=0;i<(n);++i)
#define SORT(c)    sort((c).begin(),(c).end())
#define CLR(a)     memset((&a), 0 ,sizeof(a))//clear memory
#define dump(x)    cerr << #x << " = " << (x) << endl;//debug
#define debug(x)   cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define EPS        1e-10//sample:if((double)>=(double)+EPS)
//cin,cout release
//std::cin.tie(0);
//ios::sync_with_stdio(false);

using namespace std;



int main(){
  int n;
  cin>>n;
  int a[105][105]={};
  int s,t,u;
  //int maxs=INT_MIN,maxu=INT_MIN;
  rep(i,n){
    cin>>s>>t;
    rep(j,t){
      cin>>u;
      a[s][u]=1;
      //u=max(maxu,u);
    }
    //s=max(maxs,s);
  }
  //int maxn=max(maxs,maxu);
  
  rep(i,n){
    rep(j,n){
      cout<<a[i+1][j+1];
      if(j!=n-1)cout<<" ";
    }cout<<endl;
  }
  

  return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<vector<int> > a(n + 1, vector<int>(n + 1, 0));
    for (int i = 1; i <= n; i++) {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; j++) {
            int v;
            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 << endl;
    }
    return 0;
}

C++: #include <stdio.h>

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

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 graph[100][100] = {};
	int n;
	cin >> n;
	for(int i = 0;i < n;i++){
		int now,m;
		cin >> now >> m;
		for(int j = 0;j < m;j++) {
			int t;
			cin >> t;
			graph[now - 1][t - 1] = 1;
		}
	}
	for(int i = 0;i < n;i++){
		cout << graph[i][0];
		for(int j = 1;j < n;j++){
			cout << " " << graph[i][j];
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <cstdlib>
#include <queue>
#include <vector>
#include <set>
bool a[100][100];
using namespace std;
int main() {
	int n,m,l,p;
	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 >> m;
		cin >> l;
		for(int j = 0; j < l;j++) {
			cin >> p;
			a[m-1][p-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;
	}
}