criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<iostream>
#include<vector>
#include<queue>
using namespace std;
template< typename FirstType, typename SecondType >
struct PairComparator {
  bool operator()( const pair<FirstType, SecondType>& p1, const pair<FirstType, SecondType>& p2 ) const 
    {  
		return p1.first > p2.first;
    }
};
bool inMST(vector< std::pair<int,int> > & MST,int j) {
	for (int k=0;k<(int)MST.size();++k){
		if(j == MST[k].second)
			return true;
	}
	return false;
}
int main(){
	int n;
	cin >> n;
	vector<int> E(n*n,-1);
	vector<int> DPG(n,-1);
	vector< std::pair<int,int> > MST;
	for(int j=0;j<n;++j) {
		int u,k; 
		cin >> u >> k;
		for(int i=0;i<k;++i){
			int v,c;
			cin >> v >> c;
			E[u*n+v] = c;
		}
	}
	priority_queue<pair<int,pair<int,int> >,vector< pair<int,pair<int,int> > >,
		PairComparator<int,pair<int,int> > > r;

	int cost = 0;
	int i=0;
	MST.push_back(pair<int,int>(i,i));
	DPG[i] = 0;
	while((int)MST.size() < n) {
		int ii=i*n;
		for (int j=0;j<n;++j) {
			if (E[ii+j] >= 0) {
				pair<int,int> add = std::make_pair(i,j);
				if (!inMST(MST,add.second)){
					r.push(std::pair<int,std::pair<int,int> >(E[ii+j],add));
				}
			}
		}
		pair<int,pair<int,int> > top;
		while (!r.empty()) {
			top = r.top();
			r.pop();
			if (!inMST(MST,top.second.second)){
				break;
			}
		}
		cost += top.first;
		MST.push_back(top.second);
		i = top.second.second;
		if (DPG[top.second.first] < 0){
			::_DEBUG_ERROR("invalid");
		}
		DPG[i] = DPG[top.second.first] + top.first;
		for(int j=0;j<n;++j){
			if (DPG[j] < 0)continue;
			if (E[i*n+j] < 0)continue;
			DPG[j] = std::min(DPG[j],DPG[i] + E[i*n+j]);
		}
	}
	for (int j=0;j<n;++j) {
		cout << j << " " <<  DPG[j] << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:63:27: error: '::_DEBUG_ERROR' has not been declared
   63 |                         ::_DEBUG_ERROR("invalid");
      |                           ^~~~~~~~~~~~
Language: Java


import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

import lombok.Data;

public class Main {

	public static void main(String[] args) {
		new Main().run();
	}

	int n;
	boolean[] color;
	int INF = 1 << 24;
	List<List<Edge>> adj = new ArrayList<List<Edge>>();

	private void run() {
		Scanner scanner = new Scanner(System.in);
		n = scanner.nextInt();
		for (int i = 0; i < n; i++) {
			adj.add(new ArrayList<Edge>());
		}
		for (int i = 0; i < n; i++) {
			int u = scanner.nextInt();
			int k = scanner.nextInt();
			for (int j = 0; j < k; j++) {
				int v = scanner.nextInt();
				int c = scanner.nextInt();
				adj.get(u).add(new Edge(v,c));
			}
		}
		dijkstra();
	}

	private void dijkstra() {
		PriorityQueue<Edge> pq = new PriorityQueue<Main.Edge>();
		color = new boolean[n];
		int[] d = new int[n];
		Arrays.fill(d, INF);
		d[0] = 0;
		pq.add(new Edge(0, 0));
		while (!pq.isEmpty()) {
			Edge f = pq.poll();
			int u = f.second;
			color[u] = true;
			if (d[u] < f.first)
				continue;
			for (int j = 0; j < adj.get(u).size(); j++) {
				int v = adj.get(u).get(j).first;
				if (color[v])
					continue;
				if (d[v] > d[u] + adj.get(u).get(j).second) {
					d[v] = d[u] + adj.get(u).get(j).second;
					pq.add(new Edge(d[v], v));
				}
			}
		}
		for (int i = 0; i < n; i++) {
			System.out.printf("%d %d\n", i, d[i] == INF ? -1 : d[i]);
		}

	}
	@Data
	class Edge implements Comparable<Edge> {
		int first;
		int second;

		public Edge(int first, int second) {
			super();
			this.first = first;
			this.second = second;
		}

		@Override
		public int compareTo(Edge o) {
			return this.first - o.first;
		}

	}
}

Compiler output:
Main.java:8: error: package lombok does not exist
import lombok.Data;
             ^
Main.java:67: error: cannot find symbol
	@Data
	 ^
  symbol:   class Data
  location: class Main
2 errors
Language: C

#include<stdio.h>
#include<stdlib.h>
#define N 100000
#define nil -1
#define WHITE 0
#define BLACK 1
#define INF 1<<21

 typedef struct{
                int prev,next,cost;
                }Edge;

 int n,d[N];
 Edge e[500000];

 void dijkstra(int);

 int main(){
            int i,j,k,c,ed=0,v,w=INF,r;

            scanf("%d",&n);
            for(i=0;i<n;i++){
                            scanf("%d%d",&u,&k);
                            for(j=0;j<k;j++){
                                            e[ed].prev=u;
                                            scanf("%d%d",&e[ed].next,&e[ed].cost);
                                            ed++;
                                             }
                             }
            dijkstra(ed);

            for(i=0;i<n;i++)printf("%d %d\n",i,d[i]);
     
            return 0;
            }


 void dijkstra(int edges){
                          int i,flag;
                          for(i=0;i<n;i++)d[i]=INF;
                          d[0]=0;

                          flag=1;
                          while(flag!=0){
                                      flag=0;
                                      for(i=0;i<edges;i++){
                                                  if(e[i].cost+d[e[i].prev]<d[e[i].next]){
                                                     d[e[i].next]=e[i].cost+d[e[i].prev];
                                                     flag=1;
                                             }
                                   }
                              }
                          }











Compiler output:
main.c: In function 'main':
main.c:23:43: error: 'u' undeclared (first use in this function)
   23 |                             scanf("%d%d",&u,&k);
      |                                           ^
main.c:23:43: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#define M 10000
#define E 500000
 
typedef struct edge {
    int from, to, cost;
} E;
E e[E];
int d[M];
 
void sp(int,int);

int main(int argc,char* argv[])
{
    int vn, en, an;
    int i, j, vi;
    scanf("%d", &vn);
 
    en=0;
    for(i=0; i<vn; i++) {
        scanf("%d", &vi);
        scanf("%d", &an);
        for(j=1; j<=an; j++) {
            e[en].from=vi;
            scanf("%d %d", &e[en].to, &e[en].cost);
            en++;
        }
    }
     
    sp(vn, en);
    for(i=0; i<vn; i++) {
        printf("%d %d\n", i, d[i]);
    }
    return 0;
}
void sp(int vn, int en)
{
    int i, new=1;
    for(i=1; i<vn; i++) d[i]=INT_MAX;
     
    while(new) {
        new=0;
        for(i=0; i<en; i++) {
            if(d[e[i].from] !=INT_MAX && d[e[i].from]+e[i].cost < d[e[i].to]) {
                d[e[i].to] = d[e[i].from]+e[i].cost;
                new++;
            }
        }
    }
}

Compiler output:
main.c:5:11: error: expected identifier or '(' before numeric constant
    5 | #define E 500000
      |           ^~~~~~
main.c:9:3: note: in expansion of macro 'E'
    9 | } E;
      |   ^
main.c:5:11: error: expected identifier or '(' before numeric constant
    5 | #define E 500000
      |           ^~~~~~
main.c:10:1: note: in expansion of macro 'E'
   10 | E e[E];
      | ^
main.c: In function 'main':
main.c:26:13: error: 'e' undeclared (first use in this function)
   26 |             e[en].from=vi;
      |             ^
main.c:26:13: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'sp':
main.c:46:18: error: 'e' undeclared (first use in this function)
   46 |             if(d[e[i].from] !=INT_MAX && d[e[i].from]+e[i].cost < d[e[i].to]) {
      |                  ^
Language: C


typedef struct edge {
    int from, to, cost;
} Ed;
Ed e[E];
int d[M];
 
void sp(int,int);

int main(int argc,char* argv[])
{
    int vn, en, an;
    int i, j, vi;
    scanf("%d", &vn);
 
    en=0;
    for(i=0; i<vn; i++) {
        scanf("%d", &vi);
        scanf("%d", &an);
        for(j=1; j<=an; j++) {
            e[en].from=vi;
            scanf("%d %d", &e[en].to, &e[en].cost);
            en++;
        }
    }
     
    sp(vn, en);
    for(i=0; i<vn; i++) {
        printf("%d %d\n", i, d[i]);
    }
    return 0;
}
void sp(int vn, int en)
{
    int i, new=1;
    for(i=1; i<vn; i++) d[i]=INT_MAX;
     
    while(new) {
        new=0;
        for(i=0; i<en; i++) {
            if(d[e[i].from] !=INT_MAX && d[e[i].from]+e[i].cost < d[e[i].to]) {
                d[e[i].to] = d[e[i].from]+e[i].cost;
                new++;
            }
        }
    }
}

Compiler output:
main.c:5:6: error: 'E' undeclared here (not in a function); did you mean 'Ed'?
    5 | Ed e[E];
      |      ^
      |      Ed
main.c:6:7: error: 'M' undeclared here (not in a function)
    6 | int d[M];
      |       ^
main.c: In function 'main':
main.c:14:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   14 |     scanf("%d", &vn);
      |     ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | 
main.c:14:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   14 |     scanf("%d", &vn);
      |     ^~~~~
main.c:14:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:29:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   29 |         printf("%d %d\n", i, d[i]);
      |         ^~~~~~
main.c:29:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:29:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:29:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: In function 'sp':
main.c:36:30: error: 'INT_MAX' undeclared (first use in this function)
   36 |     for(i=1; i<vn; i++) d[i]=INT_MAX;
      |                              ^~~~~~~
main.c:1:1: note: 'INT_MAX' is defined in header '<limits.h>'; this is probably fixable by adding '#include <limits.h>'
  +++ |+#include <limits.h>
    1 | 
main.c:36:30: note: each undeclared identifier is reported only once for each function it appears in
   36 |     for(i=1; i<vn; i++) d[i]=INT_MAX;
      |                              ^~~~~~~
Language: C

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

static MAX = 10001;
static const int INFTY = (1<<21);

main(){
  int n, i, j, e, sum,k,a,v1;
  int key,pi[MAX],v[MAX],u,c[MAX],**M;

  scanf("%d", &n);
 
  M=(int **)malloc(sizeof(int)*(n+1000);
  for ( i = 0; i< n; i++ ){
    M[i]=(int *)malloc(sizeof(int)*(n+1000));
  }
  for ( i = 0; i< n; i++ ){
    for ( j = 0; j < n; j++ ){
      M[i][j] = INFTY;
    }
  }
 
  for ( i = 0; i < n; i++ ){
    scanf("%d %d", &u, &k);
    for ( j = 0; j < k; j++ ){
      scanf("%d %d", &v1, &a);
      M[u][v1] = a;
    }
  }
  
  for(i=0;i<n;i++){
    c[i]=INFTY;
    pi[i]=-1;
    v[i]=0;
  }
  c[0]=0;

  while(1){
    key=INFTY;
    u=-1;
    for(i=0;i<n;i++){
      if(key>c[i] && !v[i]){
	u=i;
	key=c[i];
      }
    }
    if(u==-1)break;
    v[u]=1;
    for(j=0;j<n;j++){
      if(M[u][j]+c[u]<c[j] && !v[j]){
	pi[j]=u;
	c[j]=c[u]+M[u][j];
      }
    }
  }
  
  for ( i = 0; i < n; i++ ){
    printf("%d %d\n", i, (c[i]==INFTY?-1:c[i]));
  }
  
  return 0;
}

Compiler output:
main.c:4:8: error: type defaults to 'int' in declaration of 'MAX' [-Wimplicit-int]
    4 | static MAX = 10001;
      |        ^~~
main.c:7:1: error: return type defaults to 'int' [-Wimplicit-int]
    7 | main(){
      | ^~~~
main.c: In function 'main':
main.c:13:40: error: expected ')' before ';' token
   13 |   M=(int **)malloc(sizeof(int)*(n+1000);
      |                   ~                    ^
      |                                        )
main.c:61:12: error: expected ';' before '}' token
   61 |   return 0;
      |            ^
      |            ;
   62 | }
      | ~
Language: C

#include<stdio.h>
#include<stdlib.h>
 
#define INFTY 2097152//(1<<21)

struct Ver{
    int weight;
    int key;
    struct Ver *next;
};
 
void Input(int);
void Create(int,int,int);// create vertex
void ShortestPath(void);//find shortest path
int Set(int*);//set test veriable
int Heap(int*);//create heap tree

int n;
int *d;
struct Ver *ver;
 
int main(void){
    int i;
    int id;
 
    scanf("%d",&n);
 
    //dynamic malloc and initialize var
    d=(int*)malloc(sizeof(int)*n);
    ver=(struct Ver*)malloc(sizeof(struct Ver)*n);
    for(i=0;i<n;i++){
        ver[i].weight=-1;
        ver[i].key=-1;
        ver[i].next=NULL;
    }
 
    for(i=0;i<n;i++){
        scanf("%d",&id);
        Input(id);  
    }
 
    ShortestPath();
 
    for(i=0;i<n;i++) printf("%d %d\n", i, d[i]);

    free(d);
    return 0;
}
 
void Input(int id){
    int k, u, c;
    int i;

    scanf("%d", &k);
    for(i = 0; i < k; i++){
        scanf("%d", &u);
        scanf("%d", &c);
        Create_Vertex(id, u, c);
    }

}
 
void Create(int id, int u, int c){
    struct Ver *new, *work;
 
    //memory and set address
    new=(struct Ver*)malloc(sizeof(struct Ver));
    new->next = NULL;
    new->weight = c;
    new->key = u;
 
    work = &ver[id];
    while(work->next != NULL) work = work->next
    work->next = new;
 
}
 
void ShortestPath(void){
    int S[n];
    int i;
    int s, u;
    struct Ver *work;
 
    for(i = 0; i < n; i++){
        S[i] = 0;
        d[i] = INFTY;
    }
    s = 0;
    d[s] = 0;
 
    //calc route
    while(Set(S) == 0){
        u = Heap(S);
        S[u] = 1;
        work = ver[u].next;

        while(work != NULL){

            if(S[work->key] == 1){
	    }else if(d[u] + work->weight < d[work->key]){
                d[work->key] = d[u] + work->weight;
            }
            work = work->next;

        }//end while
    }//end while
}
 
int Heap(int *S){
    int i;
    int min = INFTY;
    int u;
  
    for(i = 0; i < n; i++){
      if(S[i] == 1){
	continue;
      }
          
      if(d[i]<min){
	min=d[i];
	u=i;
      }

    }//end for    
    return u;
}

int Set(int *S){
    int i;
 
    for(i=0;i<n;i++){
        if(S[i]==0) return 0;
    }
    return 1;
}

Compiler output:
main.c: In function 'Input':
main.c:58:9: error: implicit declaration of function 'Create_Vertex' [-Wimplicit-function-declaration]
   58 |         Create_Vertex(id, u, c);
      |         ^~~~~~~~~~~~~
main.c: In function 'Create':
main.c:73:48: error: expected ';' before 'work'
   73 |     while(work->next != NULL) work = work->next
      |                                                ^
      |                                                ;
   74 |     work->next = new;
      |     ~~~~
Language: C

#include<stdio.h>
#include<stdlib.h>
 
#define INFTY 2097152//(1<<21)

struct Ver{
    int weight;
    int key;
    struct Ver *next;
};
 
void Input(int);
void Create(int,int,int);// create vertex
void ShortestPath(void);//find shortest path
int Set(int*);//set test veriable
int Heap(int*);//create heap tree

int n;
int *d;
struct Ver *ver;
 
int main(void){
    int i;
    int id;
 
    scanf("%d",&n);
 
    //dynamic malloc and initialize var
    d=(int*)malloc(sizeof(int)*n);
    ver=(struct Ver*)malloc(sizeof(struct Ver)*n);
    for(i=0;i<n;i++){
        ver[i].weight=-1;
        ver[i].key=-1;
        ver[i].next=NULL;
    }
 
    for(i=0;i<n;i++){
        scanf("%d",&id);
        Input(id);  
    }
 
    ShortestPath();
 
    for(i=0;i<n;i++) printf("%d %d\n", i, d[i]);

    free(d);
    return 0;
}
 
void Input(int id){
    int k, u, c;
    int i;

    scanf("%d", &k);
    for(i = 0; i < k; i++){
        scanf("%d", &u);
        scanf("%d", &c);
        Create_Vertex(id, u, c);
    }

}
 
void Create(int id, int u, int c){
    struct Ver *new, *work;
 
    //memory and set address
    new=(struct Ver*)malloc(sizeof(struct Ver));
    new->next = NULL;
    new->weight = c;
    new->key = u;
 
    work = &ver[id];
    while(work->next != NULL){
      work = work->next;
    }
    work->next = new;
 
}
 
void ShortestPath(void){
    int S[n];
    int i;
    int s, u;
    struct Ver *work;
 
    for(i = 0; i < n; i++){
        S[i] = 0;
        d[i] = INFTY;
    }
    s = 0;
    d[s] = 0;
 
    //calc route
    while(Set(S) == 0){
        u = Heap(S);
        S[u] = 1;
        work = ver[u].next;

        while(work != NULL){

            if(S[work->key] == 1){
	    }else if(d[u] + work->weight < d[work->key]){
                d[work->key] = d[u] + work->weight;
            }
            work = work->next;

        }//end while
    }//end while
}
 
int Heap(int *S){
    int i;
    int min = INFTY;
    int u;
  
    for(i = 0; i < n; i++){
      if(S[i] == 1){
	continue;
      }
          
      if(d[i]<min){
	min=d[i];
	u=i;
      }

    }//end for    
    return u;
}

int Set(int *S){
    int i;
 
    for(i=0;i<n;i++){
        if(S[i]==0) return 0;
    }
    return 1;
}

Compiler output:
main.c: In function 'Input':
main.c:58:9: error: implicit declaration of function 'Create_Vertex' [-Wimplicit-function-declaration]
   58 |         Create_Vertex(id, u, c);
      |         ^~~~~~~~~~~~~
Language: C

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

Compiler output:
main.c:1:7: error: expected identifier or '(' before '}' token
    1 |       }
      |       ^
main.c:2:5: error: expected identifier or '(' before '}' token
    2 |     }
      |     ^
main.c:3:3: error: expected identifier or '(' before '}' token
    3 |   }
      |   ^
