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 <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<array>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){


    int n;
    cin>>n;
    int ar[n+1][n+1];
    for(int i=0;i<n+1;i++){
        for(int j=0;j<n+1;j++){
            ar[i][j]=0;
         
        }
    }
    
    for(int i=1;i<n+1;i++){
        
        int x,y;
        cin>>x>>y;
        for(int j=0;j<y;j++){
            int t;
            cin>>t;
            ar[x][t]=1;
        }
    }
    
    for(int i=1;i<n+1;i++){
        for(int j=1;j<n+1;j++){
            cout<<ar[i][j];
            if(j!=n)cout<<" ";
            else cout<<endl;
        }
    }




return 0;
}

C++: 
#include <iostream>
using namespace std;
int main() {
    int n,p,q;
    cin>>n;
    int A[100][100]={0};
    for (int i=0;i<n;i++){
        cin>>q>>p;
        if (p==0)
            continue;
        for (int j=0;j<p;j++){
            int x;
            cin>>x;
            A[q][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 <stdio>

using namespace std;

int main(){
  int g[10010][10010]={};//要素を0で初期化
  int n,a,b,c;
  cin >> n;
  for (int i = 0; i < n; ++i)
   {
     cin >> a >> b ;
     for (int i = 0; i < b; ++i)
     {
       cin >> c
       g[a-1][c-1]=1;/* code */
     }
   }
   for (int i = 0; i < n; ++i)
   {
     for (int j = 0; j < n; ++i)
     {
      if (j==n-1)
      {
        cout << g[i][j] << endl;
      }else{
        cout << g[i][j] <<" " 
      }
     }
   }

}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>

using namespace std;

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

	int n;
	cin >> n;

	int g[n][n] = {};
	for(int i=0;i<n;i++){
		int u, nume;
		cin >> u >> nume;

		int v;
		for(int j=0;j<nume;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] << " ";
		}
		cout << "\n";
	}
	
	return 0;
}

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

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

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

int main(){
   
    int N;cin>>N;
    vector<vector<int>> S(N,vector<int>(N,0));
    for(int i=0;i<N;i++){
        int a,b;cin>>a>>b;
        for(int j=0;j<b;j++){
            int k;cin>>k;
            S[i][k-1]=1;
        }
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(j) cout<<" ";
            cout<<S[i][j];
        }
        cout<<endl;
    }
}

C++: #include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>

using namespace std;
    
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <limits>
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<vector<int>> vec(n);
    vector<int> SIZE;
    for(int i=0;i<n;i++){
        int x;
        cin >> x;
        int num;
        cin >> num;
        SIZE.push_back(num);
        for(int j = 0;j< num;j++){
            int y;
            cin >> y;
            vec[x-1].push_back(y-1) ;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            bool hantei=0;
            for(int k=0;k<SIZE[i];k++){
                
                if(vec[i][k]==j) {
                    if(j!=n-1){
                        cout << 1 <<" "; 
                        hantei = 1;
                    }else{
                        cout << 1;
                        hantei = 1;
                    }    
                }
            }
            if(hantei==0){ 
                if(j!=n-1){
                    cout <<0<<" ";
                }else{
                    cout << 0;
                }
                
            }
        }cout << endl;
    }
}

C++: #include <iostream>
#include<stdio.h>

#define MAX 100
using namespace std;

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

C++: #include<iostream>
#include<cstring>
using namespace std;
int graph[110][110];

int main(){
    int n,u,k,num;
    cin>>n;
    memset(graph,0,sizeof(graph));
    for(int i=1;i<=n;i++){
        cin>>u>>k;
        while(k--){
            cin>>num;
            graph[u][num]=1;
        }
    }

    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
            cout<<graph[i][j]<<(j==n?"\n":" ");
}

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

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

  int mat[100][100];
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      mat[i][j]=0;

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

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

  return 0;
}

C++: //16D8103013E Sen Shunkou
#include<iostream>
int main(){
    int n;
    std::cin>>n;
    int A[n][n];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            A[i][j]=0;
        }
    }
    int tmp,s,e;
    for(int i=0;i<n;i++){
        std::cin>>s;
        std::cin>>tmp;
        for(int j=0;j<tmp;j++){
            std::cin>>e;
            A[s-1][e-1]=1;
        }
    }

    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(j==0){
                std::cout<<A[i][j];
            }else std::cout<<" "<<A[i][j];
        }
        std::cout<<"\n";
    }
    return 0;
}