Go: package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	graph := make([][]int, N)
	for i := range graph {
		graph[i] = make([]int, N)
		var u, k int
		fmt.Scan(&u, &k)
		for j := 0; j < k; j++ {
			var v int
			fmt.Scan(&v)
			v--
			graph[i][v] = 1
		}
	}
	for i := 0; i < N; i++ {
		for j := 0; j < N; j++ {
			if j > 0 {
				fmt.Print(" ")
			}
			fmt.Print(graph[i][j])
		}
		fmt.Println()
	}
}

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

using namespace std;

static const int N = 100;
int n, m[N][N];


int main()
{
	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) {
		int u, d; cin >> u >> d;
		for (int j = 0; j < d; ++j) {
			int v; cin >> v;
			m[u - 1][v - 1] = 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<stdio.h>
#include<stdlib.h>
#pragma warning(disable:4996)

int main()
{
	int a = 0;
	scanf("%d", &a);
	int matrix[101][101] = { 0 };
	for (int i = 0; i < a; i++) {
		int row = 0;
		int column = 0;
		int count = 0;
		scanf("%d", &row);
		scanf("%d", &count);
		for (int j = 0; j < count; j++) {
			scanf("%d", &column);
			matrix[row-1][column - 1] = 1;
		}
	}
	for (int i = 0; i < a; i++) {
		for (int j = 0; j < a; j++) {
			if (j < a - 1) {
				printf("%d ", matrix[i][j]);
			}
			else {
				printf("%d", matrix[i][j]);
			}
		}
		printf("\n");
	}
}

C++: #include <iostream>

using namespace std;
int dat[100][100];

int main(){
	int n, f, v, g;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>f>>v;
		for(int j=1;j<=v;j++){
			cin>>g;
			dat[f][g]=1;
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<n;j++){
			cout<<dat[i][j]<<" ";
		}
		cout<<dat[i][n]<<"\n";
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

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

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define maxn 10005
int n,u,k;
int g[maxn][maxn];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        int v;
        scanf("%d%d",&u,&k);
        for(int j=1;j<=k;j++)
        {
            scanf("%d",&v);
            g[u][v]=1;
        }
    }

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

    return 0;
}

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

#define REP(i,n) for(int i = 0; i < (int)n; ++i)

const int MAX_N = 100;
int G[MAX_N][MAX_N];

int main() {
    REP(i,MAX_N) REP(j,MAX_N) G[i][j] = 0;
    int N; cin >> N;
    for(int i = 0; i < N; i++) {
        int u, k; cin >> u >> k; u--;
        while(k--) {
            int v; cin >> v; v--;
            G[u][v] = 1;
        }
    }
    for(int i = 0; i < N; i++)
        for(int j = 0; j < N; j++)
            cout << G[i][j] << " \n"[j == N - 1];
}

C++: #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int main()
{
    int N;
    cin >> N;
    int G[N][N];
    REP(i,N){
        REP(j,N){
            G[i][j] = 0;
        }
    }
    REP(i,N){
        int U,K,v;
        cin >> U >> K;
        U--;
        REP(k,K){
            cin >> v;
            v--;
            G[U][v] = 1;
        }
    }
    REP(i,N){
        REP(j,N){
            if(0 == j)cout << G[i][j];
            else cout << " " << G[i][j];
        }
        cout << endl;
    }
}

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

C++: #include <iostream>

using namespace std;

int main(){

  int n,u,k,v,graph[106][106]={{}};

  cin >> n ;

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

  for(int i = 1; i<= u; i++){
    for(int j = 1; j<= u; j++){
      if(j != 1) cout <<  ' '<< graph[i][j] ;
      else cout << graph[i][j] ;
    }
    cout << endl;
  }


  return 0;
}

C++: #include <stdio.h>
#define N 102

int main(){

  int u,k,i,j,v,n;
  int a[N][N];
 
  scanf("%d",&n);

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

  return 0;

}

C++: #include <iostream>
using namespace std;
static 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 <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;


int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<vector<int>> edge(110);
    int n; cin>>n;
    for(int i=0; i<n; i++)
    {
        int u; cin>>u;
        u--;
        int k; cin>>k;
        if(k!=0) {
        for(int j=0; j<k; j++){
            int v; cin>>v;
            v--;
            edge[u].push_back(v);
        }
    }
    }
    for(int i=0; i<n; i++){
        vector<int> ans(n,0);
        for(int j=0; j<edge[i].size(); j++){
            ans[edge[i][j]]++;
        }
        for(int k=0; k<n; k++){
            cout<<ans[k]<<(k==n-1?'\n':' ');
        }
    }
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k,u,d;
    cin>>n;
    vector<vector<int> > Adj(n,vector<int>(n,0));
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            Adj[i][j]=0;
        }
    }
    for(int i=0;i<n;i++){
        cin>>k>>u;
        for(int j=0;j<u;j++){
            cin>>d;
            Adj[k-1][d-1]=1;
        }
    }
    
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cout<<Adj[i][j]<<" ";
        }
        cout<<"\n"<<endl;
    }
    
    return 0;
}