Go: package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	g := make([][]int, n)

	for i := 0; i < n; i++ {
		g[i] = make([]int, n)
	}

	for i := 0; i < n; i++ {
		u := getNextInt(scanner)
		k := getNextInt(scanner)
		u--
		for ii := 0; ii < k; ii++ {
			v := getNextInt(scanner)
			v--
			g[u][v] = 1
		}
		fmt.Fprintln(writer, joinint(g[u], " "))
	}

	writer.Flush()
}

func joinint(a []int, sep string) string {
	n := len(a)
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		ss[i] = fmt.Sprintf("%d", a[i])
	}
	return strings.Join(ss, sep)
}

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

int main(){
    //0 0??????????????\??????
    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;
        //??¬??¢???0?????????
        u--;
        for(int j=0;j<k;j++){
            cin>>v;
            //??¬??¢???0?????????
            v--;
            //??¨u???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;
    }
}

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

int main(){
	
	int M[N][N];//定义邻接矩阵 
	
	int n;
	int u,v,k;
	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>0)
				cout<<" ";
			cout<<M[i][j];
		}
		cout<<endl;
	}
	
	return 0;
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <queue>
using namespace std;
struct dot{
	long long int k,p,l,r;
};
int main(int argc, char** argv) {
	int n;
	while(cin>>n){
		int d[n][n];
		for(int i=0;i<n;i++)
			for(int j=0;j<n;j++)
				d[i][j]=0;
		for(int i=0;i<n;i++){
			int a,b;
			cin>>a>>b;
			a--;
			for(int j=0;j<b;j++){
				int c;
				cin>>c;
				d[a][c-1]=1;
			}
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				cout<<d[i][j];
				if(j<n-1)
					cout<<" ";
			}
			cout<<endl;
		}
			
				
	}
	return 0;
}

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


main(){
	int j,m,n,k,i,u;
	int g[101][101];
	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",&k,&u);
		for(j=0;j<u;j++){
			scanf("%d",&m);
			g[k][m]=1;
		}
	}
	for(i=1;i<=n;i++){
	    for(j=1;j<=n;j++){
		printf("%d",g[i][j]);
		if(j<n)
		printf(" ");}
		printf("\n");
	}
	return 0;
}

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

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

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream> 
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define  all(x) (x).begin(),(x).end()
typedef long long ll;

int A[105][105];

int main(){
    int n;
    cin >> n; cin.ignore();
    for(int i = 1; i <= n; i++){
        string s;
        getline(cin, s);
        istringstream ss(s);
        int u, k, v;
        ss >> u >> k;
        for(int j = 0; j < k; j++){
            ss >> v;
            A[u][v] = 1;
        }
    }
    for(int i = 1; i <= n; i++){
        for (int j = 1; j <= n; j++){
            cout << A[i][j];
            if (j != n) cout << " ";
        }
        cout << endl;
    }
}

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

}