Go: package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
)

const N = 100

func answer(reader io.Reader) string {
	sc := bufio.NewScanner(reader)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())

	var M [N][N]int
	for i := 0; i < n; i++ {
		sc.Scan()
		u, _ := strconv.Atoi(sc.Text())
		sc.Scan()
		k, _ := strconv.Atoi(sc.Text())
		u--
		for j := 0; j < k; j++ {
			sc.Scan()
			v, _ := strconv.Atoi(sc.Text())
			v--
			M[u][v] = 1
		}
	}

	var out bytes.Buffer
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if j != 0 {
				out.WriteString(" ")
			}
			out.WriteString(fmt.Sprintf("%d", M[i][j]))
		}
		out.WriteString("\n")
	}

	return strings.TrimRight(out.String(), "\n")
}

func main() {
	fmt.Println(answer(os.Stdin))
}

C++: #include <cstdio>
#define N 100
int main(){
    int M[N][N];
    int n,u,k,v;
    scanf("%d\n",&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++){
   scanf("%d%d",&u,&k);
    u--;
    for(int j=0;j<k;j++){
       scanf("%d",&v);
        v--;
        M[u][v]=1;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
        if(j)printf(" ");
       printf("%d",M[i][j]);
    }
   printf("\n");
  }
  return 0;
}

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

#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;
	int v[100][100];

	cin >> n;

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

	for (int i = 0; i < n; i++) {
		int u, k, t;

		cin >> u >> k;

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

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

	return 0;
}

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

struct Edge {
  int source, target;
  Edge(int source, int target): source(source), target(target) {}
};

struct Node {
  std::vector<Edge> edges;
  void addEdge(Edge edge) {
    edges.push_back(edge);
  }
};

class Graph {
private:
  std::vector<Node> nodes;
  int size;
public:
  Graph(int size): size(size) {
    nodes.resize(size);
  }
  void addEdge(int source, int target) {
    nodes[source].addEdge(Edge(source, target));
  }
  void printAdjacencyList() {
    for(Node node: nodes) {
      std::vector<int> hasEdgeTo(size);
      for(Edge edge: node.edges) {
        hasEdgeTo[edge.target] = 1;
      }
      for(auto i: hasEdgeTo) {
        std::cout << i << ' ';
      }
      std::cout << std::endl;
    }
  }
};

int main() {
  int n;
  std::cin >> n;
  Graph graph(n);
  for(int i = 0; i < n; i++) {
    int u, k;
    std::cin >> u >> k;
    for(int j = 0; j < k; j++) {
      int v;
      std::cin >> v;
      graph.addEdge(u - 1, v - 1);
    }
  }
  graph.printAdjacencyList();
}

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

int main() {
	int n;
	int u, k, v;
	cin >> n;
	int a[101][101] = {};
	for (int i = 1;i <= n;++i) {
		cin >> u >> k;
		for (int j = 1;j <k+1;++j) {
			cin >> v;
			a[i][v] = 1;
		}
	}
	for (int i = 1;i <= n;++i) {
		for (int j = 1;j <=n;++j) {
			cout << a[i][j] ;
			if (j!= n)cout << " ";
		}
		cout << endl;
	}
	return 0;
}

C++: #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
 
using namespace std;
 
 
int main()
{
	int matrix[100][100] = {0};
	int n;
	cin>>n;
	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--;
			matrix[u][v] = 1;
		}
	}
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n;j++){
			if( j != 0) cout<<" ";
			cout<<matrix[i][j];
		}
		cout<<endl;
	}

	return 0;
}

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

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

    vector<vector<int>> M(N, vector<int>(N, 0));

    int u, k, v;
    for (int i = 0; i < N; i++)
    {
        cin >> u >> k;
        u--; // 0オリジンへ変更
        for (int j = 0; j < k; j++)
        {
            cin >> v;
            v--; // 0オリジンへ変更
            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 <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <cstdlib>
#include <queue>
#include <vector>
#include <set>

using namespace std;
int main() {
	int n,m,l,p;
	cin >> n;
	bool 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 >> m;
		cin >> l;
		for(int j = 0; j < l;j++) {
			cin >> p;
			a[m-1][p-1] = 1;
		}
	}
	for ( int i = 0;i < n;i++) {
		for(int j= 0; j < n;j++) {
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

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

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

    int M[N][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, k;
        cin >> u >> k;
        u--;

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

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

    return 0;
}

C++: You are not allowed to see this code.

C++: #include <iostream>
using namespace std;
static const int N = 100;

int main(void)  {
  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 <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
using namespace std;
const int64_t MOD = 1e9 + 7;

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

	vector<vector<bool>> M(n, vector<bool>(n));
	for (int i = 0; i < n; i++) {
		int v, k;
		cin >> v >> k;

		for (int j = 0; j < k; j++) {
			int x;
			cin >> x;
			M.at(v - 1).at(x - 1) = true;
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (j) cout << ' ';
			cout << M.at(i).at(j);
		}
		cout << endl;
	}
}

C++: #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;

int main(){
  int n; cin >> n;
  int G[n][n];
  FOR(i,0,n) FOR(j,0,n) G[i][j] = 0;
  FOR(i,0,n){
    int u,k;
    cin >> u >> k;
    u--;
    FOR(j,0,k){
      int v;
      cin >> v;
      v--;
      G[u][v] = 1;
    }
  }
  FOR(i,0,n){
    FOR(j,0,n){
      printf("%d%c", G[i][j], j == n - 1 ? '\n' : ' ');
    }
  }
  return 0;
}