Go: package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())
	Adj := make([][]int, n)
	for i := range Adj {
		Adj[i] = make([]int, n)
	}
	for i := 0; i < n; i++ {
		scanner.Scan()
		u, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
		k, _ := strconv.Atoi(scanner.Text())
		if k == 0 {
			continue
		}
		for i := 0; i < k; i++ {
			scanner.Scan()
			v, _ := strconv.Atoi(scanner.Text())
			Adj[u-1][v-1] = 1
		}
	}
	for i := range Adj {
		for j := range Adj[i] {
			fmt.Printf(" %d", Adj[i][j])
			if j == n-1 {
				fmt.Println()
			}
		}
	}
}

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

#define REP(i, n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
const int INF = 1e9;

using namespace std;
vector<int> adj[100];
int res[100][100] = {0};

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

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

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

C++: #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int e[105][105];
int main()
{
    int n;
    int k,m,p;
    memset(e,0,sizeof(e));
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&k);
        scanf("%d",&m);
        for(int j=1;j<=m;j++)
        {
            scanf("%d",&p);
            e[k][p] = 1;
        }
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            if(j != n)
                printf("%d ",e[i][j]);
            else
                printf("%d",e[i][j]);
        }

        printf("\n");
    }
    return 0;

}

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

int n;
int M[101][101];
int main() {
    cin >> n;

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

    for (int l = 1; l <= n; ++l) {
        for (int i = 1; i <= n; ++i) {
            cout << M[l][i];
            if (l != n && i != n) cout << " ";
        }
        if (l != n)
        cout << endl;
    }

    return 0;
}

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

#define 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>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

int mat[101][101];

int main(int argc,char* argv[]){
  memset(mat,0,sizeof(mat));
  int n,v,cnt,x;

  cin>>n;
  for(int i=0;i<n;i++){
    cin>>v>>cnt;
    for(int j=0;j<cnt;j++){
      cin>>x;
      mat[v][x]=1;
    }
  }

  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      cout<<mat[i][j];

      if(j!=n)
	cout<<" ";
    }
    cout<<endl;
  }
  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));
    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";
    }
    
    return 0;
}

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

int main(void){
  ios::sync_with_stdio(false);
  cin.tie(0);

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

C++: #include <iostream>
using namespace std;
int main(){
	int N;
	cin>>N;
	int u,k;
	int v[k];
	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){
		cin>>u>>k;
		for(int j=0;j<k;++j){
			cin>>v[j];
			G[u-1][v[j]-1]=1;  //??£??\????????????ID??§??????"u"???1???????§????????????§?????????????????????u-1??¨??????
		}	
	}
	for(int i=0;i<N;++i){
		for(int j=0;j<N;++j){
			cout <<G[j][i]<< " ";
		}
		cout<<endl;
	}
}

C++: #include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<vector>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
const long long mod = 1e9 + 7;

int main(){
    int n, node, d, p;
    cin >> n;
    int a[n][n];
    rep(i, n)rep(j, n) a[i][j] = 0;
    rep(i, n){
        cin >> node >> d;
        rep(i, d){
            cin >> p;
            a[node - 1][p - 1] = 1;
        }
    }
    rep(i, n){
        rep(j, n){
        if(j) cout << " ";
        cout << a[i][j];
        }
        cout << endl;
    }
}

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

int G[110][110] ={0};

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

C++: #include<bits/stdc++.h>
using namespace std;
int M[101][101];
int main(){
  int n,u,k,v;
  cin>>n;
  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>
#include <queue>
#include <stack>
#include <cstdio>
#include <vector>
#include <sstream>
#include <stdio.h>
#include<cstdio>

#include<string>
//#include<cmath>
//#include<map>
//#include<cstdlib>
#include<deque>
//#include<queue>
//#include<climits>
#include<cstring>
using namespace std;

const int N_MAX = 1000000;

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

  // table
  int** table = new int*[N];
  for(int i=0; i<N; i++){
    table[i] = new int[N];
    memset(&table[i][0], 0, N*sizeof(table[i][0]));
    // &table[i][0] can be table[i] because it only needs head address.
    
    //[..., [int, int,int], ...]
    // memset(start_addr, 0, delta_arr) fills
    // start_addr to (start_addr + delta_arr) by 0.
    // table[i] refers to the first addr of table[i],
    // for each integer to be filled by 0, size of the element
    // (not table[i]) should be given.
  }
  
  for(int i=0; i<N; i++){
    int row_num, k;
    cin >> row_num >> k;

    row_num--;
    
    for(int j=0; j<k; j++){
      int col_num;
      cin >> col_num;
      col_num--;
      table[row_num][col_num] = 1;
    }
  }

  //print table
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
      cout << table[i][j];
      if(j!=N-1) cout << " ";
      else cout << endl;
    }
  }
  
  for(int i=0; i<N; i++){
    delete[] table[i];
  }
  delete[] table;
  
  return 0;
}