Go: package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	g := make([][]int, n)
	for i := 0; i < n; i++ {
		g[i] = make([]int, n)
	}

	for i := 0; i < n; i++ {
		var u,k int
		fmt.Scan(&u)
		fmt.Scan(&k)
		for j := 0; j < k; j++ {
			var v int
			fmt.Scan(&v)
			g[u-1][v-1] = 1
		}
	}

	for i := 0; i < n; i++ {
		fmt.Print(g[i][0])
		for j := 1; j < n; j++ {
			fmt.Printf(" %d", g[i][j])
		}
		fmt.Println()
	}
}

C++: #include <bits/stdc++.h>

#define MAX 101
int G[MAX][MAX];
int V;

int main()
{
    std::scanf("%d", &V);
    int source, E, tmp;

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


    for (int i = 0; i < V; i++) {
        std::scanf("%d %d", &source, &E);
        if (E > 0) {
            for (int j = 0; j < E; j++) {
                std::scanf("%d", &tmp);
                G[source][tmp] = 1;
            }
        }
    }

    for (int i = 1; i <= V; i++) {
        for (int j = 1; j <= V; j++) {
            if (j > 1) std::printf(" ");
            std::printf("%d", G[i][j]);
        }
        std::printf("\n");
    }

    return 0;
}

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

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

C++: #include<iostream>
using namespace std;
int a[1050][1050];
int main()
{
    int n;
    cin>>n;
    for(int p=0;p<n;p++)
    {
        int u,k;
        cin>>u>>k;
        while(k--)
        {
            int x;
            cin>>x;
            a[u][x]=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>
#define N 101

int main() {

  int n,i,k,l,j,u,a[N][N],v[N];
  scanf("%d",&n);
  for(i=1;i<=n;i++) {
    for(j=1;j<=n;j++){
      a[i][j] = 0;
    }
  }

  for(i=0;i<n;i++){
    scanf("%d",&u);
    scanf("%d",&k);
    while(k>0){
      scanf("%d",&l);
      a[u][l] = 1;
      k--;
    }
  }

  for(i=1;i<=n;i++) {
    for(j=1;j<=n;j++){
      printf("%d ",a[i][j]);
    }
    printf("\n");
  }

  
  return 0;
}

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

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

  vector<int> c(n);
  vector<vector<int>> M(n, vector<int>(n));
  for (int i = 0; i < n; i++) {
    int node;
    int d;
    cin >> node >> d;
    node--;

    for (int j = 0; j < d; j++) {
      int tmp;
      cin >> tmp;
      tmp--;
      M[i][tmp] = 1;
    }
  }

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cout << M[i][j];
      if (j != n - 1) { cout << " "; }
    }
    cout << endl;
  }
}

C++: #include <bits/stdc++.h>

#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;

using ll = long long;
using vi = vector<int>;
using vii = vector<vi>;
using vll = vector<ll>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vii A(n, vi(n, 0));

    rep(i, 0, n) {
        int u, k;
        cin >> u >> k;
        rep(j, 0, k) {
            int v;
            cin >> v;
            A[u - 1][v - 1] = 1;
        }
    }

    rep(i, 0, n) {
        rep(j, 0, n) {
            cout << A[i][j];
            if (j != n - 1) { cout << " "; }
            else { 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 <bits/stdc++.h>
using namespace std;
#define r(i,n) for(auto i=0;i<n;i++)
#define s(c) static_cast<int>((c).size())

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

	int A[n][n]{};
	int v1, v2, deg;
	r(i, n){
		cin >> v1 >> deg;
		v1--;

		r(j, deg){
			cin >> v2;
			v2--;
			A[v1][v2] = 1;
		}
	}

	r(i, n){
		cout << A[i][0];
		for(int j = 1; j < n; j++){
			cout << ' ' << A[i][j];
		}
		cout << endl;
	}
	return 0;
}

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

int main(){
    int n, u, k, v;
    cin >> 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++){
        cin >> u >> k;
        u = u - 1;
        for(int j = 0; j < k; j++){
            cin >> v;
            v = v - 1;
            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 <string>
#include <vector>
using namespace std;

class branch{
  int to;
  branch(int to){
    this->to = to;
  }
};

int main(){
  int n; cin >> n;
  vector<branch> graph[n+1];
  int g[n+1][n+1];
  memset(g, 0, sizeof(g));

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

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

  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <cstring>
using namespace std;

int G[110][110];

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

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]);
      if(y!=n-1){
        printf(" ");
      }
    }printf("\n");
  }

  return 0;
}

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

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

C++: #include<bits/stdc++.h>
using namespace std;
using UL = unsigned int;
using ULL = unsigned long long;
using LL = long long;
#define rep(i,n) for(UL i=0; i<(n); i++)

UL E[100][100]={};

int main() {
 UL N; scanf("%u",&N);
 rep(i,N){
  UL v; scanf("%u",&v); v--;
  UL c; scanf("%u",&c);
  rep(i,c){
   UL e; scanf("%u",&e); e--;
   E[v][e]=1;
  }
 }
 rep(i,N){
  rep(j,N){
   if(j) printf(" ");
   printf("%u",E[i][j]);
  } printf("\n");
 }
 return 0;
}