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] {
			fmt.Printf(" %d", Adj[i][j])
			if j == n-1 {
				fmt.Println()
			}
		}
	}
}

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

int main(){
  int n,u,k,v;
  int g[102][102];
  
  memset(g,0,sizeof(g));

  cin>>n;
  for(int i=0;i<n;i++){
    cin>>u>>k;
    for(int j=0;j<k;j++){
      cin>>v;
      g[u][v]=1;
    }
  }
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      if(j!=1)cout<<" ";
      cout<<g[i][j];
    }
    cout<<endl;
  }
  return(0);
}

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

bool find(vector<int> v, int j){
    bool e = false;
    for(vector<int>::iterator it = v.begin(); it!=v.end(); ++it){
        if (*it == j) e = true;
    }
    return e;
}

int main(){
    vector<int> adj[MAXN];
    int n; cin >> n;
    for(int i=1; i<=n; ++i){
        int l, m; cin >> l >> m;
        for(int j=0; j<m; ++j){
            int k; cin >> k;
            adj[l].push_back(k);
        }
    }
    
    for(int i=1; i<=n; ++i){
        for(int j=1; j<n; ++j){
            cout << (find(adj[i], j) ? 1 : 0 ) << " ";
        }
        cout << (find(adj[i], n) ? 1:0) << endl;
    }
}

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

C++: int main(){
  int n;
  cin>>n;

  int u[n],k;
  int a[n][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>>u[i];
    cin>>k;
    for(int j=0;j<k;j++){
      int v;
      cin>>v;
      a[i][v-1]=1;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      cout<<a[i][j];
    }
    cout<<"\n";
  }
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define outl(x) cout<< (x) << '\n'
using namespace std;

bool G[105][105];

signed main()
{
   cin.tie(0), ios::sync_with_stdio(false);
   int N;
   cin >> N;

   rep(i, N){
      int k, u, p;
      cin >> u >> k;
      --u;

      rep(j, k){
         cin >> p;
         --p;
         G[u][p] = true;
      }
   }

   rep(i, N){
      rep(j, N){
         cout << G[i][j] << ((j+1 < N)? ' ' : '\n') ;
      }
   }

}

C++: #include<iostream>
#include<algorithm>
#define N 105
using namespace std;

int n;
int M[N][N];
int main()
{
	cin >> n;
	int u, v;
	for (int i = 0; i < n; i++)
	{
		int s;
		cin >> u >> s;
		for (int j = 0; j < s; j++)
		{
			cin >> v;
			M[u][v] = 1;
		}
	}
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (j > 1)
				cout << ' ';
			cout << M[i][j];
		}
		cout << endl;
	}
	return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
#define MAX 100

int ADJ[MAX+1][MAX+1];

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

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

        cout << endl;
    }

    return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
#pragma warning(disable:4996)
int main(){
	int n;
	int a, b;
	int A[101];
	int **arr = NULL;
	scanf("%d", &n);	
	arr = new int*[n];
	for (int i = 0; i < n; i++){
		arr[i] = new int[n];
	}
	for (int i = 0; i < n; i++){		
		scanf("%d%d", &a, &b);
		for (int j = 0; j < b; j++){
			scanf("%d",&A[j]);
			arr[i][A[j]-1] = 1;
		}
	}
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			if (arr[i][j] == 1){
				printf("1 ");
			}
			else {
				printf("0 ");
			}
		}
		printf("\n");
	}
	for (int i = 0; i < n; i++){
		delete[](arr[i]);
	}
	delete[](arr);
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <tuple>
#include <functional>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <map>
#include <random>
#include <cstdlib>
#define INT_MAX 2147483647
#define INT_MIN -2147483646
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
using namespace std;
typedef long long int ll;

bool mx[105][105];

int main() {
	int n;
	cin >> n;
	Loop1(i, n) {
		Loop1(j, n) {
			mx[i][j] = 0;
		}
	}
	Loop(i, n) {
		int u, k;
		cin >> u >> k;
		Loop(j, k) {
			int v;
			cin >> v;
			mx[u][v] = 1;
		}
	}
	Loop1(i, n) {
		Loop1(j, n - 1) {
			cout << mx[i][j] << " ";
		}
		cout << mx[i][n] << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
#include<cctype>
#include<string>
#include<algorithm>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <utility> 
using namespace std;

long long mod = 1000000007;



int main()
{
	int N,M[100][100];
	cin >> N;

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

	int u, k, v;
	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 == 0)
				cout << M[i][j];
			else
				cout << " " << M[i][j];
		}
		cout << endl;
	}


	


	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int MAX=105;
int M[MAX][MAX];
int main(){
	int n,u,k;
	cin>>n;
	memset(M,0,sizeof(M));
	for(int i=0;i<n;i++){
		cin>>u>>k;
		int v;
		for(int j=0;j<k;j++){
			cin>>v;
			M[u][v]=1;
		}
	}		
	for(int i=1;i<=n;i++){
		int first=1;
			for(int j=1;j<=n;j++){
				if(first)first=0;else putchar(' ');
				cout<<M[i][j];
			}
			cout<<endl;
		}
	return 0;
}