Go: package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	graph := make([][]int, N)
	for i := range graph {
		graph[i] = make([]int, N)
		var u, k int
		fmt.Scan(&u, &k)
		for j := 0; j < k; j++ {
			var v int
			fmt.Scan(&v)
			v--
			graph[i][v] = 1
		}
	}
	for i := 0; i < N; i++ {
		for j := 0; j < N; j++ {
			if j > 0 {
				fmt.Print(" ")
			}
			fmt.Print(graph[i][j])
		}
		fmt.Println()
	}
}

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

int main(){
    int n;
    cin >> n;
    vector<vector<int> > A(n, vector<int>(n, 0));
    for(int i=0; i<n; ++i){
        int k;
        cin >> k;
        // 1~n???index?????¨????????????????????????????????????1????????????0~n-1????????????
        k -= 1;
        int u;
        cin >> u;
        for(int j=0; j<u; ++j){
            int v;
            cin >> v;
            v -= 1;
            A[k][v] = 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;
    }
}

C++: #include<cstdio>
#define MAX 100
int A[MAX][MAX] = {0};

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

	for(int i=0; i<n; i++)
	{
		for(int j=0; j<n; j++)
		{
			if(j) printf(" ");
			printf("%d", A[i][j]);
		}
		printf("\n");
	}

	return 0;

}

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

int main(){
int M[N][N];
int n,u,v,k;

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


static const int MAX_NUM = 100 + 1;

int main(void)
{
    int i, j;
    int num;
    int elem;
    int elemnum;
    int tmp;
    int matrix[MAX_NUM][MAX_NUM] = {0};


    scanf("%d", &num);
    for (i = 1; i <= num; i++) {
        scanf("%d %d", &elem, &elemnum);
        for (j = 1; j <= elemnum; j++) {
            scanf("%d", &tmp);
            matrix[elem][tmp] = 1;
        }
    }

    for (i = 1; i <= num; i++) {
        for (j = 1; j <= num; j++) {
            printf(" %d", matrix[i][j]);
        }
        printf("\n");
    }

    return 0;
}

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

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

    vector <int> v[n + 1];

    for (int i = 0; i < n; i++) {
        int x, no;
        cin >> x >> no;
        for(int j = 0; j < no; j++) {
            int temp;
            cin >> temp;
            v[x].push_back(temp);
        }
    }
	
//	for(int i=1;i<=n;i++){
//		for(int x:v[i]) cout<< x<< ' ';
//		cout<<endl;
//	}
//	cout<<endl;//deb
	
    for (int i = 1; i <= n; i++) {
        int pre = 1;

        for (int j = 0; j < v[i].size(); j++) {
            for (int k = pre ; k < v[i][j]; k++)
                cout << "0 ";
            
			cout << "1"<< ((v[i][j]==n)?'\n':' ');

            pre = v[i][j] + 1;
        }
        for (int j = pre; j <= n; j++)
            cout << "0" << ((j==n)?'\n':' ');
    }

}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k,u,d;
    cin>>n;
    vector<vector<int> > Adj(n,vector<int>(n,0));
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            Adj[i][j]=0;
        }
    }
    for(int i=0;i<n;i++){
        cin>>k>>u;
        for(int j=0;j<u;j++){
            cin>>d;
            Adj[k-1][d-1]=1;
        }
    }
    
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(j==n-1){
                cout<<Adj[i][j]<<"\n";
            }else{
                cout<<Adj[i][j]<<" ";
            }
        }
    }
    
    return 0;
}

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

int n;


int main(void){

	cin >> n;
	int suji[n];
	int	num[n];
	int adj[n][n];
	int ans[n][n];

	

	for(int i = 0; i < n; i++){
		
		cin >> suji[i] >> num[i];

		
		for(int j = 0; j < num[i]; j++){
			cin >> adj[i][j];
			adj[i][j] -= 1;
		}
	}

	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			ans[i][j] = 0;
		}
	}

	for(int i = 0; i < n; i++){
		for(int j = 0; j < num[i]; j++){
			ans[i][adj[i][j]] = 1;
		}
	}

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



	
    return 0;
}

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

int main(){
    int M[N][N]; // 0?????????????????£??\??????
    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--; // 0?????????????????????
        for( int j = 0; j < k; j++){
            cin >> v;
            v--; // 0?????????????????????
            M[u][v]  = 1; //u??¨v?????????????????????
        }
    }
    
    for ( int i = 0; i < n; i++){
        for (int j = 0; j < n; j++){
            if (j) cout << " "; // j = 0??\???????????????????????\?????§?????????????????\??????
            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 < n; 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;

int main(void) {
	int N = 0;
	cin >> N;

	int* *A = new int*[N];
	for (int i = 0; i < N; i++)
		A[i] = new int[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++) {
		int u, v,w;
		cin >> u;
		u--;

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

	for (int i = 0; i < N; i++){
		for (int j = 0; j < N; j++){
			if (j) cout << " ";
			cout << A[i][j];
		}
		cout << "\n";
	}
}

C++: #include <iostream>

int main()
{
	int n; std::cin >> n;
	
	int** A = new int*[n];
	for (int i=0; i<n; i++) A[i] = new int[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++) {
		int x;
		int deg;
		std::cin >> x >> deg;
		for (int d=0; d<deg; d++) {
			int y;
			std::cin >> y;
			A[x-1][y-1]++;
		}
	}
	
	for (int i=0; i<n; i++) {
		std::cout << A[i][0];
		for (int j=1; j<n; j++) {
			std::cout << " " << A[i][j];
		}
		std::cout << std::endl;
	}
	
	return 0;
}

C++: #include<iostream>

int main() {
	int node_num, adj[100][100];

	std::cin >> node_num;

	for (int i = 0; i < node_num; i++) {
		int node, num;
		std::cin >> node >> num;
		for (int j = 0; j < num; j++) {
			int n;
			std::cin >> n;
			adj[i][n - 1] = 1;
		}
	}

	for (int i = 0; i < node_num; i++) {
		for (int j = 0; j < node_num; j++) {
			std::cout << adj[i][j] << (j != node_num - 1 ? " ":"");
		}
		std::cout << std::endl;
	}
}