Go: package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	g := make([][]int, n)

	for i := 0; i < n; i++ {
		g[i] = make([]int, n)
	}

	for i := 0; i < n; i++ {
		u := getNextInt(scanner)
		k := getNextInt(scanner)
		u--
		for ii := 0; ii < k; ii++ {
			v := getNextInt(scanner)
			v--
			g[u][v] = 1
		}
		fmt.Fprintln(writer, joinint(g[u], " "))
	}

	writer.Flush()
}

func joinint(a []int, sep string) string {
	n := len(a)
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		ss[i] = fmt.Sprintf("%d", a[i])
	}
	return strings.Join(ss, sep)
}

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

int main(void){
    int n,u,k,i,j,x;
    bool path[110][110];
    memset(path,0,sizeof(path));
    cin>>n;
    for(i=0;i<n;i++){
        cin>>u>>k;
        u--;
        for(j=0;j<k;j++){
            cin>>x;
            x--;
            path[u][x]=true;
        }
    }
    
    for(i=0;i<n;i++){
        for(j=0;j<n-1;j++){
            cout<<path[i][j]<<" ";
        }
        cout<<path[i][n-1]<<endl;
    }
    
    return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
    int n, u, k, v, adj[110][110]={0};
    cin>>n;
    for (int i=0; i<n; i++)
    {
        cin>>u>>k;
        for (int j=0; j<k; j++)
        {
            cin>>v;
            adj[u][v]=1;
        }
    }
    for (int i=1; i<=n; i++)
    {
        for (int j=1; j<=n; j++)
        {
            if (j!=n) cout<<adj[i][j]<<' ';
            else cout<<adj[i][j]<<'\n';
        }
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <climits>
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(){
  int n,k,V[100][100],adj[100][99],i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++)V[i][j]=0;
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&adj[i][0],&k);
    for(j=1;j<=k;j++){
      scanf("%d",&adj[i][j]);
      V[i][adj[i][j]-1]=1;
    }
  }
  
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      printf("%d",V[i][j]);
      if(j!=n-1)printf(" ");
    }
    printf("\n");
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = 1 << 21;
const ll MOD = 1e9 + 7;

int graph[100][100];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    memset(graph, 0, sizeof(graph));
    rep(i, n)
    {
        int u, k;
        cin >> u >> k;
        u--;
        rep(j, k)
        {
            int v;
            cin >> v;
            v--;
            graph[u][v] = 1;
        }
    }
    rep(i, n)
    {
        rep(j, n)
        {
            cout << graph[i][j];
            if (j != n-1) {
                cout << " ";
            }
        }
        cout << endl;
    }
    return 0;
}

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

using namespace std;

int main(void){

    int n, k;

    cin >> n;
    vector<vector<bool> > A(n, vector<bool>(n, false));
    for(int i = 0; i < n; i++){
        cin >> k >> k;
        for(int j = 0; j < k; j++){
            int input;
            cin >> input;
            A[i][input-1] = true;
        }
    }

    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(j != n-1) cout << A[i][j] << " ";
            else cout << A[i][j];
        }
        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 <iostream>

using namespace std;

int n,u,k,v;
int a[101][101]={};

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

C++: #include <cstdio>
#define REP0(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int n,a,b,x;
  int V[100][100]={0};
  scanf("%d",&n);
  REP0(i,n){
    scanf("%d %d",&a,&b);
    REP0(j,b){
      scanf("%d",&x);
      V[a-1][x-1]=1;
    }
  }
  REP0(i,n){
    REP0(j,n){
      if(j) printf(" ");
      printf("%d",V[i][j]);
    }
    printf("\n");
  }
  return 0;
}

C++: #include <stack>
#include <queue>
#include <cstdlib>
#include <iomanip>
#include <utility>
#include <math.h>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>

using namespace std;

int main() {
    int c;
    string s;
    getline(cin,s);
    c = atoi(&s[0]);
    int a[c][c];
    for(int i = 0;i<c;i++)
        for(int j = 0;j<c;j++)
            a[i][j] = 0;
    for (int i = 0; i <c;i++)
    {
        bool first = true;
        getline(cin, s);
        string::iterator ite = s.begin();
        while (ite != s.end() && *ite != '0')
        {
            if(*ite != ' ')
            {
                int n = atoi(&*ite);
                if(*(ite+1) != ' ' && ite+1 != s.end())
                {
                    n *= 10;
                    n += atoi(&*(++ite));
                    if(*(ite+1) != ' ' && ite+1 != s.end())
                    {
                        n*=10;
                        n+= atoi(&*(++ite));
                    }
                }
                if(first)
                    first = false;
                else
                    a[i][n-1] = 1;
            }
            ite++;
        }
    }
    for(int i = 0;i < c;i++)
    {
        for(int j = 0; j<c-1;j++)
        {
            cout << a[i][j] << " ";
        }
        cout << a[i][c-1] << endl;
    }
    
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
int n;
ll g[101][101];
int main(){
    cin >> n;
    rep(i,n){
        int u, k;
        cin >> u >> k;
        rep(j,k){
            int node;
            cin >> node;
            g[u][node] = 1;
        }
    }

    REP(i,1,n+1)REP(j,1,n+1)cout << g[i][j] << ((j == n)?"\n":" ");
    
    return 0;
}