Go: package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}
	matrix := make([][]int, n)
	for i := 0; i < n; i++ {
		matrix[i] = make([]int, n)
		id, err := nextInt(sc)
		if err != nil {
			panic(err)
		}
		vNum, err := nextInt(sc)
		if err != nil {
			panic(err)
		}
		for j := 0; j < vNum; j++ {
			v, err := nextInt(sc)
			if err != nil {
				panic(err)
			}
			matrix[id-1][v-1] = 1
		}
	}
	for i := 0; i < n; i++ {
		printRow(matrix[i])
	}
}

func printRow(row []int) {
	xs := make([]string, len(row))
	for i := 0; i < len(row); i++ {
		xs[i] = strconv.Itoa(row[i])
	}
	fmt.Println(strings.Join(xs, " "))
}

func nextInt(sc *bufio.Scanner) (int, error) {
	sc.Scan()
	return strconv.Atoi(sc.Text())
}

C++: #include <stdio.h>

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

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 <bits/stdc++.h>
using namespace std;

int main(){

  int t[111][111];

  memset(t,0,sizeof(t));
  int n;
  cin >> n;

  for(int i = 0; i < n; i++){
    int a, b;
    cin >> a >> b;
    for(int j = 0; j < b; j++){
      int c;
      cin >> c;
      t[a][c] = 1;
    }
  }

  for(int i = 1; i <= n; i++){
    for(int j = 1; j <= n; j++){
      if(j != n)
      cout << t[i][j] << " ";
      else 
	cout << t[i][j];

    }
    cout << endl;
  }


}

C++: #include <iostream>

using namespace std;

static const int N = 100;
static int M[N + 1][N + 1] = {}, p[N + 1] = {};

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

  int number, count, value;
  for (int i = 0; i < n; i++) {
    cin >> number >> count;
    for (int j = 0; j < count; j++) {
     cin >> value;
     M[number - 1][value - 1] = 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;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vl vector<ll>
#define pl pair<ll,ll>
#define rep(i,b) for(ll i=0;i<b;i++)
#define all(v) (v).begin(),(v).end()

ll G[100][100];

int main() {
    ll n,k,u;cin>>n;
    rep(i,n){
        cin>>k>>k;
        rep(j,k){
            cin>>u;
            u--;
            G[i][u]=1;
        }
    }
    rep(i,n){
        rep(j,n){
            cout<<G[i][j];
            if(j<n-1)cout<<" ";
        }
        cout<<endl;
    }
}

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

int n;
int M[101][101];
int main() {
    cin >> n;

    for (int i = 0; i < n; ++i) {
        int v, k;
        cin >> v >> k;
        for (int j = 0; j < k; ++j) {
            int s;
            cin >> s;
            M[v][s] = 1;
        }
    }

    for (int l = 1; l <= n; ++l) {
        for (int i = 1; i <= n; ++i) {
            cout << M[l][i] << " " ;
        }
        cout << endl;
    }

    return 0;
}

C++: #include<iostream>
using namespace std;
int v[100];
int main() {
    int n; cin >> n;
    int u, k;
    int a;
    for (int i = 0; i < n; i++) {
        cin >> u >> k;
        for (int j = 0; j < k; j++) {
            cin >> a;
            v[a-1] = 1;
        }
        for (int j = 0; j < n; j++) {
            if (j) cout << " ";
            cout << v[j];
            v[j] = 0;
        }
        cout << endl;
        
    }
    
    return 0;
}

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

int main()
{
	int i,n,u,k;
	int v[100][100];
	cin >> n;
	for(i=0;i<n;i++){
		cin >> u;
		for(j=0;j<u;j++){
			cin >> k;
			cin >>v[i][k];
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			cout << v[i][j] << " ";
		}
		cout<<endl;
	}
}

C++: #include <cstdio>

int main() {
    int n;
    scanf("%d", &n);

    int M[n][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++) {
        int u, degree;
        scanf("%d %d", &u, &degree);
        u--;    // convert to 0 index
        for (int j = 0; j < degree; j++) {
            int v;
            scanf("%d", &v);
            v--;    // convert to 0 index
            M[u][v] = 1;
        }
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (j) { printf(" "); }
            printf("%d", M[i][j]);
        }
        printf("\n");
    }
}

C++: #include <iostream>
#include <cassert>
#include <string.h>
#include <vector>
#include <map>

using namespace std;

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

    vector<vector<int>> matrix;
    for (int i = 0; i < n; ++i)
    {
        vector<int> line;
        for (int j = 0; j < n; ++j)
        {
            line.push_back(0);
        }
        matrix.push_back(line);
    }

    for (int i = 0; i < n; ++i)
    {
        int vertex;
        int degree;

        cin >> vertex;
        cin >> degree;

        assert(vertex <= n);
        assert(degree <= n);

        for (int j = 0; j < degree; ++j)
        {
            int adj;
            cin >> adj;
            assert(adj <= n);
            matrix[vertex - 1][adj - 1] = 1;
        }
    }

    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            string delim = (j == (n - 1)) ? "\n" : " ";
            cout << matrix[i][j] << delim;
        }
    }

    return 0;
}

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

#define N 100

int main(void) {
    int n, u, k, v;
    int A[N + 1][N + 1] = {};
    
    cin >> n;
    
    for(int i = 0; i < n; ++i) {
        cin >> u >> k;
        for(int j = 0; j < k; ++j) {
            cin >> v;
            A[u][v] = 1;
        }
    }
    
    for(int i = 1; i <= n; ++i) {
        cout << A[i][1];
        for(int j = 2; j <= n; ++j) {
            cout << ' ' << A[i][j];
        }
        cout << 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;
      v--;
      M[u][v] = 1;
    }
  }

  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 <iostream>

using namespace std;
int main(){
    int n;
    cin >> n;
    int mat[n][n];
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < n; ++j){
            mat[i][j] = 0;
        }
    }
    for(int i = 0; i < n; ++i){
        int id;
        cin >> id;
        int k;
        cin >> k;
        int v;
        for(int j = 0; j < k; ++j){
            cin >> v;
            mat[id-1][v-1] = 1;
        }
    }
    for(auto x : mat){
        for(int i = 0; i < n; ++i){
            if(i == 0){
                cout << x[i];
            } else {
                cout << ' ' << x[i];
            }
        }
        cout << endl;
    }
}