main.c:4:3: error: expected identifier or '(' before 'for'
    4 |   for(i=0 ; i<n ; i++){
      |   ^~~
main.c:4:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    4 |   for(i=0 ; i<n ; i++){
      |              ^
main.c:4:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    4 |   for(i=0 ; i<n ; i++){
      |                    ^~
main.c:7:3: error: expected identifier or '(' before 'return'
    7 |   return 0;
      |   ^~~~~~
main.c:8:1: error: expected identifier or '(' before '}' token
    8 | }
      | ^
Language: C

#include<stdio.h>
#define N 100
#define MAX 1000000
#define WHITE 0
#define BLACK 1

int main(){

  int a[N][N];
  int d[N],color[N];
  int i,j,n,k,u,v;
  int mincost;

  scanf("%d",&n);
  for( i=0 ; i<n ; i++ ){
    for( j=0 ; j<n ; j++ ){
      a[i][j] = MAX;
    }
  }
  for( i=0 ; i<n ; i++ ){
    d[i] = MAX;
    color[i] = WHITE;
    scanf("%d %d",&u,&k);
    for( j=0 ; j<k ; j++ ){
      scanf("%d",&v);
      scanf("%d",&a[u][v]);
    }
  }
  d[0]=0;

  while(1){
    mincost = MAX;
    for( i=0 ; i<n ; i++ ){
      if( d[i] < mincost && color[i] == WHITE){
	mincost = d[i];
	u = i;
      }
    }#include<stdio.h>
#define N 100
#define MAX 1000000
#define WHITE 0
#define BLACK 1

int main(){

  int a[N][N];
  int d[N],color[N];
  int i,j,n,k,u,v;
  int mincost;

  scanf("%d",&n);
  for( i=0 ; i<n ; i++ ){
    for( j=0 ; j<n ; j++ ){
      a[i][j] = MAX;
    }
  }
  for( i=0 ; i<n ; i++ ){
    d[i] = MAX;
    color[i] = WHITE;
    scanf("%d %d",&u,&k);
    for( j=0 ; j<k ; j++ ){
      scanf("%d",&v);
      scanf("%d",&a[u][v]);
    }
  }
  d[0]=0;

  while(1){
    mincost = MAX;
    for( i=0 ; i<n ; i++ ){
      if( d[i] < mincost && color[i] == WHITE){
	mincost = d[i];
	u = i;
      }
    }
    if( mincost == MAX )break;

    color[u] = BLACK;
    for( v=0 ; v<=n ; v++ ){
      if(a[u][v] == MAX)continue;
      if(d[v] > d[u] + a[u][v]){
	d[v] = d[u] + a[u][v];
      }
    }
  }
  for(i=0 ; i<n ; i++){
    printf("%d %d\n",i,d[i]);
  }
  return 0;
}

    if( mincost == MAX )break;

    color[u] = BLACK;
    for( v=0 ; v<=n ; v++ ){
      if(a[u][v] == MAX)continue;
      if(d[v] > d[u] + a[u][v]){
	d[v] = d[u] + a[u][v];
      }
    }
  }
  for(i=0 ; i<n ; i++){
    printf("%d %d\n",i,d[i]);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:38:6: error: stray '#' in program
   38 |     }#include<stdio.h>
      |      ^
main.c:38:7: error: 'include' undeclared (first use in this function)
   38 |     }#include<stdio.h>
      |       ^~~~~~~
main.c:38:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:38:15: error: 'stdio' undeclared (first use in this function); did you mean 'stdin'?
   38 |     }#include<stdio.h>
      |               ^~~~~
      |               stdin
main.c:44:1: error: expected expression before 'int'
   44 | int main(){
      | ^~~
Language: C

#include <stdio.h>

#define INF 10000000
#define NIL -1

void dijkstra(void);

int n,a[10001][5001],w=0,d[10001],color[10001];

int main()
{
  int i,j,u,k,v;


  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      a[i][j]=-1;
    }
  }

  for(i=0;i<n;i++){

    scanf("%d",&u); //頂点の番号
    scanf("%d",&k); //出次数

    for(j=0;j<k;j++){
      scanf("%d",&v);
      scanf("%d",&a[u][v]);
    }
  }

  dijkstra();

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

  return 0;
}

