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++: #if 0

#endif

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int N;
int GM[110][110];
vector<int> GL[110];

int main() {
  cin >> N;
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++)
      GM[i][j] = 0;
  }
  int u, k;
  for (int i = 1; i <= N; i++) {
    cin >> u >> k;
    int t;
    for (int j = 0; j < k; j++) {
      cin >> t;
      GM[i][t] = 1;
    }
  }
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++)
      cout << GM[i][j] << (j == N ? '\n' : ' ');
  }
}

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

int main(){
    int i,j,n,k,u,v,M[N+1][N+1];

    scanf("%d",&n);

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

    for(i=0;i<n;i++){
        scanf("%d%d",&u,&k);
        for(j=0;j<k;j++){
            scanf("%d",&v);
            M[u-1][v-1]=1;
        }
    }
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            printf("%d ",M[i][j]);
        }
        puts("");
    }
    return 0;
}

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

int main(){
    int n,u,k,v;
    int m[MAX][MAX];
    
    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>

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

int n;
typedef vector<vector<int> > AdjMatrix;
AdjMatrix graph;


int main()
{
    int u,k,v;
    cin >> n;
    graph = AdjMatrix(n, vector<int>(n, 0));
    REP(i,n){
        cin >> u >> k;
        REP(j,k){
            cin >> v;
            graph[u-1][v-1] = 1;
        }
    }


    REP(i, n){
        REP(j, n){
            cout << graph[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
        int n, m, k, r;
        cin>>n;
        int a[n][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>>r;
                cin>>m;
                for(int j=0;j<m;j++){
                        cin>>k;
                        a[r-1][k-1] = 1;
                }
        }
        for(int i=0;i<n;i++){
                for(int j=0;j<n;j++)
                        cout<<a[i][j]<<" ";
                cout<<endl;
        }
        return 0;
}

C++: #include<iostream>
#include<queue>
using namespace std;
void bfs(int src)
{
  queue<int>Q;
  Q.
}

int main()
{
  int n,u,k,v,**M;
  cin>>n;
  M=new int*[n];
  for(int i=0;i<n;i++)
    {
      M[i]=new int[n];
      for(int j=0;j<n;j++)
	M[i][j]=0;
    }
  int count=0;
  while(count<n)
    {
      count++;
      cin>>u>>k;
      for(int i=0;i<k;i++)
	{
	  cin>>v;
	  M[u-1][v-1]=1;
	}
    }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++)
      cout<<' '<<M[i][j];
    cout<<endl;
  }
  delete M;
}

C++: #include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

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

C++: #include<iostream>
using namespace std;
int M[100][100];

int main()
{
    int n;
    int r,node,c;

    cin >> n;

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

    for(int i=0;i<n;i++)
    {
        cin >> r;
        if(i==r-1)
        {
            //cout << "hhh" << endl;
            cin >> node;
            for(int j=0;j<node;j++)
            {
                cin >> c;
                M[r-1][c-1]=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++: #define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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


int main(){
  int n;
  cin>>n;
  
  vector<vector<int>> vec(n, vector<int>(n,0));
  
  int x,y,z;
  rep(i,n){
    cin>>x>>y;
    rep(j,y){
      cin>>z;
      vec[x-1][z-1]=1;
    }
  }
  
  rep(i,n){
    rep(j,n){
      if(j) cout<<" ";
      cout<<vec[i][j];
    }
    cout<<endl;
  }
  
  return 0;
}

C++: // 
// 問題URL: 
// 中央*右
// 

#include <iostream>

using namespace std;

int N, u, k, v, Adj[105][105]={};

int main(){
    cin >> N;

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

    for(int i = 1; i <= N; i++){
        for(int j = 1; j <= N; j++){
            cout << Adj[i][j];
            if(j==N) cout << endl;
            else cout << " ";
        }
    }
}

C++: #include <stdio.h>
int main(){
    int n,a,m,temp,graph[101][101];
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            graph[i][j]=0;
        }
    }
    for(int i=0;i<n;i++){
        scanf("%d%d",&a,&m);
        for(int j=0;j<m;j++){
            scanf("%d",&temp);
            graph[a][temp]++;
        }
    }
    for(int i=1;i<=n;i++){
        printf("%d",graph[i][1]);
        for(int j=2;j<=n;j++){
            printf(" %d",graph[i][j]);
        }
        printf("\n");
    }
}

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

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

    return 0;
}