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 <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) {
            if(i) cout << " "
            cout << M[l][i];
        }
        cout << endl;
    }

    return 0;
}

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

static const int N = 100;

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

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

    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(j-1) cout << ' ';
            cout << ans[i][j];
        }
        cout << endl;
    }
}

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

using i64 = int64_t;

int main(){
    int n;
    cin >> n;
    vector<vector<int>> graph(n, vector<int>(n));
    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-1][v-1] = 1;
        }
    }
    for(int i=0;i<n;++i){
        for(int j=0;j<n;++j){
            if(j)cout << " ";
            cout << graph[i][j];
        }
        cout << endl;
    }

    return 0;
}

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

int V[100][100] = {{0}};

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

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

int main() {
    int n; cin >> n;
    vector<vector<int>> vec(n, vector<int>(n, 0));

    for (int i = 0; i < n; i++)
    {
        int u, k, tmp; cin >> u >> k;
        for (int j = 0; j < k; j++)
        {
            cin >> tmp;
            vec.at(i).at(tmp-1)=1;
        }
        
    }
    
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            cout << vec.at(i).at(j) ;
            if(j!=n-1) cout << " ";
        }
        if(i!=n-1)  cout << endl;
    }
    
}
//g++ -o a.exe a.cpp

C++: #include<iostream>
using namespace std;
int main()
{
	const int MAX = 101;
	int G[MAX][MAX] = {0};
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		int u, d;
		cin >> u >> d;
		for (int j = 1; j <= d; j++)
		{
			int v;
			cin >> v;
			G[u][v] = 1;
		}
	}
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			if (j != n)
				cout << G[i][j] << " ";
			else
				cout << G[i][j] << endl;
}

C++: #include<iostream>
#include<windows.h>
using namespace std;
int graph[105][105];
int main()
{
	int n;
	cin>>n;
	memset(graph,0,sizeof(graph));
	for(int i=1;i<=n;i++)
	{
		int v;
		cin>>v;
		int num;
		cin>>num;
		while(num--)
		{
			int aa;
			cin>>aa;
			graph[v-1][aa-1]=1;
			//cout<<v-1<<" "<<aa<<endl;
		}
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(j>0)
			cout<<" ";
			cout<<graph[i][j];
		}
		cout<<endl;
	}
	return 0;
}

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

int main(void){
    int n;
    cin>>n;
    int* row=(int*)malloc(sizeof(int)*n);
    int u,k;
    int v;
    for(int j=0;j<n;j++){
        for(int i=0;i<n;i++){
            row[i]=0;
        }
        cin>>u>>k;
        for(int i=0;i<k;i++){
            cin>>v;
            row[v-1]=1;
        }
        for(int i=0;i<n-1;i++){
            cout<<row[i]<<" ";
        }
        cout<<row[n-1]<<endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(){
int M[110][110] = {0}; 
int n; 
cin >> n; 
for (int i = 1; i <= n; ++i){
  int k; 
  cin >> k; 
  int m; 
  cin >> m; 
    for (int l = 1; l <= m; ++l){
     int j; 
     cin >> j;
     M[k][j] = 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; 
}
}

C++: #include <cstdio>

using namespace std;

#define MAX 100
int n, AM[MAX][MAX];

int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        int u, k;
        scanf("%d%d", &u, &k);
        for (int j = 1; j <= k; ++j) {
            int vi;
            scanf("%d", &vi);
            AM[i][vi - 1] = 1;
        }
    }

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

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;
}