Go: package main

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

func main() {
	var n int
	fmt.Scanf("%d", &n)

	adj := make([][]string, n)
	for i := 0; i < n; i++ {
		adj[i] = make([]string, n)
		for j := 0; j < n; j++ {
			adj[i][j] = "0"
		}
	}

	sc := bufio.NewScanner(os.Stdin)
	for i := 0; i < n; i++ {
		sc.Scan()
		adjList := strings.Split(sc.Text(), " ")
		outDegree, _ := strconv.Atoi(adjList[1])

		if outDegree > 0 {
			for k := 0; k < outDegree; k++ {
				j, _ := strconv.Atoi(adjList[k+2])
				adj[i][j-1] = "1"
			}
		}
	}

	for i := 0; i < len(adj); i++ {
		fmt.Println(strings.Join(adj[i], " "))
	}

}

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

using namespace std;

static const int N = 100;

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

	int n; cin >> n;
	for (int i = 0; i < n; ++i)
	{
		int u, d;
		cin >> u >> d;
		for (int i = 0; i < d; ++i)
		{
			int v; cin >> v;
			m[u - 1][v - 1] = 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;
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  
  int N;
  bool info[100][100] = {{}};
  cin >> N;
  for(int i = 0; i < N; i++){
    int u, k;
    cin >> u >> k;
    while(k--){
      int v;
      cin >> v;
      info[u - 1][v - 1] = true;
    }
  }
  
  
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      cout << info[i][j] << (j + 1 == N ? '\n' : ' ');
    }
  }
}

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

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

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

int A[101][101] = {0};

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

    for ( i = 1; i <= n; i++ ) {
        for ( j = 1; j <=n; j ++ ) {
                if ( j != 1 ) cout << ' ';
            cout << A[i][j];
        }
        cout << endl;
    }
}

C++: #include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int MAX_N = 150;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int G[MAX_N][MAX_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;
            G[u][v] = 1;
        }
    }
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n; j++) 
        {
            if(j == 1) cout << G[i][j];
            else cout << " " << G[i][j];
        }
        cout << endl;
    }
    return 0;
}

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

int main ()
{
    int N;
    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++)
    {
        int u, k;
        cin >> u >> k;
        u--;

        for (int j = 0; j < k; j++)
        {
            int v;
            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 << " ";
            cout << M[i][j];
        }
        cout << endl;
    }

    return 0;
}

C++: #include<iostream>
#include<vector>
#include<cstdio>
using namespace std;
int judge(int i,int n,int variable,vector< vector<int> > &v)
{
  for(int j=0;j<v[variable].size();++j){
    if(i==v[variable][j]){
      return 1;
      break;
    }
  }
  return 0;
}
int main()
{
  int n,u,k,vv;
  cin>>n;
  vector< vector<int> > v(n),a(n,vector<int>(n));
  for(int variable=0;variable<n;++variable){
    cin>>u>>k;
    for(int i=0;i<k;++i){
      cin>>vv;
      v[variable].push_back(vv);
    }
  }
  for(int variable=0;variable<n;++variable)
    for(int i=1;i<=n;++i)
      a[variable][i-1]=judge(i,n,variable,v);
  for(int variable=0;variable<n;++variable){
    for(int i=0;i<n;++i){
        printf("%d%c", a[variable][i], i == n - 1 ? '\n' : ' ');
    }
  }
    return 0;
}

C++: #include<iostream>
using namespace std;
 
void main() {
	int Adj[100][100];
	int n, u, k, v;
	cin >> n;

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

C++: #include <iostream>
using namespace std;
int T[105][105];
int main()
{
    int t;
    cin>>t;
    int m=t;
    while(t--)
    {
        int ori;
        cin>>ori;
        int n;
        cin>>n;
        while(n--)
        {
            int x;
            cin>>x;
            T[ori][x]=1;
        }
    }
    for(int i=1;i<=m;i++)
    {
        cout<<T[i][1];
        for(int j=2;j<=m;j++)
            cout<<" "<<T[i][j];
        cout<<endl;
    }
    return 0;
}

C++: #include <iostream>
#define MAX 101

using namespace std;

int main(){
  int n, i, j, k, l, m;
  bool g[MAX][MAX];
  
  for(i=1;i<MAX;++i){
    for(j=1;j<MAX;++j)
      g[i][j] = false;
  }
  
  cin >> n;
  for(i=1;i<=n;++i){
    cin >> k >> l;
    for(j=1;j<=l;++j){
      cin >> m;
      g[k][m] = true;
    }
  }
  
  for(i=1;i<=n;++i){
    for(j=1;j<=n;++j){
      cout << g[i][j];
      if(n != j)cout << " ";
    }
    cout << "\n";
  }
  
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int n,a[100][100]={0},i,j,b,c,q;
  for(cin>>n,i=0;i<n;i++){
    cin>>b>>q;b--;
    for(j=0;j<q;j++){
      cin>>c;
      a[b][--c]=1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j)cout<<' ';
      cout<<a[i][j];
    }
    cout<<endl;
  }
}

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

void fnInput(vector<vector<int>> &rvvnAdjcy)
{
  int nMaxSiz;
  cin >> nMaxSiz;

  rvvnAdjcy.resize(nMaxSiz + 1, vector<int>(nMaxSiz + 1, 0));
  for (int i = 0; i < nMaxSiz; i++)
  {
    int nx, nSecSiz;
    cin >> nx >> nSecSiz;
    for (int j = 0; j < nSecSiz; j++)
    {
      int ny;
      cin >> ny;
      rvvnAdjcy[nx][ny] = 1;
    }
  }
}

void fnResult(const vector<vector<int>> &cnrvvnAdjcy)
{
  for (int i = 1; i < cnrvvnAdjcy.size(); i++)
  {
    for (int j = 1; j < cnrvvnAdjcy[i].size(); j++)
    {
      if (j != 1) cout << " ";
      cout << cnrvvnAdjcy[i][j];
    }
    cout << endl;
  }
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<vector<int>> vvnAdjcy;

  fnInput(vvnAdjcy);
  fnResult(vvnAdjcy);

  return 0;
}

C++: #include<stdio.h>
int main (){

}