Go: package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	g := make([][]int, n)
	for i := 0; i < n; i++ {
		g[i] = make([]int, n)
	}

	for i := 0; i < n; i++ {
		var u,k int
		fmt.Scan(&u)
		fmt.Scan(&k)
		for j := 0; j < k; j++ {
			var v int
			fmt.Scan(&v)
			g[u-1][v-1] = 1
		}
	}

	for i := 0; i < n; i++ {
		fmt.Print(g[i][0])
		for j := 1; j < n; j++ {
			fmt.Printf(" %d", g[i][j])
		}
		fmt.Println()
	}
}

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

C++: // ALDS1_11_A.cpp
// Graph I - Graph

#include <iostream>
#include <vector>
using namespace std;

void print(vector<vector<int>> &A, int n)
{
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (j > 0) cout << " ";
            cout << A[i][j];
        }
        cout << endl;
    }
}

int main()
{
    int n;
    cin >> n;
    int id;
    int num;
    vector<vector<int>> A(n, vector<int>(n));
    for (int i = 0; i < n; i++) {
        cin >> id >> num;
        if (num == 0) continue;
        else {
            int tmp;
            for (int j = 0; j < num; j++) {
                cin >> tmp;
                A[id - 1][tmp - 1] = 1;
            }
        }
    }

    print(A, n);

    return 0;
}

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++){
    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] << ' ';
    }
    cout << endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

#define N 100

int main()
{
	int m[N][N] = {0};
	
	int n;	cin >> n;

	int v, in, out;
	for (int i = 0; i < n; ++i)
	{
		cin >> in >> v;
		for (int j = 0; j < v; ++j)
		{
			cin >> out;
			m[in - 1][out - 1] = 1;
		}
	}

	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			cout << m[i][j];
			if (j != n - 1) cout << " ";
			else cout << endl;
		}
	}

	return 0;
}

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

int main() {
	int n,u,k,v;
	int i,j;
	vector<vector<int> > V;
	scanf("%d",&n);
	V.resize(n);
	for(i=0; i<n; ++i) {
		V[i].resize(n);
		for(j=0; j<n; ++j) {
			V[i][j]=0;
		}
	}
	for(i=0; i<n; ++i) {
		scanf("%d%d",&u,&k);
		for(j=0; j<k; ++j) {
			scanf("%d",&v);
			V[u-1][v-1]=1;
		}
	}
	for(i=0; i<n; ++i) {
		for(j=0; j<n-1; ++j) {
			printf("%d ",V[i][j]);
		}
		printf("%d\n",V[i][n-1]);
	}
	return 0;
}

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

using namespace std;

class Vertex
{
public:
    int number_of_edges;
    vector<int> edges;
};

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

    vector<Vertex> adjacency_list(n);
    for (int i = 0; i < n; ++i) {
        int index;
        cin >> index >> adjacency_list[i].number_of_edges;

        adjacency_list[i].edges.resize(adjacency_list[i].number_of_edges);
        for (int j = 0; j < adjacency_list[i].number_of_edges; ++j)
            cin >> adjacency_list[i].edges[j];
    }

    vector<vector<int>> adjacency_matrix(n, vector<int>(n, 0));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < adjacency_list[i].number_of_edges; ++j)
            adjacency_matrix[i][adjacency_list[i].edges[j] - 1] = 1;
    }

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