Go: package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	g := make([][]int, n)

	for i := 0; i < n; i++ {
		g[i] = make([]int, n)
	}

	for i := 0; i < n; i++ {
		u := getNextInt(scanner)
		k := getNextInt(scanner)
		u--
		for ii := 0; ii < k; ii++ {
			v := getNextInt(scanner)
			v--
			g[u][v] = 1
		}
		fmt.Fprintln(writer, joinint(g[u], " "))
	}

	writer.Flush()
}

func joinint(a []int, sep string) string {
	n := len(a)
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		ss[i] = fmt.Sprintf("%d", a[i])
	}
	return strings.Join(ss, sep)
}

C++: #include <iostream>

using namespace std;

const int N = 100;

int main() {
	int n;
	cin >> n;
	bool relation[N+1][N+1] = {false};
	
	for (int i=0;i<n;i++) {
		int x,k;
		cin >> x >> k;
		x--;//转换为零起点
		for (int j = 0;j<k;j++) {
			int y;
			cin >> y;
			y--;//转换为零起点
			relation[x][y] = true; 
		}
	}
	
	for (int i= 0;i<n;i++) {
		for (int j = 0;j<n;j++) {
			cout << (short)relation[i][j];
			if (j != n-1) {
				cout << " ";
			} else {
				cout << endl;
			}
		}
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<vector<int>> ans(101,vector<int>(101,0));

    for(int i=0;i<n;i++){
        int a,b,k;
        cin>>a>>k;
        for(int j=0;j<k;j++){
            cin>>b;
            ans[a][b]=1;
        }
    }

    for(int i=1;i<n+1;i++){
        for(int j=1;j<n+1;j++){
            if(j-1) cout<<' ';
            cout<<ans[i][j];
        }
        cout<<endl;
    }
}

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

int G[110][110];
int n;
int u, k, v;

void Hyoji(int N) {
  for(int i=0; i<N; i++) {
    for(int j=0; j<N; j++) {
      printf("%d", G[i][j]);
      if (j < N-1) {
	printf(" ");
      }
    }
      printf("\n");
  }
}

int main() {
  fill(&G[0][0], &G[0][0]+110*110, 0);
  scanf("%d", &n);
  for (int i=0; i<n; i++) {
    scanf("%d%d", &u, &k);
    u--;
    for (int j=0; j<k; j++) {
      scanf("%d", &v);
      v--;
      G[u][v] = 1;
    }
  }
  Hyoji(n);
}

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

return0;
}

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

int main() {
	int n;
	cin >> n;
	int Adj[101][101] = {{0}};
	for (int i = 0;i < n;i++) {
		int th;
		cin >> th;
		int k;
		cin >> k;
		int adj;
		if(k>0)
		for (int j = 0;j < k;j++) {
			cin >> adj;
			Adj[th-1][adj-1] = 1;
		}
	}

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

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

bool A[110][110];

int main (){
	int n,a,b,c;
	cin>>n;
	for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				A[i][j]=false;
		}
	}
	for(int i=1;i<=n;i++){
		cin>>a>>b;
		for(int j=1;j<=b;j++){
			cin>>c;
			A[a][c]=true;
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			cout<<A[i][j]<<(j==n?"\n":" ");
		}
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <list>
#include <stack>

typedef long long ll;
using namespace std;
const int mod = 1000000007;


int main() {

    int n; cin >> n;
    vector< vector<int> > Adj(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--;
            Adj[u][v] = 1;
        }
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (j != n-1) {
                cout << Adj[i][j] << ' ';
            }
            else {
                cout << Adj[i][j] << '\n';
            }
        }
    }

}

C++: #include <iostream>

using namespace std;

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

  int** G = new int*[n+1];
  for (int i = 0; i < n; i++) {
    int u,k,v;
    cin >> u >> k;
    G[u] = new int[n+1];
    for (int j = 0; j < k; j++) {
      cin >> v;
      G[u][v] = 1; 
    }
  }

  for (int i = 1; i <= n; i++) {
    cout << G[i][1];
    for (int j = 2; j <= n; j++) {
      cout << " " << G[i][j];
    }
    cout << endl;
  }

  return 0;
}

C++: #include<stdio.h>

int dp[50];

int fib(int n){
  if(n==0||n==1) return dp[n]=1;
  if(dp[n]!=-1) return dp[n];
  return dp[n]=fib(n-1)+fib(n-2);
}

int main(){
  int n,i;
  for(i=0;i<50;i++) dp[i]=-1;

  scanf("%d",&n);
  printf("%d\n",fib(n));

  return 0;
}

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

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

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

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (j > 0) {
                cout << " ";
            }
            cout << graph[i][j];
        }
        cout << endl;
    }

}

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

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

  return 0;
}