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

int main()
{
    int n,k,x,u;
    int A[100][100]={};
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>u>>k;
        if(k==0)
            continue;
        for(int j=0;j<k;j++)
        {
            cin>>x;
            A[u][x-1]=1;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
                cout<<A[i][j];
            if(j!=n-1)
                cout<<" ";
        }
        cout<<endl;
    }
    return 0;
}

C++: #include<iostream>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REP(j, n) for(int j = 0;j < n;j++)
using namespace std;

int main()
{
	int i,n,u,k;
	int v[100][100];
	cin >> n;
	REP(i,n){
		cin >> u;
		cin >> k;
		REP(i,k){
			cin >>v[i][k];
		}
	}
	REP(i,n){
		REP(j,n){
			cout << v[i][j] << " ";
		}
		cout<<endl;
	}
}

C++: #include <iostream>

constexpr int MAXN = 100;
int V[MAXN][MAXN];
int D[MAXN];
int F[MAXN];

template<int STACK_SIZE, typename T = int>
class Stack {

public:
    Stack() {};

    void Push(T val) {
        if (top_ < STACK_SIZE) {
            stack_[top_++] = val;
        }else{
            std::cerr << "Stack over flow..." << std::endl;
            exit(-11);
        }
    };
    bool Pop() {
        if (top_ > 0) {
            stack_[--top_];
            return true;
        }
        return false;
    };

    T Top() {
        return stack_[top_ - 1];
    }

    int Size() {return top_;}


private:
    int max_size_ = STACK_SIZE;
    int top_ = 0;
    T stack_[STACK_SIZE];
};

Stack<MAXN, int> S;

int main() {

    int n;
    std::cin >> n;

    for (int i = 0; i < n; i++) {
        int id, e_num;
        std::cin >> id >> e_num;
        for (int j = 0; j < e_num; j++) {
            int t;
            std::cin >> t;
            V[id - 1][t - 1] = 1;
        }
    }
    int cnt = 0;
    for (int t = 0; t < n; t++) {
        if (D[t] == 0) {
            D[t] = ++cnt;
            S.Push(t);
            while (S.Size()) {
                for (int i = 0; i < n; i++) {
                    if ((V[S.Top()][i] == 1) && (D[i] == 0)) {
                        S.Push(i);
                        D[i] = ++cnt;
                        break;
                    }
                    if (i == n - 1) {
                        F[S.Top()] = ++cnt;
                        S.Pop();
                    }
                }
            }
        }
    }

    for (int i = 0; i < n; i++) {
        std::cout << i + 1 << " " << D[i] << " " << F[i] << std::endl;
    }

}

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

const int N = 1000;
vector<vector<int>> G(N,vector<int>(N,0));

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

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

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

  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <cstring>

#define LP(i,n) for(int i=0;i<n;i++)
#define Mset(x,v) memset(x,v,sizeof(x))

using namespace std;
using LL=long long;

int A[110][110];

int main(){
    int n,m,a,b;
    cin>>n;
    LP(i,n){
        cin>>a>>m;
        LP(j,m){
            cin>>b;
            A[a-1][b-1]=1;
        }
    }
    LP(i,n){
        LP(j,n){
            if(j==n-1) cout<<A[i][j]<<endl;
            else cout<<A[i][j]<<" ";
        }
    }
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#define Lens 100
using namespace std;
int N;
int A[Lens][Lens];

int main()
{
	cin >> N;
	for (int i = 1; i <= N; i++)
	{
		int k, n;
		cin >> k >> n;
		for (int i = 0; i < n; i++)
		{
			int j;
			cin >> j;
			A[k][j] = 1;
		}
	}
	for (int i = 1; i <= N; i++)
	{
		for (int j = 1; j <= N; j++)
		{
			if (j > 1)
				cout << ' ';
			cout << A[i][j];
		}
		cout << endl;
	}
	return 0;
}

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

int main() {
    int n;
    int from_num, num; 
    std::cin >> n;
    std::vector<std::vector<int>> vec(n, std::vector<int>(n, 0));
    for (int i = 0; i < n; i++) {
        std::cin >> from_num;
        std::cin >> num;
        int node_num;
        for (int p = 0; p < num; p++) {
            std::cin >> node_num;
            vec[from_num-1][node_num-1] = 1;
        }
    }
    for (int i = 0; i < n; i++) {
        for (int p = 0; p < n; p++) {
            std::cout << vec[i][p];
            if (p == n - 1) {
                std::cout << std::endl;
            }
            else {
                std::cout << " ";
            }
        }
    }
}

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

#define check cout<<"-------"<<endl
#define debug(x) cout<<x<<endl;

#define N 101

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a[N][N] = {};
    int n;
    cin>>n;
    
    int u, k, v;
    for(int i = 0; i < n; i++) {
        cin>>u>>k;
        
        for(int j = 0; j < k; j++) {
            cin>>v;
            a[u][v] = 1;
        }
    }
    
    int i, j;
    for(i = 1; i <= n; i++) {
        for(j = 1; j < n; j++) {
            cout<<a[i][j]<<' ';
        }
        cout<<a[i][j]<<endl;
    }
    
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;
const int maxn=100+10;
int n;
int g[maxn][maxn];
int main()
{
//    freopen("in.txt","r",stdin);
    scanf("%d",&n);
    int no,cnt,dd;
    memset(g,0,sizeof(g));
   for(int i=0;i<n;i++)
    {
        scanf("%d%d",&no,&cnt);
        for(int j=0;j<cnt;j++)
        {
            scanf("%d",&dd);
            g[no-1][dd-1]=1;
        }
    }
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(j) printf(" ");
            printf("%d",g[i][j]);
        }
        printf("\n");
    }

    return 0;
}

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

int main() {
    ll n;
    cin >> n;
    vector<vector<ll>> mat(n,vector<ll>(n,0));
    for(ll i=0;i<n;i++) {
        ll u,k;
        cin>>u>>k;
        for(ll j=0;j<k;j++) {
            ll tmp;
            cin>>tmp;
            mat[u-1][tmp-1] = 1;
        }
    }
    for(ll i=0;i<n;i++) {
        for(ll j=0;j<n;j++) {
            if(j<n)cout << mat[i][j] << " ";
            else cout << mat[i][j];
        }
        cout << endl;
    }
}

C++: #include<iostream>
#include<string>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <algorithm>
#include <cstdlib>
using namespace std;
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}

int main() {
	vector<vector<int> > M(100,vector<int>(100,0));
	int N, U, K, V;
	cin >> N;
	int i, j;
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			M.at(i).at(j)=0;
		}
	}
	for (i = 0; i < N; i++) {
		cin >> U >> K;
		U--;
		for (j = 0; j < K; j++) {
			cin >> V;
			V--;
			M.at(U).at(V) = 1;
		}
	}
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			if (j) {
				cout << " ";
			}
			cout << M.at(i).at(j);
		}
		cout << endl;
	}
}