Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n := scanInt()
	arr := make([][]int, n)
	for i := 0; i < n; i++ {
		u := scanInt()
		k := scanInt()
		arr[u-1] = make([]int, n)
		for j := 0; j < k; j++ {
			n := scanInt()
			arr[u-1][n-1] = 1
		}
	}

	w := bufio.NewWriter(os.Stdout)
	for _, col := range arr {
		fmt.Fprintln(w, strings.Trim(fmt.Sprint(col), "[]"))
	}
	w.Flush()
}

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++)
      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 <iostream>
#include <stack>
#include <vector>

using namespace std;

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

}

C++: #include<stdio.h>
#define N 100
int main(){
  int a[N][N],v[N];
  int n,i,j,u,k;


  scanf("%d",&n);

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      a[i][j]=0;
    }
  }
    
  for(i=1;i<=n;i++){
    scanf("%d %d",&u,&k);
    for(j=1;j<=k;j++){
      scanf("%d",&v[j]);
      a[u][v[j]]=1;
    }
  }

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

  
  return 0;
}

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

using namespace std;

int main() {
	int n,row,size,tmp;
	cin >> n;
	int** mat = new int* [n];
	for (int i = 0;i < n;i++) {
		cin >> row >> size;
		mat[row - 1] = new int[n];
		for (int j = 0;j < n;j++) {
			mat[row - 1][j] = 0;
		}
		for (int j = 0;j < size;j++) {
			cin >> tmp;
			mat[row - 1][tmp - 1] = 1;
		}
	}
	for (int i = 0;i < n;i++) {
		for (int j = 0;j < n-1;j++) {
			cout << mat[i][j] << " ";
		}
		cout << mat[i][n - 1] << endl;
	}
}

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