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

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