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 main()
{
    int n; cin >> n;
    vector<vector<int>> graph(n);
    vector<vector<char>> A(n, vector<char>(n, '0'));
    int origin;
    for (int i = 0; i < n; ++i)
    {
        int u; cin >> u; u -= 1;
        int m; cin >> m;
        for (int k = 0; k < m; ++k)
        {
            int v;
            cin >> v;
            v -= 1;
            A[u][v] = '1';
        }
    }

    for (int i = 0; i < n; ++i)
    {
        for (int k = 0; k < n; ++k)
        {
            cout << A[i][k];
            if (k < n-1)
            {
                cout << " ";
            }
        }
        cout << endl;
    }

    return 0;
}

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

    return 0;
}

C++: #include <iostream>
#include <stdio>

using namespace std;

int main(){
  int g[10010][10010]={{0}};//要素を0で初期化
  int n,a,b,c;
  cin >> n;
  for (int i = 0; i < n; ++i)
   {
     cin >> a >> b ;
     for (int i = 0; i < b; ++i)
     {
       cin >> c;
       g[a-1][c-1]=1;/* code */
     }
   }
   for (int i = 0; i < n; ++i)
   {
     for (int j = 0; j < n; ++i)
     {
      if (j==n-1)
      {
        cout << g[i][j] << endl;
      }else{
        cout << g[i][j] <<" ";
      }
     }
   }

}

C++: #include <bits/stdc++.h>
using namespace std;
int n;
int a[101][101]={};
int u, k, s;
int main() 
{
	cin >> n;
	for(int i=0; i<n; i++)
	{
		cin >> u >> k;
		for(int j=0; j<k; j++)
		{
			cin >> s;
			a[u][s]=1;
		}
	}
	for(int i=1; i<=n; i++)
	{
		for(int j=1; j<=n; j++)
		{
			cout << a[i][j] << (j==n ? '\n' : ' ');
		}
	}
	return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <stack>

using namespace std;

int minimum=-1;


int main(){
	int n,row,num,col;
	scanf("%d",&n);
	int table[n][n];
	for(int i=0;i<n;i++){
		for(int k=0;k<n;k++){
			table[i][k] = 0;
		}
	}

	for(int i=0;i<n;i++){
		scanf("%d %d",&row,&num);
		for(int k=0;k<num;k++){
			scanf("%d",&col);
			table[row-1][col-1]=1;
		}
	}

	for(int i=0;i<n;i++){
		for(int k=0;k<n-1;k++){
			printf("%d ",table[i][k]);
		}
		printf("%d\n",table[i][n-1]);
	}

    return 0;
}

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

int v,A[100][100],u,k,w;


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

C++: #include<iostream>
#define N 101
using namespace std;
int A[N][N];
int n;
int main(){
    int k,num;
    int e;
    cin>>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>>k;
        k--;
        cin>>num;
        for(int j=0;j<num;j++){
            cin>>e;
            e--;
            A[k][e]=1;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(j) cout<<' ';
            cout<<A[i][j];
        }
        cout<<endl;
    }
}

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

int main() {
	int n,graph[100][100];
	cin >> n;

	for (int i = 0; i < n; i++) {
		int vertex,jisu;
		cin >> vertex>>jisu;
		vertex--;
		for (int j = 0; j < jisu; j++) {
			int to;
			cin >> to;
			to--;
			graph[vertex][to] = 1;
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (graph[i][j] != 1) graph[i][j] = 0;
			cout << graph[i][j];
			if (j < n - 1)cout << " ";
		}
		cout << "\n";
	}

	return 0;
}

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