Go: package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())
	Adj := make([][]int, n)
	for i := range Adj {
		Adj[i] = make([]int, n)
	}
	for i := 0; i < n; i++ {
		scanner.Scan()
		u, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
		k, _ := strconv.Atoi(scanner.Text())
		if k == 0 {
			continue
		}
		for i := 0; i < k; i++ {
			scanner.Scan()
			v, _ := strconv.Atoi(scanner.Text())
			Adj[u-1][v-1] = 1
		}
	}
	for i := range Adj {
		for j := range Adj[i] {
			if j == n-1 {
				fmt.Printf("%d\n", Adj[i][j])
				continue
			}
			fmt.Printf("%d ", Adj[i][j])
		}
	}
}

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

int main(){
    int n,u,k;
    int *U;
    cin>>n;
    
    int A[n][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++){
        cin>>u>>k;
        U= new int[k];
        for(int j=0;j<k;j++){
            cin>>U[j];
            A[i][U[j]-1]=1;
            
        }
    
    } 
    for(int i=0;i<n;i++){
        cout<<A[i][0];
        for(int j=1;j<n;j++){
           cout<<" "<<A[i][j];
        }
        cout<<endl;
    }


}

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

#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
typedef long long ll;
const long double PI = (acos(-1));
const long long MOD = 1000000007;
#define rep(i,n) REP(i,0,n)
#define REP(i,x,n) for(int i=x;i<n;++i)

///////////////////////////////////////////////////
// ------------------- utils ------------------- //
///////////////////////////////////////////////////
// change min/max
template<class T> inline bool chMin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chMax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

///////////////////////////////////////////////////
// ------------------- main -------------------- //
///////////////////////////////////////////////////
void Main() {
	int n; cin >> n;
	vector<vector<int> > g(n, vector<int>(n,0));
	rep(i, n) {
		int u, k; cin >> u >> k;
		rep(j, k) {
			int to; cin >> to;
			g[u-1][to-1]=1;
		}
	}

	rep(i, n) {
		rep(j, n) {
			if (j != (n-1)) {
				cout << g[i][j] << " ";
			}
			else {
				cout << g[i][j];
			}
		}
		cout << endl;
	}
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout << std::fixed << std::setprecision(15);
	Main();

	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 <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <set>
#include <deque>
#include <vector>
#define MAX 10010
#define rep(i,p) for(int i=0;i<p;i++)
#define pb push_back
using namespace std;
int n,hoge,foo;
int graph[MAX][MAX] = {0};
int main(){
  cin >> n;
  rep(i,n) {
    cin >> hoge >> foo;
    rep(j,foo) {
      cin >> hoge;
      graph[i][hoge-1] = 1;
    }
  }
  rep(i,n) {
    rep(j,n) cout << graph[i][j] << " ";
    cout << endl;
  }
  return 0;
}

C++: #define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>




int main(int argc, const char * argv[]){
    
    //Input
    int i, j , n ,m , frm, to;
    
    scanf("%d", &n);
    
    int ans[n][n];
    
    memset(ans, 0x00, sizeof(ans));
    
    for(i = 0; i < n; i++){
        
        scanf("%d", &frm);
        scanf("%d", &m);
        
        for (j=0; j<m; j++) {
            scanf("%d", &to);
            ans[frm - 1][to - 1] = 1;
        }
        
    }
    
    for (i=0; i<n; i++) {
        for (j=0; j<n; j++) {
            printf("%d", ans[i][j]);
            if(j != n-1) printf(" ");
        }
        printf("\n");
    }
    
    return 0;
}

C++: #include<iostream>
#include<stdio.h>
using namespace std;
#define N 100

int main(){
    int graph[N][N];
    int n;
    int c,l; 
    int arc; 
    cin >> n;

    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            graph[i][j] = 0;
    
   for(int i=0;i<n;i++){
        cin >> c;
        cin >> arc;
        for(int j=0;j<arc;j++){
            cin>> l;
            graph[c-1][l-1]=1;
        }
    }

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

C++: #include "stdio.h"
#include<iostream>

using namespace std;

int main(void){

  int N;
  scanf("%d", &N);

  int node_num, dimention, adjacency_node_num;  
  
  int** matrix = new int* [N];
  for(int i=0;i<N;i++){
    matrix[i] = new int [N];
  }

  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      matrix[i][j] = 0;
    }
  }

  for(int i=0;i<N;i++){
    cin >> node_num >> dimention;

    for(int i=0;i<dimention;i++){
      cin >> adjacency_node_num;
      matrix[node_num-1][adjacency_node_num-1] = 1;
    } 
  }

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

  for(int i=0;i<N;i++){
    delete [] matrix[i];
  }

  delete [] matrix;  

  return 0;
}

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

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

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <list>
#include<map>
#include<set>
using namespace std;

int main() {
    int n, a[101][101] = {};
    cin >> n; 
    for (int i = 1; i <= n; i++) {
        int p,m;
        cin >> p>>m;
        if (p != i) continue;
        for (int j = 0; j < m; j++) {
            int k;
            cin >> k;
            a[i][k]++;
        }
    }
    for (int i = 1;i <= n;i++) {
        for (int j = 1; j <= n;j++) {
            if (j-1) cout << " ";
            cout << a[i][j];
        }
        cout << endl;
    }
}

C++: #include <iostream>
using namespace std;
int main(void)
{
    int n;
    cin>>n;
    int graph[n+1][n+1];
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
        {
            graph[i][j]=0;
        }
    }
    for(int i=1;i<=n;i++)
    {
        int a,temp;
        cin>>a>>temp;
        for(int j=0;j<temp;j++)
        {
            int k;
            cin>>k;
            graph[i][k]=1;
        }
    }
    for(int i=1;i<=n;i++)
    {
        int j;
        for(j=1;j<n;j++)
        {
            cout<<graph[i][j]<<' ';
        }
        cout<<graph[i][j]<<endl;
    }
    return 0;
}

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

int G[110][110] ={0};

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