void dijkstra(void){
  int mincost,u,v,i;

  for(u=0;u<n;u++){ // each u in G
    d[u] = INF;
    color[u] = WHITE;
  }

  d[0] = 0;

  while(1){
    mincost = INF;
    for(i=0;i<n;i++){ //each i in G
      if (color[i] != BLACK && d[i] < mincost){
	mincost = d[i];
	u = i;
      }
    }
    color[u] = BLACK;

    if(mincost == INF) break;

    for(v=0;v<n;v++){// each v in Adj[u]
      if(a[u][v]!=-1){
	if (color[v] != BLACK && a[u][v]+d[u] < d[v]){
	  d[v] = d[u]+a[u][v];
	}
      }
    }
  }
}

Compiler output:
main.c: In function 'dijkstra':
main.c:48:16: error: 'WHITE' undeclared (first use in this function)
   48 |     color[u] = WHITE;
      |                ^~~~~
main.c:48:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:56:23: error: 'BLACK' undeclared (first use in this function)
   56 |       if (color[i] != BLACK && d[i] < mincost){
      |                       ^~~~~
Language: C

#include <stdio.h>
#define INF 200000000
#define NIL -1
#define WHITE 1
#define BLACK 3
int n,a[1000000][1000000],d[1000000],color[1000000],pi[10000000],adj[1000000];

void prim(int r){
  int i;
  for(i=1;i<=n;i++){
    d[i]=INF;
    pi[i]=NIL;
    color[i]=WHITE;
  }
  d[r]=0;
}
int main(){

  int i,j,min,sum=0,  min2,f,u,v,k,c;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      a[i][j]=INF;
    }
  }

  for(i=0;i< n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j< k;j++){
      scanf("%d%d",&v,&c);
      a[u][v]=c;
      
    }
  }
  prim(0);
  u=0;
  while(1){

    min=INF;

    for(i=0;i<n;i++){
      if(color[i] !=BLACK  && d[i]<min){
	  min=d[i];
	  u=i;
	
      }
    }
      
      if(min==INF) break;

      color[u]=BLACK;

      for(j=0;j<n;j++){
	if(color[j]!=BLACK && a[u][j]+d[u]<d[j]){
	 
	  pi[j]=u;
	  d[j]=a[u][j]+d[u];
	  
	}

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


  return 0;
}

Compiler output:
/tmp/ccwkuCcT.o: in function `prim':
main.c:(.text+0x20): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccwkuCcT.o
main.c:(.text+0x3b): relocation truncated to fit: R_X86_64_PC32 against symbol `pi' defined in .bss section in /tmp/ccwkuCcT.o
main.c:(.text+0x56): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccwkuCcT.o
main.c:(.text+0x80): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccwkuCcT.o
/tmp/ccwkuCcT.o: in function `main':
main.c:(.text+0x1e4): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccwkuCcT.o
main.c:(.text+0x200): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccwkuCcT.o
main.c:(.text+0x21c): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccwkuCcT.o
main.c:(.text+0x258): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccwkuCcT.o
main.c:(.text+0x27f): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccwkuCcT.o
main.c:(.text+0x2c6): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccwkuCcT.o
main.c:(.text+0x2e0): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
#include<limits.h>

#define N 200001
#define nil -1
#define WHITE 0
#define BLACK 1
#define INF 9999999

int n,G[N][N],d[N],pi[N],color[N];

void dijkstra(int , int);
void initializeSingleSource(int);

int main(){

  int i,j,u,k,c,v,w=INF,r;
  
  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      G[i][j]=-1;
    }
  }
  
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d %d",&c,&v);
      G[u][c]=v;
      if(v<w && u==0) w=v;
    }
  }
 
  dijkstra(w,0);

  for(i=0;i<n;i++) printf("%d %d\n",i,d[i]);
  
  return 0;
}


void dijkstra(int w , int s){

  int i,u,v,mincost,sum=0;

 
  for(u=0;u<n;u++){
    d[u]=INF;
    pi[u]=nil;
    color[u]=WHITE;
  }
  d[s]=0;

  while(1){

    mincost=INF;
    for(i=0;i<n;i++){
      if(color[i]!=BLACK && d[i]<mincost){
	mincost=d[i];
	u=i;
      }
    }
      if(mincost==INF) break;

      color[u]=BLACK;

      for(v=0;v<n;v++){
	if(G[u][v]!=-1) w=G[u][v];
	else continue;
		
	if(color[v]!=BLACK && w+d[u]<d[v]){
	  pi[v]=u;
	  d[v]=w+d[u];
	}
      }
  }
  
}

Compiler output:
/tmp/ccexd6Q5.o: in function `main':
main.c:(.text+0x162): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccexd6Q5.o
/tmp/ccexd6Q5.o: in function `dijkstra':
main.c:(.text+0x1c2): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccexd6Q5.o
main.c:(.text+0x1dd): relocation truncated to fit: R_X86_64_PC32 against symbol `pi' defined in .bss section in /tmp/ccexd6Q5.o
main.c:(.text+0x1f8): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccexd6Q5.o
main.c:(.text+0x222): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccexd6Q5.o
main.c:(.text+0x24d): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccexd6Q5.o
main.c:(.text+0x269): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccexd6Q5.o
main.c:(.text+0x285): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccexd6Q5.o
main.c:(.text+0x2c1): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccexd6Q5.o
main.c:(.text+0x342): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccexd6Q5.o
main.c:(.text+0x362): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>

#define MAX 100000
#define inf 1000000000
#define NIL -1000000000
#define WHITE 0
#define BLACK 1

int n;
int d[MAX],pi[MAX],color[MAX],G[MAX][MAX];

dijkstra(){
  int v,i,u,mincost;

  for(v=0;v<n;v++){
    d[v]=inf;
    pi[v]=NIL;
    color[v]=WHITE;
  }

  d[0]=0;

  while(1){
    mincost=inf;

    for(i=0;i<n;i++){
      if(color[i]!=BLACK && d[i]<mincost){
	mincost=d[i];
	u=i;
      }
    }
    if(mincost==inf) break;

    color[u]=BLACK;

    for(v=0;v<n;v++){
      if(G[u][v]!=-1){
	if(color[v]!=BLACK && d[u]+G[u][v]<d[v]){
	  pi[v]=u;
	  d[v]=d[u]+G[u][v];
	}
      }
    }
  }
}

int main(){
  int i,j,u,k,v,c;

  scanf("%d",&n);

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

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

  dijkstra();

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

  return 0;
}

Compiler output:
main.c:12:1: error: return type defaults to 'int' [-Wimplicit-int]
   12 | dijkstra(){
      | ^~~~~~~~
Language: C

#include<stdio.h>
int a[100001][100001];
int d[100001];
int pi[100001];
char color[100001];
int n,mincost,sumcost=0;

void dijkstra(void);

int main(){
  int i,j,u,k,v;

  scanf("%d",&n);

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

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

  return 0;
}

void dijkstra(void){
  int i,j,u;
  for(i=0;i<n;i++){
    d[i]=10000000000;
    pi[i] = -1;
    color[i]='W';
  }
  d[0]=0;
  while(1){
    mincost = 200000;
    for(i=0;i<n;i++){
      if(color[i]!='B' && d[i] < mincost){
	mincost = d[i];
        u = i;
      }
    }
    if(mincost==200000) break;
    color[u]='B';
  
  for(i=0;i<n;i++){
    if(color[i]!='B' && a[u][i]!=0  && d[u]+a[u][i]<d[i]){
      pi[i] = u;
      d[i]=d[u]+a[u][i];
     }
  }
  }
}

Compiler output:
main.c: In function 'dijkstra':
main.c:34:10: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
   34 |     d[i]=10000000000;
      |          ^~~~~~~~~~~
/tmp/ccjhxPyi.o: in function `main':
main.c:(.text+0xb): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccjhxPyi.o
main.c:(.text+0xc5): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccjhxPyi.o
main.c:(.text+0xf0): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccjhxPyi.o
main.c:(.text+0x116): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccjhxPyi.o
/tmp/ccjhxPyi.o: in function `dijkstra':
main.c:(.text+0x143): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccjhxPyi.o
main.c:(.text+0x15e): relocation truncated to fit: R_X86_64_PC32 against symbol `pi' defined in .bss section in /tmp/ccjhxPyi.o
main.c:(.text+0x171): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccjhxPyi.o
main.c:(.text+0x17f): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccjhxPyi.o
main.c:(.text+0x18a): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccjhxPyi.o
main.c:(.text+0x194): relocation truncated to fit: R_X86_64_PC32 against symbol `mincost' defined in .bss section in /tmp/ccjhxPyi.o
main.c:(.text+0x1ad): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
int a[100001][100001];
int d[100001];
int pi[100001];
char color[100001];
int n,mincost;

void dijkstra(void);

int main(){
  int i,j,u,k,v;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      a[i][j]=0;
    }
  }

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

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

  return 0;
}

