Go: package main

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

const N = 100

func answer(reader io.Reader) string {
	sc := bufio.NewScanner(reader)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())

	var M [N][N]int
	for i := 0; i < n; i++ {
		sc.Scan()
		u, _ := strconv.Atoi(sc.Text())
		sc.Scan()
		k, _ := strconv.Atoi(sc.Text())
		u--
		for j := 0; j < k; j++ {
			sc.Scan()
			v, _ := strconv.Atoi(sc.Text())
			v--
			M[u][v] = 1
		}
	}

	var out bytes.Buffer
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if j != 0 {
				out.WriteString(" ")
			}
			out.WriteString(fmt.Sprintf("%d", M[i][j]))
		}
		out.WriteString("\n")
	}

	return strings.TrimRight(out.String(), "\n")
}

func main() {
	fmt.Println(answer(os.Stdin))
}

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++){
      cout << " " << array[i][j];
    }
    cout << endl;
  }
}

C++: #include<cstdio>
int m[101][101];

int main(){
	int i,n,j,k,u,v;
	scanf("%d",&n);
	v = n;
	while(n--){
		scanf("%d",&u);
		scanf("%d",&j);
		while(j--){
			scanf("%d",&i);
			m[u][i] = 1;
		}
	}
	for( i = 1; i <= v; i++ ){
		for( j = 1; j <= v; j++ ){
			if(j!=1) printf(" ");
			printf("%d",m[i][j]);
		}
		printf("\n");
	}
}

C++: #include<cstdio>


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

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

const static int N = 100;

int main() {
  int n, G[N][N];
  
  cin >> n;

  for ( int i = 0; i < n; i++ ) {
    for ( int j = 0; j < n; j++ ) G[i][j] = 0;
  }

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

  for ( int i = 0; i < n; i++ ) {
    for ( int j = 0; j< n; j++ ) {
      cout << G[i][j] << " ";
    }
  cout << endl;
  }

  return 0;    
}

C++: 

#include <iostream>
using namespace std;

int main(){
        int n,m,l,i,j;
        cin >> n;
        int f[100][100] =
        for ( i = 0; i < n; i++){
                cin >> m;
                for ( j = 0; j < m; j++){
                        cin >> l;
                        f[m][l] = 1;
                }
        }
        for ( i = 0; i < n; i++){
                for ( j = 0; j < n-1; j++){
                        cout << f[i][j] << " ";
                }
                cout << f[i][n] << endl;
        }
}

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

int main(){
    int n;
    std::cin >> n;
    std::vector<std::vector<int>> adj(n, std::vector<int>(n, 0));
    for(int i=0;i<n;i++){
        int unused, k;
        std::cin >> unused >> k;
        for(int j=0;j<k;j++){
            int p;
            std::cin >> p;
            adj[i][p-1]=1;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            std::cout << adj[i][j];
            if(j==(n-1)) std::cout << "\n";
            else std::cout << " ";
            
        }
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(void) {
	int n, i, j;
	int u, k, v;
	cin >> n;
	int G[n+1][n+1];
	for (i = 1; i <= n; i++) {
		for (j = 0; j <= n; j++) {
			G[i][j] = 0;
		}
	}
	for (i = 0; i < n; i++) {
		cin >> u >> k;
		while (k--) {
			cin >> v;
			G[u][v] = 1;
		}
	}
	for (i = 1; i <= n; i++) {
		for (j = 1; j <= n; j++) {
			if (j != 1) cout << " ";
			cout << G[i][j];
		}
		cout << endl;
	}
}

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;

static const int N = 100;

int main() {
  int M[N][N];

  int n;
  cin >> n;

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      M[i][j] = 0;
    }
  }

  int u, k, v;
  for (int i = 0; i < n; i++) {
    cin >> u >> k;
    for (int j = 0; j < k; j++) {
      cin >> v;
      v--; // to 0 origin
      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>
#include <vector>

using namespace std;

int main(void) {
	int n;
	cin >> n;
	vector<vector<int>> matricies(n, vector<int>(n, 0));
	while(n--) {
		int u, k;
		cin >> u >> k;
		while(k--) {
			int v;
			cin >> v;
			matricies.at(u-1).at(v-1) = 1;
		}
	}

	for (int i = 0; i < matricies.size(); i++) {
		for (int j = 0; j < matricies.at(0).size(); j++) {
			if (j == matricies.at(0).size() - 1) cout << matricies.at(i).at(j) << endl;
			else cout << matricies.at(i).at(j) << " ";
		}
	}
}

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

using namespace std;

int main(void){

  int graph[100][100];
  for( int i = 0 ; i < 100 ; i++ )
    for( int j = 0 ; j < 100 ; j++ )
      graph[i][j] = 0;

  int n;
  cin >> n;
  for( int i = 0 ; i < n ; i++ ){
    int u, k;
    cin >> u >> k;
    u--;
    while( k-- ){
      int v;
      cin >> v;
      v--;
      graph[u][v] = 1;
    }
  }
  for( int i = 0 ; i < n ; i++ ){
    for( int j = 0 ; j < n ; j++ ){
      if( j == n - 1 ) cout << graph[i][j] << endl;
      else cout << graph[i][j] << " ";
    }
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int n, u, k, v;
int g[101][101];

int main() {
    cin >> n;

    for (int i = 0; i < n; ++i) {
        cin >> u >> k;
        u--;
        for (int j = 0; j < k; ++j) {
            cin >> v;
            v--;
            g[u][v] = 1;
        }
    }

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

    return 0;
}

C++: #define scanf_s scanf
#include <string>
#include <stdio.h>
#include <math.h>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <iostream>
using namespace std;

#define MAX 100
//#define MAX_ 1000
int time = 0;
int main(void)
{
	int G[MAX][MAX] = { false };
	int n, u, k, v;
	scanf_s("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf_s("%d %d", &u, &k);
		for (int j = 0; j < k; ++j) {
			scanf_s("%d", &v);
			G[u - 1][v - 1] = true;
		}
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (j != 0) printf(" ");
			printf("%d", G[i][j]);
		}
		if (i != n - 1) printf("\n");
	}
}