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>
#define SIZE 100

using namespace std;

int main(void) {

	int n, c, v;
	int G[SIZE][SIZE];
	int A[SIZE][SIZE];

	cin >> n;

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

	for (int i = 0; i < n; i++) {
		cin >> v;
		cin >> c;
		for (int j = 0; j < c; j++) {
			cin >> G[i][j];
			int tmp = G[i][j];
			if (tmp > 0) {
				A[i][tmp - 1] = 1;
			}
		}
	}

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

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

using namespace std;
typedef pair<int,int> p;

int main(void){
  int n,a,b,c;
  cin >> n;
  int 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 >> a >> b;
    for(int j=0;j<b;j++){
      cin >> c;
      v[a-1][c-1]=1;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(v[i][j]!=1)cout << 0;
      else cout << v[i][j];
      if(j!=n-1)cout << ' ';
    }
    cout << endl;
  }
  return 0;
}

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

int main(){
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
        int u,k,p,a[100+10]={};
        cin >> u >> k;
        for(int j=0;j<k;j++){
            cin >> p;
            a[p-1]=1;
        }
        cout << a[0];
        for(int l=1;l<n;l++) cout << " " << a[l];
        cout << endl;
    }
}

C++: #include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main(){
	int n;
	int P[105][105]={};

	cin>>n;

	for(int i=0;i<n;i++){
		int x;cin>>x;
		
		int y;cin>>y;
		for(int j=0;j<y;j++){
			int Y;
			cin>>Y;
			Y;
			P[x][Y]=1;
		}

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

	return 0;
}

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

using namespace std;

class Graph{
private:
 vector< vector<unsigned long> > graph;
public:

 Graph(unsigned long num) : graph(num+1, vector<unsigned long>(num+1, 0)){
  for(unsigned long row_i = 0; row_i < num; ++row_i){
   unsigned long nodeNum = 0; cin >> nodeNum;
   unsigned long nodeMax = 0; cin >> nodeMax;

   for(unsigned long node_i = 0; node_i < nodeMax; ++node_i){
    unsigned long adjectNode = 0; cin >> adjectNode;

    graph[nodeNum][adjectNode] = 1;
   }
  }

 };

 void display(){
  for(unsigned long i = 1, num = graph.size(); i < num; ++i){
   for(unsigned long j = 1; j < num; ++j){
    cout << " " << graph[i][j];
   }
   cout << endl;
  }
 };

protected:
};

int main(){

 unsigned long num = 0; cin >> num;

 Graph g(num);
 g.display();

 return 0;
};

C++: #include<iostream>
#define SIZE 100

using namespace std;

int main(void) {

	int n, c, v;
	int G[SIZE][SIZE];
	int A[SIZE][SIZE];

	cin >> n;

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

	for (int i = 0; i < n; i++) {
		cin >> v;
		cin >> c;
		for (int j = 0; j < c; j++) {
			cin >> G[v-1][j];
			int tmp = G[v-1][j];
			if (tmp > 0) {
				A[v-1][tmp - 1] = 1;
			}
		}
	}

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

}

C++: #include<bits/stdc++.h>
using namespace std;
#define MAXN 102
int G[MAXN][MAXN];
int main(){
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++){
        int u, k;
        cin >> u >> k;
        for(int j = 1; j <= k; j++){
            int v;
            cin >> v;
            G[u][v] = 1;
        }
    }
    for(int i = 1; i < n; i++){
        for(int j = 1; j < n; j++){
            cout << G[i][j] << ' ';
        }
        cout << G[i][n] << endl;
    }
    for(int j = 1; j < n; j++){
        cout << G[n][j] << ' ';
    }
    cout << G[n][n];
    return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
static const int MAX  = 101;
int main ()
{
  int n,u,k,v;
  cin>>n;
  int M[MAX][MAX];
  for(int i  = 1;i<=n;i++)
    {
      for(int j = 1;j<=n;j++)
        {
          M[i][j] = 0;
        }
    }
  for(int i = 1;i<=n;i++)
   {
     cin>>u>>k;
     for(int j = 1;j<=k;j++)
       {
         cin>>v;
         M[u][v] = 1;
       }
   }
   for(int i = 1;i<=n;i++)
     {
       for(int j = 1;j<=n;j++)
        { if(j-1) cout<<" ";
          cout<<M[i][j];
     }
     cout<<endl;
   }
  return 0 ;
}

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

int n;
int k;


int main(){
  int num;
  cin>>n;
  int adj[n][n];
  int rin;
  int i=0,j=0;
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      adj[i][j]=0;
    }
  }
  for(i=0;i<n;i++){
    cin>>num>>k;
    num--;
    for(j=0;j<k;j++){
      cin>>rin;
      rin--;
      adj[num][rin]=1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j)cout<<" ";
      cout<<adj[i][j];
    }
    cout<<endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
        int n, u, k, v;
        int g[100][100];

        cin >> n;
        for (int i = 0; i < n; i++) {
                cin >> u >> k;
                if (k > 0) {
                        for (int j = 0; j < k; j++) {
                                cin >> v;
                                g[u - 1][v - 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;
        }

        return 0;
}

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

using P = pair<int,int>;

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

C++: #include <bits/stdc++.h>
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;
}