Go: package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}
	matrix := make([][]int, n)
	for i := 0; i < n; i++ {
		matrix[i] = make([]int, n)
		id, err := nextInt(sc)
		if err != nil {
			panic(err)
		}
		vNum, err := nextInt(sc)
		if err != nil {
			panic(err)
		}
		for j := 0; j < vNum; j++ {
			v, err := nextInt(sc)
			if err != nil {
				panic(err)
			}
			matrix[id-1][v-1] = 1
		}
	}
	for i := 0; i < n; i++ {
		printRow(matrix[i])
	}
}

func printRow(row []int) {
	xs := make([]string, len(row))
	for i := 0; i < len(row); i++ {
		xs[i] = strconv.Itoa(row[i])
	}
	fmt.Println(strings.Join(xs, " "))
}

func nextInt(sc *bufio.Scanner) (int, error) {
	sc.Scan()
	return strconv.Atoi(sc.Text())
}

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

using namespace std;
    
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <limits>
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<vector<int>> vec(n);
    vector<int> SIZE;
    for(int i=0;i<n;i++){
        int x;
        cin >> x;
        int num;
        cin >> num;
        SIZE.push_back(num);
        for(int j = 0;j< num;j++){
            int y;
            cin >> y;
            vec[x-1].push_back(y-1) ;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            bool hantei=0;
            for(int k=0;k<SIZE[i];k++){
                if(vec[i][k]==j) {cout << 1 <<" "; hantei=1;}
            }
            if(hantei==0) cout <<0<<" ";
        }cout << endl;
    }cout << endl;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <string>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>

using namespace std;

// ---------------------
// repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

// ---------------------
#define INF 922337203685477580
typedef long long ll;

int matrix[110][110];

int main() {
  REP(x, 110) {
    REP(y, 110) {
      matrix[x][y] = 0;
    }
  }


  int n;
  cin >> n;

  REP(_, n) {
    int v, num;
    cin >> v >> num;

    REP(i, num) {
      int cv;
      cin >> cv;
      matrix[v][cv] = 1;
    }
  }


  FOR(x, 1, n + 1) {
    FOR(y, 1, n + 1) {
      cout << " " << matrix[x][y];
    }
    cout << endl;
  }

  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
static void line(int32_t n, vector<int32_t> &v) {
  auto &&it = v.cbegin();
  for (int32_t i = 0; i < n; ++i) {
    cout << (i == 0 ? "" : " ");
    if (!v.empty() && it != v.cend() && i + 1 == *it) {
      cout << 1;
      ++it;
    } else {
      cout << 0;
    }
  }
  cout << endl;
}
int main() {
  int32_t n;
  cin >> n;
  for (int32_t i = 0; i < n; ++i) {
    int32_t skip, k;
    cin >> skip >> k;
    vector<int32_t> v(k);
    for (int32_t j = 0; j < k; ++j) {
      cin >> v[j];
    }
    sort(v.begin(), v.end());
    line(n, v);
  }
}

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