Go: package main

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

func main() {
	scn := bufio.NewScanner(os.Stdin)
	scn.Split(bufio.ScanWords)
	nextInt := func() int { scn.Scan(); r, _ := strconv.Atoi(scn.Text()); return r }
	w := bufio.NewWriter(os.Stdout)

	n := nextInt()
	v := make([][]int, n)
	for i := 0; i < n; i++ {
		u := nextInt()
		k := nextInt()
		for j := 0; j < k; j++ {
			v[u-1] = append(v[u-1], nextInt())
		}
	}

	for _, vvs := range v {
		for j := 1; j <= n; j++ {
			if j > 1 {
				fmt.Fprint(w, " ")
			}
			p := sort.SearchInts(vvs, j)
			if p < len(vvs) && vvs[p] == j {
				fmt.Fprint(w, 1)
			} else {
				fmt.Fprint(w, 0)
			}
		}
		fmt.Fprintln(w)
	}

	w.Flush()
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>

using namespace std;

//??\???????????????
//4
//1 2 2 4
//2 1 4
//3 0
//4 1 3

bool Path[101][101] = {false};

int main(){
    int  N;
    cin >> N;
    int bb;
    for (int i = 1; i <= N; i++) {
        int K;
        scanf("%d %d",&bb,&K);
        for (int k = 0; k < K; k++) {
            int p;
            scanf("%d",&p);
            
            Path[i][p] = true;
        }
    }
    
    for (int r = 1; r <= N; r++) {
        for (int c = 1; c <= N; c++) {
            printf("%d",Path[r][c]);
            if (c != N) printf(" ");
        }
        printf("\n");
    }
    return 0;
}

C++: #include<stdio.h>

int G[101][101];

int main()
{
    int n, i, j, a, b, e;
    scanf("%d", &n);
    for(i = 1; i <= n; i++){
		for(j = 1; j <= n; j++){ G[i][j] = 0; } }

    for(i = 1; i <= n; i++){ scanf("%d %d", &a, &e);
		for(j = 1; j <= e; j++){ scanf("%d", &b); G[a][b] = 1; } }

    for(i = 1; i <= n; i++){ printf("%d", G[i][1]);
	for(j = 2; j <= n; j++){ printf(" %d", G[i][j]); }
        printf("\n");
    }
    return 0;
}

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

int gra[101][101];
int n, a, b, c;

int main(){
 cin>>n;
 for(int i=0; i<n; i++){
  cin>>a>>b;
  for(int j=1; j<=b; j++){
   cin>>c;
   gra[a][c]=1;
  }  
 }
 for(int i=1; i<=n; i++){
  for(int j=1; j<n; j++)
   cout<<gra[i][j]<<" ";
  cout<<gra[i][n]<<"\n";
 }
 return 0;
}

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

using namespace std;

int main() {
		
	int n;
	cin >> n;

	long u,v;
	long  nn;

	vector<vector<int>> g(n + 1, vector<int>(n + 1,0));
	for (int i = 1; i <= n; i++) {

		cin >> u;
		cin >> nn;
		for (int j = 1; j <= nn; j++) {

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

	return 0;

}

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

bool G[101][101];

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

C++: #include<iostream>
using namespace std;
int main()
{
	int degree,number,num,count;
	cin>>degree;
	int arr[100][100];
	for(int i=0;i<degree;i++)
	{
		for(int j=0;j<degree;j++)
		{
			arr[i][j]=0;
		}
	}
	for(int i=0;i<degree;i++)
	{
		cin>>count;
		cin>>number;
		for(int j=0;j<number;j++)
		{
			cin>>num;
			arr[i][num-1]=1;
		}
	}
	for(int i=0;i<degree;i++)
	{
		for(int j=0;j<degree;j++)
		{
			cout<<arr[i][j];
			if(j!=degree-1)
				cout<<" ";
		}
		cout<<endl;
	}
}

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

//??£??\?????????????¬??????????????¨???¶???	array[i][j] i??????j???????????????
//??£??\?????????????????????????????????????????????,?????????????¨???¶
//ALDS1_11-A
int n,u,k,a;
int map[101][101];
int main(){
	for(int i=0;i<101;i++){
		for(int j=0;j<101;j++){
			map[i][j]=0;
		}
	}
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>u;
		cin>>k;
		for(int j=0;j<k;j++){
			cin>>a;
			map[u][a]=1;
		}
	}
	for(int i=1;i<n+1;i++){
		for(int j=1;j<n+1;j++){
			cout<<map[i][j]<<" ";
			if(j==n&&i!=n)cout<<endl;
		}
	}
	return 0;
}

C++: /*
 * Problem Description: Graph I - Graph
 * Category: Graph
 * Author: Khan
 * Date: 18th October, 2017
 */

#include <iostream>
#include <cstring>
#include <algorithm>

#define MAXN 100

using namespace std;

int main(int argc, char const *argv[])
{
    //freopen("sample.txt", "r", stdin);
    int n, G[MAXN + 1][MAXN + 1], t;
    memset(G, 0, sizeof(G));
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        cin >> t >> t;
        int tmp;
        for (int j = 0; j < t; ++j)
        {
            cin >> tmp;
            G[i + 1][tmp] = 1;
        }
    }
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            if(j != 0)
                cout << " ";
            cout << G[i + 1][j + 1];
        }
        cout << endl;
    }
    return 0;
}

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

int main() {
    ll n;
    cin >> n;
    vector<vector<ll>> mat(n,vector<ll>(n,0));
    for(ll i=0;i<n;i++) {
        ll u,k;
        cin>>u>>k;
        for(ll j=0;j<k;j++) {
            ll tmp;
            cin>>tmp;
            mat[u-1][tmp-1] = 1;
        }
    }
    for(ll i=0;i<n;i++) {
        for(ll j=0;j<n;j++) {
            cout << mat[i][j] << " ";
        }
        cout << endl;
    }
}

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

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

    return 0;
}