void dijkstra(void){
  int i,j,u;
  for(i=0;i<n;i++){
    d[i]=1000000;
    pi[i] = -1;
    color[i]='W';
  }
  d[0]=0;
  while(1){
    mincost = 200000;
    for(i=0;i<n;i++){
      if(color[i]!='B' && d[i] < mincost){
	mincost = d[i];
        u = i;
      }
    }
    if(mincost==200000) break;
    color[u]='B';
  
  for(i=0;i<n;i++){
    if(color[i]!='B' && a[u][i]!=0  && d[u]+a[u][i]<d[i]){
      pi[i] = u;
      d[i]=d[u]+a[u][i];
     }
  }
  }
}

Compiler output:
/tmp/cctEMm8r.o: in function `main':
main.c:(.text+0xb): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cctEMm8r.o
main.c:(.text+0x69): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cctEMm8r.o
main.c:(.text+0x78): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cctEMm8r.o
main.c:(.text+0x120): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cctEMm8r.o
main.c:(.text+0x14b): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/cctEMm8r.o
main.c:(.text+0x171): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cctEMm8r.o
/tmp/cctEMm8r.o: in function `dijkstra':
main.c:(.text+0x19e): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/cctEMm8r.o
main.c:(.text+0x1b9): relocation truncated to fit: R_X86_64_PC32 against symbol `pi' defined in .bss section in /tmp/cctEMm8r.o
main.c:(.text+0x1cc): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cctEMm8r.o
main.c:(.text+0x1da): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cctEMm8r.o
main.c:(.text+0x1e5): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
#define inf 1000000010
int v[10001][10001];
int a[10001][10001];
int d[10001];
char color[10001];
int n,mincost;
int k;

void dijkstra(void);

int main(){
  int i,j,u;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      a[i][j]=inf;
    }
  }

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

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

  return 0;
}

void dijkstra(void){
  int i,j,u,min;
  
  for(i=0;i<n;i++){
    d[i]=inf;
    pi[i] = -1;
    color[i]='W';
  }
  d[0]=0;
  while(1){
    mincost = inf;
    for(i=0;i<n;i++){
      if(color[i]!='B' && d[i] < mincost){
	mincost = d[i];
        u = i;
      }
    }
    if(mincost==inf) break;
    color[u]='B';
  
  for(i=0;i<n;i++){
    if(color[i]!='B' && a[u][i]!=inf  && d[u]+a[u][i]<d[i]){
      d[i]=d[u]+a[u][i];
     }
   }
  }
}

Compiler output:
main.c: In function 'main':
main.c:23:25: error: subscripted value is neither array nor pointer nor vector
   23 |     scanf("%d %d" ,&u,&k[i]);
      |                         ^
main.c: In function 'dijkstra':
main.c:43:5: error: 'pi' undeclared (first use in this function); did you mean 'i'?
   43 |     pi[i] = -1;
      |     ^~
      |     i
main.c:43:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#define inf 1000000010
int v[10001][10001];
int a[10001][10001];
int d[10001];
char color[10001];
int n,mincost;
int k;

void dijkstra(void);

int main(){
  int i,j,u;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      a[i][j]=inf;
    }
  }

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

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

  return 0;
}

void dijkstra(void){
  int i,j,u,min;
  
  for(i=0;i<n;i++){
    d[i]=inf;
    color[i]='W';
  }
  d[0]=0;
  while(1){
    mincost = inf;
    for(i=0;i<n;i++){
      if(color[i]!='B' && d[i] < mincost){
	mincost = d[i];
        u = i;
      }
    }
    if(mincost==inf) break;
    color[u]='B';
  
  for(i=0;i<n;i++){
    if(color[i]!='B' && a[u][i]!=inf  && d[u]+a[u][i]<d[i]){
      d[i]=d[u]+a[u][i];
     }
   }
  }
}

Compiler output:
main.c: In function 'main':
main.c:23:25: error: subscripted value is neither array nor pointer nor vector
   23 |     scanf("%d %d" ,&u,&k[i]);
      |                         ^
Language: C

#include<stdio.h>
#define inf 1000000010
struct edge{
  int start;
  int goal;
  int a;
};

typedef struct edge Edge;
Edge L[10000];
int v;
int d[10000];
char color[10000];
int n,mincost;
int k;

void dijkstra(void);

int main(){
 
  int i,u;
  static int j;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      L[i].a=inf;
    }
  }

  for(i=0;i<n;i++){
    scanf("%d",&u); 
   scanf("%d",&k);      
  for(j=0;j<=k;j++){
     scanf("%d",&L[j].goal);
     scanf("%d",&L[j].a);   
     L[j].start=start;
    }
  }
  dijkstra();

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

  return 0;
}

void dijkstra(void){
  int i,j,u,min;
  
  for(i=0;i<n;i++){
    d[i]=inf;
    color[i]='W';
  }
  d[0]=0;
  while(1){
    mincost = inf;
    for(i=0;i<n;i++){
      if(color[i]!='B' && d[i] < mincost){
	mincost = d[i];
        u = i;
      }
    }
    if(mincost==inf) break;
    color[u]='B';
  
  for(i=0;i<n;i++){
    if(color[i]!='B' && L[u].a!=inf  && d[L[i].start]+L[i].a<d[L[i].goal]){
      d[L[i].goal]=d[L[i].start]+L[i].a;
     }
   }
  }
}

Compiler output:
main.c: In function 'main':
main.c:37:17: error: 'start' undeclared (first use in this function)
   37 |      L[j].start=start;
      |                 ^~~~~
main.c:37:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include<stdlib.h>
 
#define N 1000000
#define NIL -1
#define WHITE 0
#define BLACK 1
#define INF 9999999
 
typedef struct{
  int prev,next,cost;
}Edge;
  
int n,d[N];
Edge e[500000];

void dijkstra(int edges){
  int i,flag;
  for(i=0;i<n;i++){
   d[i]=INF;
  }
  d[0]=0;
  flag=1;
  while(flag!=0){
    flag=0;
    for(i=0;i<edges;i++){

int main(){
  int i,j,u,k,c,ed=0,v,w=INF,r;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
      for(j=0;j<k;j++){
    e[ed].prev=u;
    scanf("%d%d",&e[ed].next,&e[ed].cost);
    ed++;
      }
  }
  dijkstra(ed);
  for(i=0;i<n;i++) printf("%d %d\n",i,d[i]);
  return 0;
}
      if(e[i].cost+d[e[i].prev]<d[e[i].next]){
    d[e[i].next]=e[i].cost+d[e[i].prev];
    flag=1;
      }
    }
  }
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
#include<stdlib.h>
#define MAX 10000
struct node{
  int key;
  int cost;
  struct node *next;
};

typedef struct node *adj;
adj G[MAX];
adj SuperNode(int key,int cost,adj Node){
  adj n;
  n=(adj)malloc(sizeof(struct node));
  n->key=key;
  n->cost=cost;
  n->next=Node;
  return n;
}

adj Insert(int a,int b,int c){
  adj H;
  H=SuperNode(b,c,G[a]->next);
  G[s]->next=H;
}

int main(){
  int i,j,n,count=0,v,c,c1,v1;
  int color[MAX],D[MAX],pi[MAX],nx,min;
  adj H;

  scanf("%d",&n);
  for(i = 0;i < n;i++)G[i]=SuperNode(0,0,NULL);
  for(i = 0;i < n;i++){
    scanf("%d%d",&v,&c);

    for(j = 0;j <c;j++){
      scanf("%d %d",&v1,&c1);
    Insert(i,v1,c1);
  }
}

for(i=0;i<n;i++){
  color[i]=0;
  pi[i]=-1;
  D[i]=10000000;
 }
 D[0]=0;

while(1){
  min=10000000;
  for(i=0;i<n;i++){
    if(color[i] != 2 && D[i] < min){
      min=D[i];
      nx=i;
    }
  }

  if(min==10000000)break;
  color[nx]=2;

  for(H=G[nx];H!=NULL;H=H->next){
    if(color[H->key] !=2 && (H->cost+D[nx]) < D[H->key]){
        pi[H->key]=nx;
        D[H->key]=H->cost+D[nx];
        color[H->key]=1;
    }

  }
 }
 for(i=0;i<n;i++)printf("%d %d\n",i,D[i]);
return 0;
}

Compiler output:
main.c: In function 'Insert':
main.c:24:5: error: 's' undeclared (first use in this function)
   24 |   G[s]->next=H;
      |     ^
main.c:24:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C

void root(int a){
    int i,flag=1;
    
    for(i=0;i<n;i++) d[i]=INF;
    d[0]=0;
    
    while(flag!=0){
        flag=0;
        for(i=0;i<a;i++){
            if(a[i].cost+d[a[i].back]<d[a[i].next]){
                d[a[i].next=a[i].cost+d[a[i].back];
                flag=1;
            }
        }
    }
}

Compiler output:
main.c: In function 'root':
main.c:4:15: error: 'n' undeclared (first use in this function)
    4 |     for(i=0;i<n;i++) d[i]=INF;
      |               ^
main.c:4:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:4:22: error: 'd' undeclared (first use in this function)
    4 |     for(i=0;i<n;i++) d[i]=INF;
      |                      ^
main.c:4:27: error: 'INF' undeclared (first use in this function)
    4 |     for(i=0;i<n;i++) d[i]=INF;
      |                           ^~~
main.c:10:17: error: subscripted value is neither array nor pointer nor vector
   10 |             if(a[i].cost+d[a[i].back]<d[a[i].next]){
      |                 ^
main.c:10:29: error: subscripted value is neither array nor pointer nor vector
   10 |             if(a[i].cost+d[a[i].back]<d[a[i].next]){
      |                             ^
main.c:10:42: error: subscripted value is neither array nor pointer nor vector
   10 |             if(a[i].cost+d[a[i].back]<d[a[i].next]){
      |                                          ^
main.c:11:20: error: subscripted value is neither array nor pointer nor vector
   11 |                 d[a[i].next=a[i].cost+d[a[i].back];
      |                    ^
main.c:11:30: error: subscripted value is neither array nor pointer nor vector
   11 |                 d[a[i].next=a[i].cost+d[a[i].back];
      |                              ^
main.c:11:42: error: subscripted value is neither array nor pointer nor vector
   11 |                 d[a[i].next=a[i].cost+d[a[i].back];
      |                                          ^
main.c:11:51: error: expected ']' before ';' token
   11 |                 d[a[i].next=a[i].cost+d[a[i].back];
      |                                                   ^
      |                                                   ]
main.c:12:24: error: expected ';' before '}' token
   12 |                 flag=1;
      |                        ^
      |                        ;
   13 |             }
      |             ~
Language: C


#include<iostream>
#include<cstdio>
#include<set>
#include<queue>
#include<cstring>
#include<algorithm>
typedef long long ll;
#define inf 1000000000
using namespace std;


struct _node
{
	ll v,w;
	//:v(a),w(b)
	_node(ll a=0,ll b=0)
	{
		v=a;
		w=b;
	
	};
	bool operator <(const _node & other) const
	{
		return other.w<w;
	}
	
}node;

vector<_node> A[10500];
bool mark[10500];
ll dis[10500];

priority_queue<_node> Q;

void add(ll a,ll b,ll c)
{
	//cout<<a<<" "<<b<<" "<<c<<endl; 
	A[a].push_back(_node(b,c));
	//cout<<A[a][0].w<<endl;
	
}


void dlsj(ll n)
{
	//while(!Q.empty())Q.pop();
	ll v,v1;
	_node tmp;
	for(int i=0;i<n;i++)dis[i]=inf;

	dis[0]=0;
	Q.push(_node(0,0));
	
	while(!Q.empty())
	{
		tmp=Q.top();
		Q.pop();
		v=tmp.v;
		//cout<<v<<endl;
		//cout<<A[v].size()<<endl;
		if(mark[v])continue;
		mark[v]=1;
		for(int i=0;i<A[v].size();i++)
		{
			
			if(mark[A[v][i].v])continue;
			v1=A[v][i].v;
			//cout<<i<<" "; 
			//cout<<dis[2]<<" "<<dis[A[v][i].v]<<" "<<dis[v]+A[v][i].w<<endl;
			//cout<<A[v][i].v<<endl;
			if(dis[v1]>dis[v]+A[v][i].w)
			{
				
				dis[v1]=dis[v]+A[v][i].w;
				
				Q.push(_node(A[v][i].v,dis[v1]));
				
			}
			
			
			
			
		} 
		
		
	}
	
	
	
	
}




int main()
{
	ll n;
	scanf("%lld",&n);
	add(0,0,0);
	for(int i=1;i<=n;i++)
	{
		ll u,k,a,b;
		scanf("%lld%lld",&u,&k);
		while(k--)
		{
			scanf("%lld%lld",&a,&b);
			add(u,a,b);
		}
		
		
		
		
	} 
	dlsj(n);
	for(int i=0;i<n;i++)
	{
		//cout<<"e"<<endl;
		cout<<i<<" "<<dis[i]<<endl;
		
	}
	
}


Compiler output:
main.c:2:9: fatal error: iostream: No such file or directory
    2 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include <stdio.h>
#include <stdlib.h>
#define MAX 10000
#define INF 1000000
#define true 1
#define false 0

int p[MAX], d[MAX], is_visited[MAX];
int weights[][];

typedef struct _n {
  int id, weight;
  struct _n *next;
} node;
node G[MAX];

void add(int origin, int direction, int weight) {
  node *p, *new;
  p = &G[origin];

  while(p->next != NULL)
    p = p->next;

  new = (node *)malloc(sizeof(node));
  p->next = new;
  new->id = direction;
  new->weight = weight;
}

node *find(int origin, int direction) {
  node *p;

  p = &G[origin];
  while(p->next != NULL && p->id != direction)
    p = p->next;

  if(p->id == direction)
    return p;
  else
    return false;
}

int is_connected(int origin, int direction) {
  if(find(origin, direction))
    return true;
  else
    return false;
}

int weight_between(int origin, int direction) {
  if(weight[origin][direction])
    return weight[origin][direction];

  node *t;

  t = find(origin, direction);
  weight[origin][direction] = t->weight;
  return t->weight;
}

void dijkstra() {
  int i, u;
  int mincost, weight;

  d[0] = 0;
  p[0] = -1;

  while(1) {
    mincost = INF;

    for(i = 0;i < MAX;i++) {
      if(!is_visited[i] && d[i] < mincost) {
        mincost = d[i];
        u = i;
      }
    }

    if(mincost == INF) return;
    is_visited[u] = true;

    for(i = 0;i < MAX;i++) {
      if(!is_visited[i] && is_connected(u, i)) {
        weight = d[u] + weight_between(u, i);
        if(weight < d[i]) {
          d[i] = weight;
          p[i] = u;
        }
      }
    }
  }
}

int main() {
  int n, i, j, k, u, v, w;

  for(i = 0;i < MAX;i++) {
    p[i] = -1;
    d[i] = INF;
    G[i].id = i;
    G[i].weight = INF;
    G[i].next = NULL;
  }

  scanf("%d", &n);
  weights = calloc(n*n, sizeof(int));
  for(i = 0;i < n;i++) {
    scanf("%d %d", &u, &k);
    for(j = 0;j < k;j++) {
      scanf("%d %d", &v, &w);
      add(u, v, w);
    }
  }

  dijkstra();

  for(i = 0;i < n;i++)
    printf("%d %d\n", i, d[i]);

  return 0;
}



Compiler output:
main.c:9:5: error: array type has incomplete element type 'int[]'
    9 | int weights[][];
      |     ^~~~~~~
main.c:9:5: note: declaration of 'weights' as multidimensional array must have bounds for all dimensions except the first
main.c: In function 'weight_between':
main.c:51:6: error: 'weight' undeclared (first use in this function); did you mean 'weights'?
   51 |   if(weight[origin][direction])
      |      ^~~~~~
      |      weights
main.c:51:6: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include<limits.h>

 
#define N 9000
#define true 1
#define false 0
int n;
 
int g[N][N];
 
int weight[N];
int us[N];
 
//prim
void prim(){
 
  int v;
  
  weight[0]=0;
   
  while(true){
    v=-1;
    
    for(int i=0;i<n;i++){
      if(us[i]!=true && (v==-1 ||weight[i]<weight[v]))v=i;
    }
 
    if(v==-1)break;
    us[v]=true;
  
 
    for(int i=0;i<n;i++){
      if(weight[i]>(g[v][i]+weight[v])){
 
        weight[i]=(g[v][i]+weight[v]);
        //      cout <<"fsafa"<<endl;
      }
    }
  }
  
}
 
 
int main(){
 
  int u,k1,c,v;
 
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      g[i][j]=9953535;
    }
  }
 
  //load n
  cin >>n;
 
  //load data
  for(int i=0;i<n;i++){
    weight[i]=INT_MAX;
    us[i]=false;
    scanf("%d %d",&u,&k1);
    for(int j=0;j<k1;j++){
      scanf("%d %d",&v,&c);
      g[u][v]=c;
      //    cout <<g[i][j]<<" ";
    }
    //    cout <<endl;
  }
 
 
 
 
  //print
  prim();
 
  for(int i=0;i<n;i++){
    cout <<i<<" "<<weight[i]<<endl;
  }
  return 0;
 
}

Compiler output:
main.c: In function 'main':
main.c:56:3: error: 'cin' undeclared (first use in this function)
   56 |   cin >>n;
      |   ^~~
main.c:56:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:78:5: error: 'cout' undeclared (first use in this function)
   78 |     cout <<i<<" "<<weight[i]<<endl;
      |     ^~~~
main.c:78:31: error: 'endl' undeclared (first use in this function)
   78 |     cout <<i<<" "<<weight[i]<<endl;
      |                               ^~~~
Language: C

#include<stdio.h>
#include<limits.h>


#define N 10001
#define true 1
#define false 0

int n;

int g[N][N];

int weight[N];
int us[N];

//prim
void prim(){

  int v;
  int i,j; 
  weight[0]=0;
  
  while(true){
    v=-1;
   
    for(i=0;i<n;i++){
      if(us[i]!=true && (v==-1 ||weight[i]<weight[v]))v=i;
    }

    if(v==-1)break;
    us[v]=true;
 

    for(i=0;i<n;i++){
      if(weight[i]>(g[v][i]+weight[v])){

        weight[i]=(g[v][i]+weight[v]);
        //      cout <<"fsafa"<<endl;
      }
    }
  }
 
}


int main(){

  int u,k1,c,v;
  int i,j;
 
  //load n
  //  cin >>n;
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      g[i][j]=9953535;
    }
  }
 

  //load data
  for(i=0;i<n;i++){
    weight[i]=INT_MAX;
    us[i]=false;
    scanf("%d %d",&u,&k1);
    for(j=0;j<k1;j++){
      scanf("%d %d",&v,&c);
      g[u][v]=c;
      //    cout <<g[i][j]<<" ";
    }
    //    cout <<endl;
  }




  //print
  prim();

  for(i=0;i<n;i++){
    //  cout <<i<<" "<<weight[i]<<endl;
    printf("%d %d\n",i,weight[i]);
  }
delete g;
  return 0;

}

Compiler output:
main.c: In function 'main':
main.c:85:1: error: unknown type name 'delete'
   85 | delete g;
      | ^~~~~~