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 <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;


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

    int lst[n+1][n+1];
    REPP(i,1,n+1) REPP(l,1,n+1) lst[i][l] = 0;

    int idx,op,tmp;
    for(int i = 0; i < n;i++){
        cin >> idx >> op;
        for(int l = 0; l < op;l++){
            cin >> tmp;
            lst[idx][tmp] = 1;
        }
    }

    for(int i = 1; i < n+1;i++){
        for(int l = 1; l < n+1;l++){
            cout << lst[i][l];
            if(l != n){
                cout << " ";
            }
        }
        cout << endl;
    }


    

    return 0;
}

C++: #include <stdio.h>


int main() {

   int m[100][100];
   int n, s, t, u, i,  j;

   scanf("%d", &n);
   for ( i = 0; i < n; i++) {
      for ( j = 0; j < n; j++) {
         m[i][j] = 0;
      }
   }

   for ( i = 0; i < n; i++) {
      scanf("%d", &s);
      scanf("%d", &t);
      for ( j = 0; j < t; j++) {
         scanf("%d", &u);
         m[s - 1][u - 1] = 1;
       }
   }
   for ( i = 0; i < n; i++) {
      for ( j = 0; j < n; j++) {
      printf("%d", m[i][j]);
      if ( j < n - 1) {
         printf(" ");
            }
         }
      printf("?\n");
      }
      return 0;
   }

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

using namespace std;

static const int N = 100;
static int M[N + 1][N + 1] = {}, p[N + 1] = {};

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

  int number, count, value;
  for (int i = 0; i < n; i++) {
    cin >> number >> count;
//    printf("n = %d, number = %d, count = %d\n", n, number, count);
    for (int j = 0; j < count; j++) {
     cin >> value;
//     printf("value = %d.\n", value);
     M[number - 1][value - 1] = 1; 
    }
  }

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {    
      if (j != 0) {
        cout << " ";
      }
      cout << M[i][j];
    } 
    cout << endl;
  }

  return 0;
}

C++: #include<iostream>;
#include<algorithm>;
#include<vector>;

using namespace std;

int main(){
   int n,u,v,k;
   cin >> n;
   vector<int> a(n,0);
   vector<vector<int> > edges(n,a); 
   for(int i = 0;i < n;i++){
       cin >> u;
       cin >> v;
       for(int ii = 0;ii < v;ii++){
           cin >> k;
           edges[u-1][k-1] = 1;
       }
   }
   for(int i = 0;i < n;i++){
       for(int ii = 0;ii < n;ii++){
           if(ii == n-1){
               cout << edges[i][ii];
           }
           else{
               cout << edges[i][ii] << " ";
           }
       }
       cout <<"\n";
   }
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;


int main(){
    int n;
    scanf("%d",&n);
    int C[n][n];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            C[i][j]=0;
        }
    }
    for(int i=0;i<n;i++){
        int u,k;
        scanf("%d %d",&u,&k);
        vector<int> v(k);
        for(auto&e:v){
            scanf("%d",&e);
        }
        for(int i=0;i<k;i++){
            C[u-1][v[i]-1]=1;
        }
    }

    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(j<n-1) printf("%d ",C[i][j]);
            else printf("%d\n",C[i][j]);
        }
    }

    return 0;
}

C++: #include<cstdio>

int main(void){
	int n, u, k, v;
	scanf("%d", &n);
	int a[n+1][n+1];
	for (int row = 1; row <= n; ++row) {
		for (int column = 1; column <= n; ++column)
			a[row][column] = 0;
	}
	for (int vertexi = 0; vertexi < n; ++vertexi) {
		scanf("%d %d", &u, &k);
		for (int outi = 0; outi < k; ++outi) {
			scanf("%d", &v);
			a[u][v] = 1;
		}
	}
	for (int row = 1; row <= n; ++row) {
		for (int column = 1; column <= n; ++column)	{
			if(column > 1)
				printf(" ");
			printf("%d", a[row][column]);
		}
		printf("\n");
	}
	return 0;
}

C++: //============================================================================
// Name        : Graph.cpp
// Author      : Ken
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <vector>
using namespace std;

void writeMatrix(vector<vector<int> > matrix){
	for(int i=0; i<matrix.size(); i++){
		for(int j=0; j<matrix.at(i).size()-1; j++){
			cout << matrix.at(i).at(j) << " ";
		}
		cout << matrix.at(i).at(matrix.at(i).size()-1);
		cout << "\n";
	}
}

int main() {
	int n;
	cin >> n;
	vector<vector<int> > matrix;

	for(int i=0; i<n; i++){
		vector<int> vec(n);
		matrix.push_back(vec);
	}

	for(int i=0; i<n; i++){
		int id, k;
		cin >> id >> k;
		for(int j=0; j<k; j++){
			int input;
			cin >> input;
			//cout << "id: " << id << ", k: " << k << "\n";
			matrix.at(id-1).at(input-1) = 1;
		}
	}

	writeMatrix(matrix);

	return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int g[100][100];
int main(){
	int n;cin>>n;
	rep(i,n){
		int u,k;cin>>u>>k;u--;
		rep(j,k){
			int v;cin>>v;v--;
			g[u][v]=1;
		}
	}
	rep(i,n){
		rep(j,n){
			if(j)cout<<" ";
			cout<<[i][j];
		}
		cout<<endl;
	}
}

C++: // C++ 14
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>

#define ll long long
#define loop(x, start, end) for(int x = start; x < end; x++)
#define loopdown(x, start, end) for(int x = start; x > end; x--)

using namespace std;


int main(void) {
  int n, v, c, l;
  cin >> n;

  int mat[n][n];

  loop(i,0,n) {
    loop(j,0,n) {
      mat[i][j] = 0;
    }
  }

  loop(i, 0, n) {
    cin >> v >> c;
    loop(j,0,c) {
      cin >> l;
      mat[v-1][l-1] = 1;
    }
  }

  loop(i,0,n) {
    loop(j,0,n) {
      if (j) cout << " ";
      cout << mat[i][j];
    }
    cout << endl;
  }
}

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


int main(){

	int adjMar[MAX][MAX];
	int n, i, j, vertice, degree, adjVertice;
	cin >> n;

	for (i = 0; i <= n; i++)
		for (j = 0; j <= n; j++)
			adjMar[i][j] = 0;

	for (i = 1; i <= n; i ++) {
		cin >> vertice;
		cin >> degree;
		for (j = 0; j < degree; j++){
			cin >> adjVertice;
			adjMar[vertice][adjVertice] = 1;
		}
	}

	for (i = 1; i <= n; i++){
		for (j = 1; j <= n; j++)
			cout << adjMar[i][j] << ' ';
		cout << endl;
	}
}