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;
#define rep(i, n) for(int i=0; i<(n); i++)
int main() {

    int n;
    cin >> n;
    int mat[100][100] = {};
    rep(i, n){
        int k, l;
        cin >> k >> l;
        rep(j, l){
            int v;
            cin >> v;
            mat[k-1][v-1] = 1;
        }
    }

    rep(i, n){
        rep(j, n){
            cout << mat[i][j];
            if(j == n-1){
                cout << "\n";
            }
            else{
                cout << ' ';
            }
        }
    }


    return 0;
}

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

int main(){
    int n; cin >> n;
    int A[n][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++){
        int num,ver;
        cin >> num >> ver;
        for (int j = 0;j< ver;j++){
            int u; cin >> u;
            A[num-1][u-1] =1;
        }
    }
     for (int i=0;i<n;i++){
        for(int j =0;j<n;j++){
            cout << A[i][j]  ;
            if (j != n-1) cout << " ";
            
        }cout << endl;
    }
}

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' : ' ');
}

C++: #include <stdio.h>
#include <string.h>

int main(){
  int Adj[101][101],n,v,i,j,u,k;
  memset(Adj, 0, 101*101*sizeof(int));
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      Adj[u][v]=1;
    }
  }
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      if(j!=1)printf(" ");
      printf("%d",Adj[i][j]);
    }
    printf("\n");
  }
  
  return 0;
}

C++: #include<iostream>
using namespace std;
static const int N=100;

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++: #define _CRT_SECURE_NO_WARNINGS

#include<fstream>
#include<iostream>
#include<string>
#include<iomanip>
#include<list>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

int main(){
	int g[100][100];
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			g[i][j] = 0;
		}
	}
	for (int i = 0; i < n; i++) {
		int u, k, v;
		cin >> u >> k;
		for (int j = 0; j < k; j++) {
			cin >> v;
			g[u - 1][v - 1] = 1;
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (j > 0) {
				cout << " ";
			}
			cout << g[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 <bits/stdc++.h>
using namespace std;
static const int N=100;

int main(){
  int m[N][N],n,u,k,v,i,j;

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

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j) cout << " ";
      cout << m[i][j];
    }
    cout << endl;
  }
  return 0;
}

C++: //
#if 0

#endif // 0
#include<iostream>
#define MAX 100
using namespace std;
int matri[MAX][MAX];

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

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

int main(){
	int n,m,l,i,j,p;
	cin >> n;
	int f[100][100];
	for ( i = 0; i < n; i++){
		cin >> m;
		cin >> p;
		for ( j = 0; j < p; j++){
			cin >> l;
			f[m-1][l-1] = 1;
		}
	}
	for ( i = 0; i < n; i++){
		for ( j = 0; j < n-1; j++){
			cout << f[i][j] << " ";
		}
		cout << f[i][n-1] << endl;
	}
}

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

#define REP(i,n) for(int i=0;i<n;++i)

const int MAX_N = 100;

int main() {
  int n, u, k, v, G[MAX_N][MAX_N] = {0};
  cin >> n;
  REP(i, n) {
    cin >> u >> k;
    REP(j, k) {
      cin >> v;
      G[u - 1][v - 1] = 1;
    }
  }
  REP(i, n) {
    REP(j, n) {
    if(j) cout << ' ';
    cout << G[i][j];
    }
    cout << endl;
  }
  return 0;
}

C++: #include<stdio.h>
#define N 200

int main(){
  int M[N][N];
  int n,u,k,v;

  scanf("%d",&n);

  for(int i=0;i<n;i++){
    for(int j;j<n;j++)
      M[i][j]=0;
    
  }
  for(int i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    u--;
    for(int j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v]=1;
      
    }
      
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(j)printf(" ");
      printf("%d",M[i][j]);}
    printf("\n");


    }

  return 0;
  }

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

int main()
{
	//ios::sync_with_stdio(false);
	//cin.tie(0);

	static int M[101][101];
	int n;
	cin >> n;

	int u, k, v;
	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		for (int j = 0; j < k; j++) {
			cin >> v;
			M[u][v] = 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;
	}
	return 0;
}