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<cstdio>
using namespace std;

int main(){
  int n,u,k;
  int ad;
  int arr[200][200] = {0};
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    cin >> u >> k;
    for(int i=0;i<k;i++){
      cin >> ad;
      arr[u][ad] = 1;
    }
  }

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

C++: #include<bits/stdc++.h>
#include<string>
#include<cctype>
#include<cmath> 
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
 
int main(){
  int n,i,j;
  cin >> n;
  int u[n];
  int k[n];
  int G[n][n];

  rep(i,n){
    rep(j,n){
      G[i][j]=0;
    }
  }
   
  rep(i,n){
    cin >> u[i] >> k[i];
    int v=k[i];
    int v2[v];
    rep(j,v){
      cin >> v2[j];
      G[u[i]-1][v2[j]-1]=1;
    }
  }

  
  rep(i,n){
    rep(j,n-1){
      cout << G[i][j] <<' ';
    }
    cout << G[i][n-1] << '\n';
  }

  return 0;
}

C++: #include <iostream>
using namespace std;
static const int 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<Miostream>

C++: #include<stdio.h>
typedef struct{
  int u;
  int k;
  int v[100];
}Graph;

main(){
  int i,j,n;
  int a[100][100];
  Graph node[100];
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&node[i].u);
    scanf("%d",&node[i].k);
    for(j=0;j<node[i].k;j++)scanf("%d",&node[i].v[j]);
  }

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      a[i][j]=0;
    }
    for(j=0;j<node[i].k;j++){
      a[i][node[i].v[j]-1] = 1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      printf("%d",a[i][j]);
    }
    if(i<n)printf("\n");
  }

  return 0;
}

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

int main(){
    int n,i,j,v,u,k;
    cin>>n;
    int A[n+1][n+1];
    for(i=0;i<=n;i++)for(j=0;j<=n;j++)A[i][j]=0;
    for(i=0;i<n;i++){
        scanf("%d %d",&v,&u);
        for(j=0;j<u;j++){scanf("%d",&k);A[v][k]++;}
    }
    for(i=1;i<=n;i++){
        for(j=1;j<=n;j++){
            if(j!=1)printf(" ");
            printf("%d",A[i][j]);
        }
        printf("\n");
    }
}

C++: #include<cstdlib>
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN = (int)1e2 + 10;

int n;
int a[MAXN][MAXN];

void work(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        int u,k; scanf("%d%d",&u,&k);
        for(int j=1;j<=k;j++){
            int v; scanf("%d",&v);
            a[u][v]=1;
        }
    }
    for(int i=1;i<=n;i++){
        printf("%d",a[i][1]);
        for(int j=2;j<=n;j++) printf(" %d",a[i][j]);
        printf("\n");
    }
}

int main(){
    work();
    return 0;
}

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

int G[MAX][MAX]={};

void print(int n){
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      if(j!=n)cout<<G[i][j]<<" ";
      else cout<<G[i][j];
    }
    cout<<endl;
  }
}
  
int main(){
  int n,i,k,j,A,B;
  cin>>n;
  for(i=0;i<n;i++){
    cin>>A>>k;
    for(j=0;j<k;j++){
      cin>>B;
      G[A][B]=1;
    }
  }
  print(n);
}

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

static const int Q = 1000;

int main(){
  int M[Q][Q],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 <bits/stdc++.h>
using namespace std;

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
// #define SORT(v, n) stable_sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int n = 100;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // cout << fixed << setprecision(5);

    int m[n][n];
    int n, u, k, v;
    cin >> n;
    rep(i, n) {
        rep(j, n) { m[i][j] = 0; }
    }

    rep(i, n) {
        cin >> u >> k;
        u--;  // 0-indexに変換
        rep(j, k) {
            cin >> v;
            v--;          // 0-indexに変換
            m[u][v] = 1;  // uとvの間に辺を張る。
        }
    }
    rep(i, n) {
        rep(j, n) {
            if (j) cout << " ";
            cout << m[i][j];
        }
        cout << endl;
    }

    return 0;
}

C++: #include<stdio.h>
typedef struct{
  int u;
  int k;
  int v[100];
}Graph;

main(){
  int i,j,n;
  int a[100][100];
  Graph node[100];
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&node[i].u);
    scanf("%d",&node[i].k);
    for(j=0;j<node[i].k;j++)scanf("%d",&node[i].v[j]);
  }

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      a[i][j]=0;
    }
    for(j=0;j<node[i].k;j++){
      a[i][node[i].v[j]-1] = 1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      printf("%d",a[i][j]);
    }
    if(i<n)printf("\n");
  }

  return 0;
}

C++: #include <iostream>
using namespace std;
static const int 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>
using namespace std;
static const int 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;
}