Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}
func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()

	graph := make([][]int, n)
	for i := 0; i < n; i++ {
		graph[i] = make([]int, n)
	}
	for i := 0; i < n; i++ {
		s := nextInt()
		t := nextInt()
		if t == 0 {
			continue
		}
		for i := 0; i < t; i++ {
			u := nextInt()
			graph[s-1][u-1] = 1
		}
	}
	for i := range graph {
		for j := range graph[i] {
			if j == n-1 {
				fmt.Printf("%d\n", graph[i][j])
			} else {
				fmt.Printf("%d ", graph[i][j])
			}
		}
	}
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<vector<int>> gr(n, vector<int>(n,0));
  rep(i, n){
    int nn;
    cin >> nn;
    int num;
    cin >> num;
    rep(j, num){
      int a;
      cin >> a;
      a--;
      gr.at(i).at(a)++;
    }
  }
  rep(i, n){
    rep(j, n){
      if(j != 0) cout << " ";
      cout << gr.at(i).at(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<iostream>
using namespace std;
int main(){
    int N;
    int u[101],k[101],a[101],d[101][101];
    memset(d,0,sizeof(d));
    cin>>N;
    for(int i=0;i<N;++i){
        cin>>u[i]>>k[i];
        for(int j=0;j<k[i];++j){
            cin>>a[j];
            d[u[i]][a[j]]=1;
        }
        for(int m=1;m<=N;++m){
            cout<<d[i][m]<<' ';
        }
        cout<<endl;
    }
}
#include<iostream>
using namespace std;
int main(){
    int N;
    int u[101],k[101],a[101],d[101][101];
    memset(d,0,sizeof(d));
    cin>>N;
    for(int i=0;i<N;++i){
        cin>>u[i]>>k[i];
        for(int j=0;j<k[i];++j){
            cin>>a[j];
            d[u[i]][a[j]]=1;
        }
        for(int m=1;m<=N;++m){
            cout<<d[i][m]<<' ';
        }
        cout<<endl;
    }
}

C++: #include <cstdio>
using namespace std;
int G[107][107];
int main() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
    	int id, cnt;
    	scanf("%d%d", &id, &cnt);
    	for (int j = 0; j < cnt; j++) {
    		int tmp;
    		scanf("%d", &tmp);
    		G[id][tmp] = 1;
		}
	}
	for (int i = 1; i <= n; i++) {
		printf("%d", G[i][1]);
		for (int j = 2; j <= n; j++) {
			printf(" %d", G[i][j]);
		}
		putchar('\n');
	}
    return 0;
}

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

int main(){
	int n, u, k, v;
	scanf("%d", &n);
	std::vector< std:: vector<int> > A(n, std::vector<int>(n, 0));
	for (int i = 0; i < n; i++){
		scanf("%d%d", &u, &k);
		for (int j = 0; j < k; j++){
			scanf("%d", &v);
			A[u - 1][v - 1] = 1;
		}
	}
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			if (j != 0) printf(" ");
			printf("%d", A[i][j]);
		}
		printf("\n");
	}


	return 0;
}

C++: #include<iostream>
using namespace std;
static const int N=100;
int main(){
	int M[N][N];
	int n,u,k,v;
	int 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=u-1;

		for(j=0;j<k;j++){
			cin >> v;
			v=v-1;
			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++: #include <iostream>
using namespace std;

static const int NMAX = 100;
bool G[NMAX][NMAX];

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

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			G[i][j] = false;
		}
	}

	for (int i = 0; i < n; i++) {
		int deg; cin >> deg >> deg;
		for (int j = 0; j < deg; j++) {
			int p; cin >> p;
			G[i][p - 1] = true;
		}
	}

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

	return 0;
}

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

int main( void ){
  int M[N][N];
  int n,m,l,k;
 
  cin >> n;

  for( int i = 0 ; i < n ; i++ ){
    for( int j = 0 ; j < n ; j++ ){
      M[i][j];
    }
  }
  for( int i = 0 ; i < n ; i++ ){
    cin >> m >> l;
    m--;
    for( int j = 0 ; j < l ; j++ ){
      cin >> k;
      k--;
      M[m][k] = 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 <iostream>
using namespace std;
static const int N = 100;

int main(){
  int n;
  int M[N][N];
  int 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 << "\n";
  }

  return 0;
}

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

int main(){
    int n;cin>>n;
    int M[n+1][n+1]={};//index 0 is not used.
    for(int i=1;i<n+1;i++){
        int target,degree;
        cin>>target>>degree;
        for(int j=0;j<degree;j++){
            int in;
            cin>>in;M[target][in]=1;
        }
    }
    for(int i=1;i<n+1;i++){
        for(int j=1;j<n+1;j++){
            cout<<M[i][j];
            if(j != n)cout<<" ";
        }
        cout<<endl;
    }
    return 0;
}

C++: #include<iostream>
#define FOR(i,n) for(int i=0;(i)<(n);(i)++)
using namespace std;
int G[101][101] = {};

int main()
{
	int n;
	cin >> n;
	FOR(i, n)
	{
		int m,u;
		cin >> u >> m;
		FOR(j, m)
		{
			int l;
			cin >> l;
			G[u-1][l-1] = 1;
		}
	}
	FOR(i, n)
	{
		FOR(j, n)
		{
			cout << G[i][j] << " ";
		}
		cout << endl;
	}
	return 0;
}

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

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

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

int main(){

  int n,k,v,u;
  cin>>n;

  double V[n][n];

  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){

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


  }

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

  return 0;
}

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

int main(){
    int G[N][N] = {{0}};
    int n, id, k, adj;
    cin >> n;

    for(int i=1;i<=n;i++){
        cin >> id >> k;
        for(int j=1;j<=k;j++) {
            cin >> adj;
            G[id][adj] = 1;
        }
    }

    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++) {
            if(j==1) cout << G[i][j];
            else cout << " " << G[i][j];
        }
        cout << endl;
    }

    return 0;
}