Go: package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())
	Adj := make([][]int, n)
	for i := range Adj {
		Adj[i] = make([]int, n)
	}
	for i := 0; i < n; i++ {
		scanner.Scan()
		u, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
		k, _ := strconv.Atoi(scanner.Text())
		if k == 0 {
			continue
		}
		for i := 0; i < k; i++ {
			scanner.Scan()
			v, _ := strconv.Atoi(scanner.Text())
			Adj[u-1][v-1] = 1
		}
	}
	for i := range Adj {
		for j := range Adj[i] {
			if j == n-1 {
				fmt.Printf("%d\n", Adj[i][j])
				continue
			}
			fmt.Printf("%d ", Adj[i][j])
		}
	}
}

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

using namespace std;

int main(){
  int n;
  cin >> n;
  int i;
  int a[150][150];
  int x,y;
  for (x = 0; x < n; x++) {
    for (y = 0; y < n; y++) {
      a[x][y]=0;
    }
  }

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

  }

  for (x = 0; x < n; x++) {
    for (y = 0; y < n; y++) {
      printf("%d ",a[x][y]);
    }printf(" ");
  }

  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int a[101][101]={};
  int n,u,k,v;
  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=0;i<n;i++){
    for(int j=0;j<n-1;j++)
      cout<<a[i+1][j+1]<<' ';
    cout<<a[i+1][n]<<endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 1; i <= n; i++)

int main() {
    int n;
    scanf("%d", &n);
    int a[n+1][n+1];
    rep(i, n) {
        rep(j, n) {
            a[i][j] = 0;
        }
    }
    rep(i, n) {
        int u;
        scanf("%d", &u);
        int k;
        scanf("%d", &k);
        rep(j, k) {
            int v;
            scanf("%d", &v);
            a[u][v] = 1;
        }
    }
    rep(i, n) {
        rep(j, n) {
            printf("%d", a[i][j]);
            if (j != n) printf(" ");
        }
        printf("\n");
    }
}

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

int main(){
  int i,j,u,k,v,n,d[101][101]={0};
  cin >> n;
  for(i = 0; i < n; i++){
    cin >> u >> k;
    for(j = 0; j < k; j++){
      cin >> v;
      d[u][v]=1;
    }
  }
  for(i = 1; i <= n; i++){
    for(j = 1; j <= n; j++){
      if(j==n){
      cout << d[i][j];
      }else{
      cout << d[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;
    for(int i=0;i<n;i++)
    {
        int j,num;
        cin>>j>>num;
        for(int a=0;a<num;a++)
        {
            int k;
            cin>>k;
            M[j-1][k-1]=1;
        }
    }
    //print
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            cout<<M[i][j];
            if(j==n-1) cout<<endl;
            else cout<<" ";
        }
    }

}

C++: #include <iostream>
using namespace std;
int main(){
  int n,u[100],k[100]={},v[100][100];
  cin >> n;
  for(int i=0; i<n; i++){
    cin >> u[i] >> k[i];

    for(int j=0; j<k[i]; j++)
      cin >> v[i][j];
  }

  for(int i=0; i<n; i++){
    int count=0;
    for(int j=0; j<n; j++){
      if(v[i][count]==j+1){
        cout << 1;
        count++;
      }

      else
        cout << 0;

      if(j!=n)
        cout << " ";
      }

      cout << endl;
    }
  }

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

using Graph = std::vector<std::vector<uint32_t>>;

int main() {
  uint32_t n = 0;
  std::cin >> n;
  Graph G(n + 1);
  for (size_t i = 1; i <= n; i++) {
    uint32_t k = 0;
    std::cin >> i >> k;
    if (k > 0) G[i] = std::vector<uint32_t>(k);
    for (size_t j = 0; j < k; j++) std::cin >> G[i][j];
  }

  Graph mat(n + 1, std::vector<uint32_t>(n + 1, 0));
  for (size_t i = 1; i < G.size(); i++) {
    for (size_t j = 0; j < G[i].size(); j++) mat[i][G[i][j]] = 1;
  }

  for (size_t i = 1; i < mat.size(); i++) {
    for (size_t j = 1; j < mat[i].size(); j++) {
      std::cout << mat[i][j] << (j + 1 == mat[i].size() ? "" : " ");
    }
    std::cout << std::endl;
  }

  return 0;
}

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

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

C++: #include<stdio.h>
int main(){
int i,j,n,s,t,u,g[100][100];
scanf("%d",&n);
for(i=0;i<n;i++){
  for(j=0;j<n;j++){
  g[i][j]=0;
}
}
for(i=0;i<n;i++){
  scanf("%d%d",&s,&t);
  for(j=0;j<t;j++){
    scanf("%d",&u);
    g[s-1][u-1]=1;
  }
}
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j!=0)printf(" ");
    printf("%d",g[i][j]);
  }
  printf("\n");
}
}

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

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

  for(auto i = 0; i < n + 1; i++){
    for(auto j = 0; j < n + 1; j++){
      mat[i][j] = 0;
    }
  }

  for(auto i = 1; i <= n; i++){
    int vertex, dimout;
    cin >> vertex >> dimout;

    vector<int> adjvertices(dimout);
    for(auto j = 0; j < dimout; j++){
      cin >> adjvertices[j];
      mat[vertex][adjvertices[j]] = 1;
    }
  }

  for(auto i = 1; i <= n; i++){
    for(auto j = 1; j <= n; j++){
      cout << mat[i][j];
      if(j != n) cout << " ";
    }
    cout << endl;
  }
}