Language: C

#include <stdio.h>
#include <stdlib.h>

#define EMPTY    0
#define NOTEMPTY 1

typedef struct node{
	int n;
	struct node *next;
}node;

char *graph;

int empty(node *q);
int dequeue(node *q);
void enqueue(node *q, int n);
void check_connect(char *g, int *r, const int n, const int t);

int main(void){
	int n, k, l;
	int p, q;
	int i, j;
	int *ar, *br, *cnt, ans;

	scanf("%d %d %d", &n, &k, &l);
	for(i=0; i<k; i++){
		scanf("%d %d", &p, &q);
		graph[p][q] = 1;
		//printf("conncted %d and %d with path.\n", p ,q);
	}
	for(i=0; i<l; i++){
		scanf("%d %d", &p, &q);
		graph[p][q] += 2;
		//printf("connected %d and %d with train.\n", p, q);
	}
	/*for(i=1; i<=n; i++){
		for(j=1; j<=n; j++){
			printf("%d ", graph[i][j]);
		}
		printf("\n");
		}*/
	graph = (char *)malloc(sizeof(char)*(n+1)*(n+1));
	ar = (int *)malloc(sizeof(int)*(n+1));
	br = (int *)malloc(sizeof(int)*(n+1));
	cnt = (int *)malloc(sizeof(int)*(n+1));
	for(i=1; i<=n; i++){
		ar[i] = -1;
		br[i] = -1;
		cnt[i] = 0;
	}
	check_connect(graph, br, n, 2);
	for(i=0; i<=n; i++){
		for(j=0; j<=n; j++){
			if(graph[i][j] >= 2) graph[i][j] -=2;
		}
	}
	check_connect(graph, ar, n, 1);
	
	for(i=1; i<=n; i++){
		for(j=1; j<=n; j++){
			if((ar[i] == ar[j]) && (br[i] == br[j])) cnt[i]++;
		}
	}
	
	
	for(i=1; i<=n; i++){
		printf("%d ", cnt[i]);
	}
	printf("\n");
	
	return 0;
}

int empty(node *q){
	if(q->next == NULL) return EMPTY;

	return NOTEMPTY;
}

node* init_queue(){
	node *np;

	np = (node *)malloc(sizeof(node));
	np->next = NULL;

	return np;
}

int dequeue(node *q){
	node *np;
	int n;

	if(empty(q) == EMPTY) return 0;
	np = q->next;
	q->next = q->next->next;
	n = np->n;
	
	return n;
}

void enqueue(node *q, int n){
	node *np;
	
	np = (node*)malloc(sizeof(node));
	np->n = n;
	np->next = NULL;
	while(q->next != NULL) q = q->next;
	q->next = np;
}

void check_connect(char *g, int *r, const int n, const int t){
	int cnum;
	node *cnct, *set;
	int i, j;

	cnct = init_queue();
	set = init_queue();
	
	for(i=1; i<=n; i++){
		if(r[i] != -1) continue;
		enqueue(set, i);
		while(empty(set) != EMPTY){
			cnum=dequeue(set);
			//printf("checking connection with %d.\n", cnum);
			enqueue(cnct, cnum);
			for(j=cnum; j<=n; j++){
				if(g(cnum*n+j) >= t){
					enqueue(set, j);
					//printf("%d is connected.\n", j);
				}
			}
		}
		while(empty(cnct) != EMPTY){
			cnum = dequeue(cnct);
			r[cnum] = i;
		}
	}
}

Compiler output:
main.c: In function 'main':
main.c:28:25: error: subscripted value is neither array nor pointer nor vector
   28 |                 graph[p][q] = 1;
      |                         ^
main.c:33:25: error: subscripted value is neither array nor pointer nor vector
   33 |                 graph[p][q] += 2;
      |                         ^
main.c:54:36: error: subscripted value is neither array nor pointer nor vector
   54 |                         if(graph[i][j] >= 2) graph[i][j] -=2;
      |                                    ^
main.c:54:54: error: subscripted value is neither array nor pointer nor vector
   54 |                         if(graph[i][j] >= 2) graph[i][j] -=2;
      |                                                      ^
main.c: In function 'check_connect':
main.c:127:36: error: called object 'g' is not a function or function pointer
  127 |                                 if(g(cnum*n+j) >= t){
      |                                    ^
main.c:111:26: note: declared here
  111 | void check_connect(char *g, int *r, const int n, const int t){
      |                    ~~~~~~^