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<cstdio>


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

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

const static int N = 100;

int main() {
  int n, G[N][N];
  
  cin >> n;

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

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

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

  return 0;    
}

C++: 

#include <iostream>
using namespace std;

int main(){
        int n,m,l,i,j;
        cin >> n;
        int f[100][100] =
        for ( i = 0; i < n; i++){
                cin >> m;
                for ( j = 0; j < m; j++){
                        cin >> l;
                        f[m][l] = 1;
                }
        }
        for ( i = 0; i < n; i++){
                for ( j = 0; j < n-1; j++){
                        cout << f[i][j] << " ";
                }
                cout << f[i][n] << endl;
        }
}

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

int main(){
    int n;
    std::cin >> n;
    std::vector<std::vector<int>> adj(n, std::vector<int>(n, 0));
    for(int i=0;i<n;i++){
        int unused, k;
        std::cin >> unused >> k;
        for(int j=0;j<k;j++){
            int p;
            std::cin >> p;
            adj[i][p-1]=1;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            std::cout << adj[i][j];
            if(j==(n-1)) std::cout << "\n";
            else std::cout << " ";
            
        }
    }
    return 0;
}

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

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

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;
  cin >> n;

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

  int u, k, v;
  for (int i = 0; i < n; i++) {
    cin >> u >> k;
    for (int j = 0; j < k; j++) {
      cin >> v;
      v--; // to 0 origin
      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>
#include <vector>

using namespace std;

int main(void) {
	int n;
	cin >> n;
	vector<vector<int>> matricies(n, vector<int>(n, 0));
	while(n--) {
		int u, k;
		cin >> u >> k;
		while(k--) {
			int v;
			cin >> v;
			matricies.at(u-1).at(v-1) = 1;
		}
	}

	for (int i = 0; i < matricies.size(); i++) {
		for (int j = 0; j < matricies.at(0).size(); j++) {
			if (j == matricies.at(0).size() - 1) cout << matricies.at(i).at(j) << endl;
			else cout << matricies.at(i).at(j) << " ";
		}
	}
}

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

using namespace std;

int main(void){

  int graph[100][100];
  for( int i = 0 ; i < 100 ; i++ )
    for( int j = 0 ; j < 100 ; j++ )
      graph[i][j] = 0;

  int n;
  cin >> n;
  for( int i = 0 ; i < n ; i++ ){
    int u, k;
    cin >> u >> k;
    u--;
    while( k-- ){
      int v;
      cin >> v;
      v--;
      graph[u][v] = 1;
    }
  }
  for( int i = 0 ; i < n ; i++ ){
    for( int j = 0 ; j < n ; j++ ){
      if( j == n - 1 ) cout << graph[i][j] << endl;
      else cout << graph[i][j] << " ";
    }
  }
  return 0;
}

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

int n, u, k, v;
int g[101][101];

int main() {
    cin >> n;

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

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cout << g[i][j] << (j == n - 1 ? "\n" : " ");
        }
    }

    return 0;
}

C++: #define scanf_s scanf
#include <string>
#include <stdio.h>
#include <math.h>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <iostream>
using namespace std;

#define MAX 100
//#define MAX_ 1000
int time = 0;
int main(void)
{
	int G[MAX][MAX] = { false };
	int n, u, k, v;
	scanf_s("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf_s("%d %d", &u, &k);
		for (int j = 0; j < k; ++j) {
			scanf_s("%d", &v);
			G[u - 1][v - 1] = true;
		}
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (j != 0) printf(" ");
			printf("%d", G[i][j]);
		}
		if (i != n - 1) printf("\n");
	}
}

C++: #include <iostream>

using namespace std;

int main()
{
  int n, k[102], v[101][102] = {0}, i, j, l, a;

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

  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (k[i] == 0) {
        for (l = v[i][j - 1]; l < n - 1; l++) {
          cout << "0 ";
        }
        cout << "0\n";
        break;
      }
      else {
        if (v[i][j] != 0) {
          k[i]--;
          for (l = v[i][j - 1]; l < v[i][j] - 1; l++) {
            cout << "0 ";
          }
          if (v[i][j] == n) {
            cout << "1\n";
            break;
          }
          else {
            cout << "1 ";
          }
        }
      }
    }
  }

  return 0;
}

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

const static int N = 100;

int main() {
  int n, G[N][N];
  int v, m, k;
  
  cin >> n;

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

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

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

  return 0;    
}