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

#include<stdio.h>
#define NIL -1
#define FALSE 0
 
static const int MAX = 500;
static const int INF = (1<<21);
 
 
int main(){
  int n, i, j, c, sum;
  int M[MAX][MAX];
  int a, b, c, d=0;
  int minv;
  int data[MAX];
  int pi[MAX];
  int vis[MAX];
  int S[MAX];
 
  scanf("%data", &n);
 
 
for ( i = 0; i< n; i++ ){
    for ( j = 0; j < n; j++ ){
      M[i][j] = INF;
    }
  }
 
  for ( i = 0; i < n; i++ ){
    scanf("%data %data", &b, &a);
    for ( j = 0; j < a; j++ ){
      scanf("%data %data", &c, &c);
      M[b][c] = c;
    }
  }
 
  for(c=0; c<n; c++){
    data[c] = INF;
    pi[c] = NIL;
    vis[b] = 0;
  }
  data[d] = 0;
 
  //S[n] = FALSE;
  //sum = 0;
  while(1){
    b = NIL;
    minv = INFTY;
    for(i=0;i<n;i++){
      if( data[i] < minv && vis[i] == 0){
    b=i;
    minv=data[i];
      }
    }
    //printf("%data\n",b+1);
    if(b==NIL)break;
    //sum += key[b];
    vis[b] = 1;
 
    for(c=0; c<n; c++){
      if(data[c] > data[b]+ M[b][c] && vis[c] == 0){
    data[c] = data[b]+M[b][c];
    pi[c] = b;
      }
    }
  }
  /*for ( i = 0; i < n; i++ ){
   printf("pi = %data\n",1+pi[i]);
   }*/
 
  for ( i = 0; i < n; i++ ){
    printf("%data %data\n", i, (data[i]==INF?-1:data[i]));
    //printf("%data %data\n",sum,M[i][pi[i]]);
  }
 
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:13: error: redeclaration of 'c' with no linkage
   12 |   int a, b, c, d=0;
      |             ^
main.c:10:16: note: previous declaration of 'c' with type 'int'
   10 |   int n, i, j, c, sum;
      |                ^
main.c:47:12: error: 'INFTY' undeclared (first use in this function); did you mean 'INF'?
   47 |     minv = INFTY;
      |            ^~~~~
      |            INF
main.c:47:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
 
#define MAX 100
#define MaxVal 2000000
#define WHITE 0
#define GRAY 1
#define BLACK 2
 
int main(){
  int n, i, j, u, k, v, c, min;
  int color[MAX], arr[MAX];
 
  scanf("%d", &n);
 
  int d[n];
  int matrix[n][n];
 
  for( i=0; i<n; i++){
    d[i] = 0;
    arr[i] = MaxVal;
    color[i] = WHITE;
    for( j=0; j<n; j++){
      matrix[i][j] = MaxVal;
    }
  }
 
  arr[0] = 0;
  col[0] = GRAY;
 
  for( i=0; i<n; i++){
    scanf("%d %d", &u, &k);
    for( j=0; j<k; j++){
      scanf("%d %d", &v, &c);
      matrix[u][v] = c;  
    }
  }
 
  while(1){
    min = MaxVal;
    u = -1;
 
    for( i=0; i<n; i++){
      if( min > arr[i] && color[i] != BLACK ){
    u = i;
    min = arr[i];
      }
    }
 
    if( u == -1 )break;
 
    col[u] = BLACK;
 
    for( i=0; i<n; i++){
      if( color[i] != BLACK && matrix[u][i] != MaxVal ){
    if( arr[i] > (arr[u] + g[u][i]) ){
      arr[i] = arr[u] + g[u][i];
      color[i] = GRAY;
    }
      }
    }
  }
 
  for( i=0; i<n; i++){
    printf("%d ", i);
    if( arr[i] == MaxVal ) arr[i] = -1;
    printf("%d\n", arr[i]);
  }
 
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:28:3: error: 'col' undeclared (first use in this function); did you mean 'color'?
   28 |   col[0] = GRAY;
      |   ^~~
      |   color
main.c:28:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:55:28: error: 'g' undeclared (first use in this function)
   55 |     if( arr[i] > (arr[u] + g[u][i]) ){
      |                            ^
Language: C

#include <stdio.h>
 
#define MAX 100
#define MaxVal 2000000
#define WHITE 0
#define GRAY 1
#define BLACK 2
 
int main(){
  int n, i, j, u, k, v, c, min;
  int color[MAX], arr[MAX];
 
  scanf("%d", &n);
 
  int d[n];
  int matrix[n][n];
 
  for( i=0; i<n; i++){
    d[i] = 0;
    arr[i] = MaxVal;
    color[i] = WHITE;
    for( j=0; j<n; j++){
      matrix[i][j] = MaxVal;
    }
  }
 
  arr[0] = 0;
  col[0] = GRAY;
 
  for( i=0; i<n; i++){
    scanf("%d %d", &u, &k);
    for( j=0; j<k; j++){
      scanf("%d %d", &v, &c);
      matrix[u][v] = c;  
    }
  }
 
  while(1){
    min = MaxVal;
    u = -1;
 
    for( i=0; i<n; i++){
      if( min > arr[i] && color[i] != BLACK ){
    u = i;
    min = arr[i];
      }
    }
 
    if( u == -1 )break;
 
    color[u] = BLACK;
 
    for( i=0; i<n; i++){
      if( color[i] != BLACK && matrix[u][i] != MaxVal ){
    if( arr[i] > (arr[u] + matrix[u][i]) ){
      arr[i] = arr[u] + matrix[u][i];
      color[i] = GRAY;
    }
      }
    }
  }
 
  for( i=0; i<n; i++){
    printf("%d ", i);
    if( arr[i] == MaxVal ) arr[i] = -1;
    printf("%d\n", arr[i]);
  }
 
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:28:3: error: 'col' undeclared (first use in this function); did you mean 'color'?
   28 |   col[0] = GRAY;
      |   ^~~
      |   color
main.c:28:3: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

#define N 1000
#define MAX 100000

 int main(){
   int n, i, j, u, k, v, m;
    int d[N], c[N], g[N][N];
      
    scanf("%d", &n);
      
    for( i = 0; i < n; i++){
        for( j = 0; j < n; j++){
            g[i][j]=MAX;
        }
    }
      
    for( i = 0; i < n; i++){
        d[i] = MAX;
        c[i] = 0;
        scanf("%d%d", &u, &k);
        for( j = 0; j < k; j++){
            scanf("%d", &v);
            scanf("%d", &g[u][v]);
        }
    }
    
	d[0] = 0;
      
    while(1){
      
	  min=MAX;
        
	for(i=0;i<n;i++){
        
	    if(d[i]<min && c[i]==0){
                min=d[i];
                u=i;
            }
        }
          
        if( min == MAX)break;
        c[u] = 1;
          
     for( v = 0; v < n; v++){
            if( d[v] > d[u] + g[u][v]){
                d[v] =d [u] + g[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:32:11: error: 'min' undeclared (first use in this function); did you mean 'main'?
   32 |           min=MAX;
      |           ^~~
      |           main
main.c:32:11: note: each undeclared identifier is reported only once for each function it appears in
Language: C



#include<stdio.h>

static const int N = 500;
static const int INFTY = (1<<21);

main(){
  int n,i,j,a,b,sum;
  int M[100][100];
  int key[100];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&a);
      M[i][j]=(a==-1)?INFTY:a;
    }
  }

  

  for(b=0;b<n;b++){
    key[b]=1000;
    pi[b]=NIL;
  }
  key[b]=0;

  while(1){
    int b=NIL;
    int c=MAX;
    for(i=0;i<n;i++){
      if(key[i]<max && ){
	b=i;
	min c = key[i];
      }
      if(b==NIL){
	break;
      }
    }
    for(c=0;c<n;c++){
      if(w[b][c] < key[c]){
	key[c]=w[b][c];
	Pi[c]=u;
      }
    }
  }





  sum=0;

  for(i=0;i<n;i++){
    if (p[i] != -1) sum += M[i][p[i]];
  }

  printf("%d\n",sum);

  return 0;
}

Compiler output:
main.c:8:1: error: return type defaults to 'int' [-Wimplicit-int]
    8 | main(){
      | ^~~~
main.c: In function 'main':
main.c:26:5: error: 'pi' undeclared (first use in this function); did you mean 'i'?
   26 |     pi[b]=NIL;
      |     ^~
      |     i
main.c:26:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:26:11: error: 'NIL' undeclared (first use in this function)
   26 |     pi[b]=NIL;
      |           ^~~
main.c:32:11: error: 'MAX' undeclared (first use in this function)
   32 |     int c=MAX;
      |           ^~~
main.c:34:17: error: 'max' undeclared (first use in this function)
   34 |       if(key[i]<max && ){
      |                 ^~~
main.c:34:24: error: expected expression before ')' token
   34 |       if(key[i]<max && ){
      |                        ^
main.c:36:9: error: unknown type name 'min'
   36 |         min c = key[i];
      |         ^~~
main.c:43:10: error: 'w' undeclared (first use in this function)
   43 |       if(w[b][c] < key[c]){
      |          ^
main.c:45:9: error: 'Pi' undeclared (first use in this function); did you mean 'i'?
   45 |         Pi[c]=u;
      |         ^~
      |         i
main.c:45:15: error: 'u' undeclared (first use in this function)
   45 |         Pi[c]=u;
      |               ^
main.c:57:9: error: 'p' undeclared (first use in this function)
   57 |     if (p[i] != -1) sum += M[i][p[i]];
      |         ^
Language: C

#include<stdio.h>
#define MAX 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define INFTY 3000
int n,M[MAX][MAX];
void dijkstra();
int main(){
  int i,j,k,c,u,v;
  scanf("%d",&n);
  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",&v,&c);
      M[u][v]=c;
    }
  }
  dijkstra();
  return 0;
}

void dijkstra(){
  int u,minv,i,j,v,sum=0;
  int d[MAX],p[MAX],color[MAX];
  for(i=0;i<n;i++){
    d[i]=INFTY;
    p[i]=-1;
    color[i]=WHITE;
  }
  d[0]=0;
  color[0]=GRAY;
  while(1){
    minv=INFTY;
    u=-1;
    for(i=0;i<n;i++){
      if(minv>d[i] && color[i]!=BLACK){
	u=i;
	minv=d[i];
      }
    }
    if(u==-1)break;
    color[u]=BLACK;
    for(v=0;v<n;v++){
      if(color[v]!=BLACK && M[u][v]!=INFTY){
	if(d[v]>d[u]+M[u][v]){
	  d[v]=d[u]+M[u][v];
	  color[v]=GRAY;
	}
      }
    }
  }
  for(i=0;i<n;i++){
      if(d[i]==INFTY){ 
	printf("%d %d\n",i,);
    }else{
      printf("%d %d\n",i,d[i]);
    }
  }
}

Compiler output:
main.c: In function 'dijkstra':
main.c:60:28: error: expected expression before ')' token
   60 |         printf("%d %d\n",i,);
      |                            ^
Language: C

#include<stdio.h>
#define MAX 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define INFTY 1000000
int n,M[MAX][MAX];
void dijkstra();
int main(){
  int i,j,k,c,u,v;
  scanf("%d",&n);
  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",&v,&c);
      M[u][v]=c;
    }
  }
  dijkstra();
  return 0;
}

void dijkstra(){
  int u,minv,i,j,v,sum=0;
  int d[MAX],p[MAX],color[MAX];
  for(i=0;i<n;i++){
    d[i]=INFTY;
    p[i]=-1;
    color[i]=WHITE;
  }
  d[0]=0;
  color[0]=GRAY;
  while(1){
    minv=INFTY;
    u=-1;
    for(i=0;i<n;i++){
      if(minv>d[i] && color[i]!=BLACK){
	u=i;
	minv=d[i];
      }
    }
    if(u==-1)break;
    color[u]=BLACK;
    for(v=0;v<n;v++){
      if(color[v]!=BLACK && M[u][v]!=INFTY){
	if(d[v]>d[u]+M[u][v]){
	  d[v]=d[u]+M[u][v];
	  color[v]=GRAY;
	}
      }
    }
  }
  for(i=0;i<n;i++){
      if(d[i]==INFTY){ 
	printf("%d -1\n",i,);
    }else{
      printf("%d %d\n",i,d[i]);
    }
  }
}

Compiler output:
main.c: In function 'dijkstra':
main.c:60:28: error: expected expression before ')' token
   60 |         printf("%d -1\n",i,);
      |                            ^
Language: C

#include <stdio.h>
static const int MAX=100;
static const int INFTY=(1<<30);
static const int WHITE=0;
static const int GRAY=1;
static const int BLACK=2;
int n,M[MAX][MAX];

void dijkstra(){
    int minv,i,o;
    int d[MAX],color[MAX];
    for(i=0;i<n;i++){
        d[i]=INFTY;
        color[i]=WHITE;
    }
    d[0]=0;
    color[0]=GRAY;
    while(1){
        minv=INFTY;
        int u=-1;
        for(i=0;i<n;i++){
            if(minv>d[i] && color[i] != BLACK){
                u=i;
                minv=d[i];
            }
        }
        if(u==-1)
            break;
        color[u]=BLACK;
        for(o=0;o<n;o++){
            if(color[o]!= BLACK && M[u][o] != INFTY){
                if(d[o]>d[u]+M[u][o]){
                    d[o]=d[u]+M[u][o];
                    color[o]=GRAY;
                }
            }
        }
    }
    for(i=0;i<n;i++)
        printf("%d %d\n",i,(d[i]==INFTY)?-1:d[i]);
}

int main(void){
    int i,o,k,c,u,v;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        for(o=0;o<n;o++)
            M[i][o]=INFTY;
    for(i=0;i<n;i++){
        scanf("%d %d",&u,&k);
        for(o=0;o<k;o++){
            scanf("%d %d",&v,&c);
            M[u][v]=c;
        }
    }
    dijkstra();
    return 0;
}

Compiler output:
main.c:7:7: error: variably modified 'M' at file scope
    7 | int n,M[MAX][MAX];
      |       ^
main.c:7:7: error: variably modified 'M' at file scope
Language: C

#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>

typedef enum {
  WHITE,
  GRAY,
  BLACK,
} color_t;

#define MINIMUM_SPANNING_TREE_GRAPH_SIZE 100

static int32_t weights[MINIMUM_SPANNING_TREE_GRAPH_SIZE];
static color_t colors[MINIMUM_SPANNING_TREE_GRAPH_SIZE];

bool single_source_shortest_path(int32_t graph[][MINIMUM_SPANNING_TREE_GRAPH_SIZE], size_t size,
                                 single_source_shortest_path_callback_t callback)
{
  if ((graph == NULL) || (size == 0)) return false;

  uint32_t i;
  for (i = 0; i < size; i++) {
    weights[i] = INT32_MAX;
    colors[i] = WHITE;
  }

  weights[0] = 0;

  while (true) {
    int32_t mincost = INT32_MAX;
    uint32_t min_idx;
    for (i = 0; i < size; i++) {
      if ((colors[i] != BLACK) && (weights[i] < mincost)) {
        mincost = weights[i];
        min_idx = i;
      }
    }

    if (mincost == INT32_MAX) break;
    callback(min_idx, mincost);
    colors[min_idx] = BLACK;

    for (i = 0; i < size; i++) {
      if ((colors[i] != BLACK) && (graph[min_idx][i] != INT32_MAX)) {
        int32_t new_weight = weights[min_idx] + graph[min_idx][i];
        if (new_weight < weights[i]) {
          weights[i] = new_weight;
          colors[i] = GRAY;
        }
      }
    }
  }
  return true;
}

#if !defined(TEST)
#include <stdio.h>
int32_t graph[MINIMUM_SPANNING_TREE_GRAPH_SIZE][MINIMUM_SPANNING_TREE_GRAPH_SIZE];

static void callback(uint32_t index, int32_t weight)
{
  printf("%d %d\n", index, weight);
}

int32_t main(void)
{
  int32_t num;
  scanf("%d", &num);
  uint32_t i, j;
  for (i = 0; i < num; i++) {
    for (j = 0; j < num; j++) {
      graph[i][j] = INT32_MAX;
    }
  }

  for (i = 0; i < num; i++) {
    int32_t index, len;

    scanf("%d %d", &index, &len);
    for (j = 0; j < len; j++) {
      int32_t v, c;
      scanf("%d %d", &v, &c);
      graph[index][v] = c;
    }
  }

  single_source_shortest_path(graph, num, callback);

  return 0;
}

#endif

Compiler output:
main.c:17:34: error: unknown type name 'single_source_shortest_path_callback_t'
   17 |                                  single_source_shortest_path_callback_t callback)
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c: In function 'main':
main.c:87:3: error: implicit declaration of function 'single_source_shortest_path' [-Wimplicit-function-declaration]
   87 |   single_source_shortest_path(graph, num, callback);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C

#include<stdio.h>
#define N 101
int main(){
  int G[N][N],a[N],f[N];
  int n,i,j,k=1,m=0,num,sum=0;
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&G[i][j]);
    }
  }
  a[0]=0;
  f[0]=1;
   
  for(i=1;i<n;i++) f[i]=0;


  for(k=1;k<n;k++){
    //while(1){
    num=2001;
     
    for(i=0;i<k;i++){
      for(j=0;j<n;j++){
    if(G[a[i]][j]<num && G[a[i]][j]!=-1 && f[j]!=1){
      num=G[a[i]][j];
      m=j;
    }
      }
    }
     
    //if(k!=n){
      a[k]=m;
      f[m]=1;
      sum+=num;
      // k++;
      // }
    else break;
  }
  printf("%d\n",sum);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:38:5: error: 'else' without a previous 'if'
   38 |     else break;
      |     ^~~~
Language: C

#include<stdio.h>

#define N 2000
#define A 101
#define NIL -1

void Prim();

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

int M[A][A], p[A], S[A], d[A], n;

main(){
  int i, j, u, k, v, c;
  scanf("%d", &n);
  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", &v, &c);
      M[u][v]=c;
    }
  }
  Prim();
  for (i=0; i<n; i++) printf("%d %d\n", i, (d[i]==INFTY?-1:d[i]));
  
  return 0;
}

void MSTPrim(){
  int i, v, u, k[A];
  for(u=0;u<n;u++){
    k[u]=INFTY;
    p[u]=NIL;
    d[u]=INFTY;
  }
  
  k[0]=0;
  
  while(1){
    int minv=INFTY;
    u=NIL;
    for(i=0; i<n; i++)
      if(k[i]<minv && p[i]==NIL){
	u=i;
	minv=k[i];
      }
    
    if(u==NIL) break;
    p[u]=1;
    d[u]=k[u];
    for(v=0;v<n;v++) if(p[v]!=1 && k[u]+M[u][v]<k[v]) k[v]=k[u]+M[u][v];
  }
}

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

#include <stdio.h>
#define INF 100000000
 
void dijkstra();
void initializeSingleSource();
 
int n,h[100],d[100],dis[100],pi[100],G[100][100];

int main(){
  int i,j,c,u,k,v;
   
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    for(j=0;j<n;j++)   w[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;
    }
  }
  dijkstra();
 
  for(i=0;i<n;i++) printf("%d %d\n",i,d[i]);
 
  return 0;
}
 
void dijkstra(){
  int i,j,u,v,min;
   
  initializeSingleSource();
 
  while(1){
    min=INF;
    for(i=0;i<n;i++){
      if(h[i]!=1&&d[i]<min){
    min=d[i];
    u=i;
      }
    }
 
    if(min==INF) break;
 
    h[u]=1;
 
    for(v=0;v<n;v++){
      if(color[v]!=1&&d[u]+G[u][v]<d[v]&&G[u][v]!=-1){
    pi[v]=u;
    d[v]=G[u][v]+d[u];
      }
    }
  }
   
}
 
void initializeSingleSource(){
  int v; 
  for(v=0;v<n;v++){
    d[v]=INF;
    pi[v]=-1;
    h[v]=-1;
  }
  d[0]=0;
}

Compiler output:
main.c: In function 'main':
main.c:15:24: error: 'w' undeclared (first use in this function)
   15 |     for(j=0;j<n;j++)   w[i][j]=-1;
      |                        ^
main.c:15:24: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'dijkstra':
main.c:51:10: error: 'color' undeclared (first use in this function)
   51 |       if(color[v]!=1&&d[u]+G[u][v]<d[v]&&G[u][v]!=-1){
      |          ^~~~~
Language: C

#include <stdio.h>
#define N 101
#define INF 100000
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,mat[N][N];

void dijkstra(){
  int minv,i,v;
  int d[N],color[N];

  for(i=0;i<n;i++){
    d[i]=INF;
    color[i]=WHITE;
  }
  d[0]=0;
  color[0]=GRAY;
  while(1){
    minv=INF;
    int u=-1;
    for(i=0;i<n;i++){
      if(minv>d[i]&&color[i]!=BLACK){
        u=i;
        minv=d[i];
      }
    }
    if(u==-1) break;
    color[u]=BLACK;
    for(v=0;v<n;v++){
      if(color[v]!=BLACK && mat[u][v]!=INF){
        if(d[v]>d[u]+mat[u][v]){
          d[v]=d[u]+mat[u][v];
          color[v]=GRAY;
        }
      }
    }
  }
  for(i=0;i<n;i++){
    printf("%d ",i);
  printf("%d",d[i]==INF?-1:d[i])
  }
}

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

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      mat[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);
      mat[u][v]=c;
    }
  }

  dijkstra();
return 0;
}

Compiler output:
main.c: In function 'dijkstra':
main.c:42:33: error: expected ';' before '}' token
   42 |   printf("%d",d[i]==INF?-1:d[i])
      |                                 ^
      |                                 ;
   43 |   }
      |   ~
Language: C

#include<stdio.h>
#define MAX 101
 
int n,
int size[MAX],t[MAX][MAX],cost[MAX][MAX],distance[MAX];
void spp(int,int);
 
int main(){
  int i,j;
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    int a;
    scanf("%d",&a);
    scanf("%d",&size[a]);
 
    for(j=0;j<size[a];j++){
      scanf("%d",&t[a][j]); 
      scanf("%d",&cost[a][j]);
    }
  }
 
  for(i=0;i<n;i++) distance[i]=114514810;
  spp(0,0);
  for(i=0;i<n;i++){
    printf("%d %d\n",i,distance[i]);
  }
  return 0;
}

void spp(int x,int y){
  int i;
  distance[x]=y;
 
  for(i=0;i<size[x];i++){
    if(distance[t[x][i]]>y+cost[x][i]) spp(t[x][i],y+cost[x][i]);
  }
}

Compiler output:
main.c:5:1: error: expected identifier or '(' before 'int'
    5 | int size[MAX],t[MAX][MAX],cost[MAX][MAX],distance[MAX];
      | ^~~
main.c: In function 'main':
main.c:15:17: error: 'size' undeclared (first use in this function); did you mean 'size_t'?
   15 |     scanf("%d",&size[a]);
      |                 ^~~~
      |                 size_t
main.c:15:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:18:19: error: 't' undeclared (first use in this function)
   18 |       scanf("%d",&t[a][j]);
      |                   ^
main.c:19:19: error: 'cost' undeclared (first use in this function)
   19 |       scanf("%d",&cost[a][j]);
      |                   ^~~~
main.c:23:20: error: 'distance' undeclared (first use in this function)
   23 |   for(i=0;i<n;i++) distance[i]=114514810;
      |                    ^~~~~~~~
main.c: In function 'spp':
main.c:33:3: error: 'distance' undeclared (first use in this function)
   33 |   distance[x]=y;
      |   ^~~~~~~~
main.c:35:13: error: 'size' undeclared (first use in this function); did you mean 'size_t'?
   35 |   for(i=0;i<size[x];i++){
      |             ^~~~
      |             size_t
main.c:36:17: error: 't' undeclared (first use in this function)
   36 |     if(distance[t[x][i]]>y+cost[x][i]) spp(t[x][i],y+cost[x][i]);
      |                 ^
main.c:36:28: error: 'cost' undeclared (first use in this function)
   36 |     if(distance[t[x][i]]>y+cost[x][i]) spp(t[x][i],y+cost[x][i]);
      |                            ^~~~
Language: C

#include<stdio.h>
#define MAX 100;
int u[MAX],k[MAX],d[MAX],v[MAX][MAX],c[MAX][MAX];
void dks();
int main(){
int n,i,j;
scanf("%d",&n);
for(i=0;i<n;i++){
  scanf("%d %d",&u[i],&k[i]);
  d[i]=-1;
  for(j=0;j<k[i];j++){
    scanf("%d %d",&v[u[i]][j],&c[u[i]][j]);
  }
}
dks();

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

void dks(){

}

Compiler output:
main.c:2:16: error: expected ']' before ';' token
    2 | #define MAX 100;
      |                ^
main.c:3:7: note: in expansion of macro 'MAX'
    3 | int u[MAX],k[MAX],d[MAX],v[MAX][MAX],c[MAX][MAX];
      |       ^~~
main.c:3:17: error: expected identifier or '(' before ']' token
    3 | int u[MAX],k[MAX],d[MAX],v[MAX][MAX],c[MAX][MAX];
      |                 ^
main.c:3:24: error: expected identifier or '(' before ']' token
    3 | int u[MAX],k[MAX],d[MAX],v[MAX][MAX],c[MAX][MAX];
      |                        ^
main.c:3:31: error: expected identifier or '(' before ']' token
    3 | int u[MAX],k[MAX],d[MAX],v[MAX][MAX],c[MAX][MAX];
      |                               ^
main.c:3:36: error: expected identifier or '(' before ']' token
    3 | int u[MAX],k[MAX],d[MAX],v[MAX][MAX],c[MAX][MAX];
      |                                    ^
main.c:3:43: error: expected identifier or '(' before ']' token
    3 | int u[MAX],k[MAX],d[MAX],v[MAX][MAX],c[MAX][MAX];
      |                                           ^
main.c:3:48: error: expected identifier or '(' before ']' token
    3 | int u[MAX],k[MAX],d[MAX],v[MAX][MAX],c[MAX][MAX];
      |                                                ^
main.c: In function 'main':
main.c:9:18: error: 'u' undeclared (first use in this function)
    9 |   scanf("%d %d",&u[i],&k[i]);
      |                  ^
main.c:9:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:24: error: 'k' undeclared (first use in this function)
    9 |   scanf("%d %d",&u[i],&k[i]);
      |                        ^
main.c:10:3: error: 'd' undeclared (first use in this function)
   10 |   d[i]=-1;
      |   ^
main.c:12:20: error: 'v' undeclared (first use in this function)
   12 |     scanf("%d %d",&v[u[i]][j],&c[u[i]][j]);
      |                    ^
main.c:12:32: error: 'c' undeclared (first use in this function)
   12 |     scanf("%d %d",&v[u[i]][j],&c[u[i]][j]);
      |                                ^
main.c:23:1: error: expected declaration or statement at end of input
   23 | }
      | ^
Language: C

#include <stdio.h>

void saitan(int,int);

int n,v[100][100],d[100],u,k[100],c[100][100];

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

  return 0;
}

void saitan(int p,int x){
  int i;
  
  d[p] = x;
  
  for(i=0;i<k[p];i++){
    if(d[v[p][i]] > x+c[p][i]){
      MST(v[p][i],x+c[p][i]);
    }
  }
  return;
}

Compiler output:
main.c: In function 'saitan':
main.c:37:7: error: implicit declaration of function 'MST' [-Wimplicit-function-declaration]
   37 |       MST(v[p][i],x+c[p][i]);
      |       ^~~
Language: C

#include<stdio.h>
#define MAX 100
#define INF 100000
#define W 0
#define G 1
#define B 2

int n,M[MAX][MAX];

void dijkstra()
{
  int i,u,v,minv,d[MAX],color[MAX];

  for(i=0;i<n;i++)
    {
      d[i]=INF;
      color[i]=W;
    }

  d[0]=0;
  color[0]=G;

  while(1){
    minv=INF;
    u=-1;
    for(i=0;i<n;i++)
      {
	if(minv>d[i]&&color[i]!=B)
	  {
	    u=i;
	    minv=d[i];
	  }
      }
    if(u==i) break;
    color[u]=B;
    for(v=0;v<n;v++)
      {
	if(color[v]!=B&&M[u][v]!=INF)
	  {
	    if(d[v]>d[u]+M[u][v])
	      {
		d[v]=d[u]+M[u][v];
		color[v]=G;
	      }
	  }
      }
  }

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

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

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

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

  dijksta();

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:79:3: error: implicit declaration of function 'dijksta'; did you mean 'dijkstra'? [-Wimplicit-function-declaration]
   79 |   dijksta();
      |   ^~~~~~~
      |   dijkstra
Language: C

include<stdio.h>

#define MAX 100
#define INFTY 100000
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[MAX][MAX];
void dij(){
  int minv,i,v;
  int d[MAX],color[MAX];
  for(i=0;i<n;i++){
    d[i]=INFTY;
    color[i]=WHITE;
  }
  d[0]=0;
  color[0]=GRAY;
  while(1){
    minv=INFTY;
    int u=-1;
    for(i=0;i<n;i++){
 if(minv>d[i]&&color[i]!=BLACK){
        u=i;
        minv=d[i];
      }
    }
    if(u==-1)break;
    color[u]=BLACK;
    for(v=0;v<n;v++){
      if(color[v]!=BLACK && M[u][v]!=INFTY){
        if(d[v]>d[u]+M[u][v]){
          d[v]=d[u]+M[u][v];
 color[v]=GRAY;
        }
      }
    }
  }
}
int main(){
  int n,i,j,k,c,u,v;
  scanf("%d",&n);
  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",&v,&c);
      M[u][v]=c;
    }
  }
  dij();
  for(i=0;i<n;i++){
 printf("%d ",i);
    if(d[i]==INFTY)printf("%d\n",-1);
    else printf("%d\n",d[i]);
  }
  return 0;
}

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
main.c: In function 'dij':
main.c:13:13: error: 'n' undeclared (first use in this function)
   13 |   for(i=0;i<n;i++){
      |             ^
main.c:13:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:31:29: error: 'M' undeclared (first use in this function)
   31 |       if(color[v]!=BLACK && M[u][v]!=INFTY){
      |                             ^
main.c: In function 'main':
main.c:42:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   42 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include<stdio.h>
main.c:42:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   42 |   scanf("%d",&n);
      |   ^~~~~
main.c:42:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:45:1: error: 'M' undeclared (first use in this function)
   45 | M[i][j]=INFTY;
      | ^
main.c:57:2: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   57 |  printf("%d ",i);
      |  ^~~~~~
main.c:57:2: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:57:2: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:57:2: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:58:8: error: 'd' undeclared (first use in this function)
   58 |     if(d[i]==INFTY)printf("%d\n",-1);
      |        ^
Language: C

include<stdio.h>

#define MAX 100
#define INFTY 100000
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[MAX][MAX];
void dij(){
  int minv,i,v;
  int d[MAX],color[MAX];
  for(i=0;i<n;i++){
    d[i]=INFTY;
    color[i]=WHITE;
  }
  d[0]=0;
  color[0]=GRAY;
  while(1){
    minv=INFTY;
    int u=-1;
    for(i=0;i<n;i++){
 if(minv>d[i]&&color[i]!=BLACK){
        u=i;
        minv=d[i];
      }
    }
    if(u==-1)break;
    color[u]=BLACK;
    for(v=0;v<n;v++){
      if(color[v]!=BLACK && M[u][v]!=INFTY){
        if(d[v]>d[u]+M[u][v]){
          d[v]=d[u]+M[u][v];
 color[v]=GRAY;
        }
      }
    }for(i=0;i<n;i++){
 printf("%d ",i);
    if(d[i]==INFTY)printf("%d\n",-1);
    else printf("%d\n",d[i]);
  }
  }
}
int main(){
  int n,i,j,k,c,u,v;
  scanf("%d",&n);
  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",&v,&c);
      M[u][v]=c;
    }
  }
  dij();
  
  return 0;
}

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
main.c: In function 'dij':
main.c:13:13: error: 'n' undeclared (first use in this function)
   13 |   for(i=0;i<n;i++){
      |             ^
main.c:13:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:31:29: error: 'M' undeclared (first use in this function)
   31 |       if(color[v]!=BLACK && M[u][v]!=INFTY){
      |                             ^
main.c:38:2: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   38 |  printf("%d ",i);
      |  ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | include<stdio.h>
main.c:38:2: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   38 |  printf("%d ",i);
      |  ^~~~~~
main.c:38:2: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: In function 'main':
main.c:46:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   46 |   scanf("%d",&n);
      |   ^~~~~
main.c:46:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:46:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
main.c:46:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:49:1: error: 'M' undeclared (first use in this function)
   49 | M[i][j]=INFTY;
      | ^
Language: C

#include<stdio.h>
#define MAX 100
#define INFTY = (1<<21)
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[MAX][MAX];

void dig(){
  int minv,d[MAX],iro[MAX];
  int i,j,u,v;
  for(i=0;i<n;i++){
    d[i]=INFTY;
    iro[i]=WHITE;
  }
  d[0]=0;
  iro[0]=GRAY;
  while(1){
    minv=INFTY;
    u=-1;
    for(i=0;i<n;i++){
      if(minv>d[i] && iro[i]!=BLACK){
	u=i;
	minv=d[i];
      }
    }
    if(u==-1)break;
    iro[u]=BLACK;
    for(v=0;v<n;v++){
      if(iro[v]!=BLACK && M[u][v]!=INFTY){
	if(d[v]>d[u] + M[u][v]){
	  d[v]=d[u]+M[u][v];
	  iro[v]=GRAY;
	}
      }
    }
  }
  for(i=0;i<n;i++){
    printf("%d ",i);
    if(d[i]==INFTY)printf("-1\n");
    else printf("%d\n",d[i]);
  }
}

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

  return 0;
}

Compiler output:
main.c: In function 'dig':
main.c:3:15: error: expected expression before '=' token
    3 | #define INFTY = (1<<21)
      |               ^
main.c:14:10: note: in expansion of macro 'INFTY'
   14 |     d[i]=INFTY;
      |          ^~~~~
main.c:3:15: error: expected expression before '=' token
    3 | #define INFTY = (1<<21)
      |               ^
main.c:20:10: note: in expansion of macro 'INFTY'
   20 |     minv=INFTY;
      |          ^~~~~
main.c:3:15: error: expected expression before '=' token
    3 | #define INFTY = (1<<21)
      |               ^
main.c:31:36: note: in expansion of macro 'INFTY'
   31 |       if(iro[v]!=BLACK && M[u][v]!=INFTY){
      |                                    ^~~~~
main.c:3:15: error: expected expression before '=' token
    3 | #define INFTY = (1<<21)
      |               ^
main.c:41:14: note: in expansion of macro 'INFTY'
   41 |     if(d[i]==INFTY)printf("-1\n");
      |              ^~~~~
main.c: In function 'main':
main.c:48:3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'scanf'
   48 |   scanf("%d",&n);
      |   ^~~~~
main.c:50:9: error: 'j' undeclared (first use in this function)
   50 |     for(j=0;j<n;j++){
      |         ^
main.c:50:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:3:15: error: expected expression before '=' token
    3 | #define INFTY = (1<<21)
      |               ^
main.c:51:15: note: in expansion of macro 'INFTY'
   51 |       M[i][j]=INFTY;
      |               ^~~~~
Language: C

#include <stdio.h>
#define MAX 1000 
#define INF 10000000
 
int G[MAX][MAX];
int d[MAX];
char color[MAX];
int n;
 

void initializeSingleSource(void){
  int v;
 
  for(v=0;v<MAX;v++){
    d[v]=INF; 
    color[v]='W';
  }
  d[0]=0;
  color[0]='G';
}
void dijkstra(void){
  int mincost,i,u,v;
 
  initializeSingleSource();
 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(v=0;v<n;v++){
      if(color[v]!=='B' && G[u][v]!=INF){     
    if(d[v]>d[u]+G[u][v]){
    d[v]=d[u]+G[u][v];
    color[v]='G';
    }
      }
    }
 
  }
 
 
  for(i=0;i<n;i++){
    printf("%d %d\n",i,d[i]);
  }
}

int main(){
 
  int u,k,i,j,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();
   
  return 0;
}

Compiler output:
main.c: In function 'dijkstra':
main.c:38:20: error: expected expression before '=' token
   38 |       if(color[v]!=='B' && G[u][v]!=INF){
      |                    ^
Language: C

#include<stdio.h>

int WHITE = 0;
int GRAY = 1;
int BLACK = 2;
int INFTY = 100000000;

int i, v, n, M[100][100];

void dijkstra(){
    int minv;
    int d[100], color[100];

    for(i=0;i<n;i++){
        d[i] = INFTY;
        color[i] = WHITE;
    }

    d[0] = 0;
    color[0] = GRAY;
    while( 1 ){
        minv = INFTY;
        int u = -1;
        for(i=0;i<n;i++){
            if(minv > d[i] && color[i] != BLACK){
                u=i;
                minv = d[i];
            }
        }
        if(u==-1)
        break;
        color[u] = BLACK;
        for(v=0;v<n;v++){
            if(color[v] != BLACK && M[u][v] != INFTY){
                if(d[v] > d[u] + M[u][v]){
                    d[v] = d[u] + M[u][v];
                    color[v] = GRAY;
                }
            }
        }
    }
    for(i=0;i<n;i++){
        d[i] = INFTY ? -1 : d[i]);
        printf("%d %d\n", i, d[i]);
    }
}

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

    scanf("%d", &n);
    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", &v, &c);
            M[u][v] = c;
        }
    }

    dijkstra();

    return 0;
}

Compiler output:
main.c: In function 'dijkstra':
main.c:43:33: error: expected ';' before ')' token
   43 |         d[i] = INFTY ? -1 : d[i]);
      |                                 ^
      |                                 ;
main.c:43:33: error: expected statement before ')' token
main.c: In function 'main':
main.c:53:13: error: 'j' undeclared (first use in this function)
   53 |         for(j=0;j<n;j++){
      |             ^
main.c:53:13: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#define INF (1<<21)

int main(void)
{
 int i,j,n,m,u,k,l,v,c,a[10000],b[10000],d[10000][10000];

 scanf("%d",&n);
 
 for(i=0;i<n;i++){
 	a[i]=INF;
 	b[i]=0;
 }
 a[0]=0;
 
 for(i=0;i<n;i++){
 	scanf("%d %d",&u,&k);
 	for(j=0;j<k;j++){
 		scanf("%d %d",&v,&c);
 		d[u][v]=c;
 	}
 }
 
 while(1){
 	
 	l=-1;
 	m=INF;
 	
 	for(i=0;i<n;i++){
 		if(a[i]<m && b[i]==0){
 			m=a[i];
 			l=i;
 		}
 	}
 	
 	if(l==-1) break;
 	
 	b[l]=1;
 	
 	for(i=0;i<n;i++){
 		if(a[i]>=d[l][i]+a[l]) a[i]=d[l][i]+a[l];
 	}
 }
 
 for(i=0;i<n;i++) printf("%d %d\n",i,(a[i]==INF?-1:a[i]));
 }
 
 return 0;
}

Compiler output:
main.c:48:2: error: expected identifier or '(' before 'return'
   48 |  return 0;
      |  ^~~~~~
main.c:49:1: error: expected identifier or '(' before '}' token
   49 | }
      | ^
Language: C

#include <stdio.h>

int main(){
   int i, j, k;
   int a, b, c, n;
   int num, N[100][100],color[100],d[100];
   
   scanf("%d", &n);
   
   for(i=0; i<n; i++){
      for(j=0; j<n; j++){
         N[i][j]=100000;
      }
   }

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

    for(i=0; i<n; i++){
       d[i] = 100000;
       color[i] = 0;
    }
    d[0] = 0;

   while (1){
      k = 100000;
   for(i=0; i<n; i++){
      if(color[i] != 1 && d[i] < k){
          k = d[i];
          num = i;
      }
   }
   if(k == 100000) break;
   color[num] = 1;
   
   for(i=0; i<n; i++{
      if(color[i] != 1 && d[u]+N[num][i] < d[i]){
         d[i] = d[num]+N[num][i];
       }
   }
   }

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

   return 0;
}

Compiler output:
main.c: In function 'main':
main.c:41:21: error: expected ')' before '{' token
   41 |    for(i=0; i<n; i++{
      |       ~             ^
      |                     )
main.c:46:4: error: expected expression before '}' token
   46 |    }
      |    ^
Language: C

#include <stdio.h>

int main(){
   int i, j, k;
   int a, b, c, n;
   int num, N[100][100],color[100],d[100];
   
   scanf("%d", &n);
   
   for(i=0; i<n; i++){
      for(j=0; j<n; j++){
         N[i][j]=100000;
      }
   }

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

    for(i=0; i<n; i++){
       d[i] = 100000;
       color[i] = 0;
    }
    d[0] = 0;

   while (1){
      k = 100000;
   for(i=0; i<n; i++){
      if(color[i] != 1 && d[i] < k){
          k = d[i];
          num = i;
      }
   }
   if(k == 100000) break;
   color[num] = 1;
   
   for(i=0; i<n; i++){
      if(color[i] != 1 && d[u]+N[num][i] < d[i]){
         d[i] = d[num]+N[num][i];
       }
   }
   }

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

   return 0;
}

Compiler output:
main.c: In function 'main':
main.c:42:29: error: 'u' undeclared (first use in this function)
   42 |       if(color[i] != 1 && d[u]+N[num][i] < d[i]){
      |                             ^
main.c:42:29: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#define   MAX 100
#define   INFTY 5000000
#define   WHITE 0
#define   GRAY 1
#define   BLACK 2

int n, M[MAX][MAX];

void dijkstra()
{
   int minv;
   int d[MAX], color[MAX];
   int i, v, u = -1;

   for (i=0; i<n; i++){
      d[i] = INFTY;
      color[i] = WHITE;
   }

   d[0] = 0;
   color[0] = GRAY;

   white (1){
      minv = INFTY;
      for (i=0; i<n; i++){
         if (minv>d[i] && color[i]!=BLACK){
            u = i;
            minv = d[i];
         }
      }
      if (u==-1)
         break;
      color[u] = BLACK;
      for (v=0; v<n; v++){
         if (color[v]!=BLACK && M[u][v]!=INFTY){
            if (d[v] > d[u]+M[u][v]){
               d[v] = d[u] + M[u][v];
               color[v] = GRAY;
            }
         }
      }
   }

   for (i=0; i<n; i++){
      d[i] = INFTY ? -1 : d[i];
      if (i>0)
         printf(" ");
      printf("%d", d[i]);
   }
}

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

   scanf("%d", &n);
   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<n; j++){
         scanf("%d %d", &v, &c);
         M[u][v] = c;
      }
   }

   dijkstra();

   return 0;
}

Compiler output:
main.c: In function 'dijkstra':
main.c:24:4: error: implicit declaration of function 'white'; did you mean 'fwrite'? [-Wimplicit-function-declaration]
   24 |    white (1){
      |    ^~~~~
      |    fwrite
main.c:24:13: error: expected ';' before '{' token
   24 |    white (1){
      |             ^
      |             ;
Language: C

#include<stdio.h>
#define   MAX 100
#define   INFTY 5000000
#define   WHITE 0
#define   GRAY 1
#define   BLACK 2

int n, M[MAX][MAX];

void dijkstra()
{
   int minv;
   int d[MAX], color[MAX];
   int i, v, u = -1;

   for (i=0; i<n; i++){
      d[i] = INFTY;
      color[i] = WHITE;
   }

   d[0] = 0;
   color[0] = GRAY;

   while (1){
      minv = INFTY;
      for (i=0; i<n; i++){
         if (minv>d[i] && color[i]!=BLACK){
            u = i;
            minv = d[i];
         }
      }
      if (u==-1)
         break;
      color[u] = BLACK;
      for (v=0; v<n; v++){
         if (color[v]!=BLACK && M[u][v]!=INFTY){
            if (d[v] > d[u]+M[u][v]){
               d[v] = d[u] + M[u][v];
               color[v] = GRAY;
            }
         }
      }
   }

   for (i=0; i<n; i++){
      cout << i << " " << (d[i] == INFTY ? -1 : d[i]) << endl;
   }
}

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

   scanf("%d", &n);
   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<n; j++){
         scanf("%d %d", &v, &c);
         M[u][v] = c;
      }
   }

   dijkstra();

   return 0;
}

Compiler output:
main.c: In function 'dijkstra':
main.c:46:7: error: 'cout' undeclared (first use in this function)
   46 |       cout << i << " " << (d[i] == INFTY ? -1 : d[i]) << endl;
      |       ^~~~
main.c:46:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:46:58: error: 'endl' undeclared (first use in this function)
   46 |       cout << i << " " << (d[i] == INFTY ? -1 : d[i]) << endl;
      |                                                          ^~~~
Language: C

#include<stdio.h>
#define???? MAX 100
#define???? INFTY 5000000
#define???? WHITE 0
#define???? GRAY 1
#define???? BLACK 2

int n, M[MAX][MAX];

void dijkstra()
{
   int minv;
   int d[MAX], color[MAX];
   int i, v, u = -1;

   for (i=0; i<n; i++){
      d[i] = INFTY;
      color[i] = WHITE;
   }

   d[0] = 0;
   color[0] = GRAY;

   while (1){
      minv = INFTY;
      for (i=0; i<n; i++){
         if (minv>d[i] && color[i]!=BLACK){
            u = i;
            minv = d[i];
         }
      }
      if (u==-1)
         break;
      color[u] = BLACK;
      for (v=0; v<n; v++){
         if (color[v]!=BLACK && M[u][v]!=INFTY){
            if (d[v] > d[u]+M[u][v]){
               d[v] = d[u] + M[u][v];
               color[v] = GRAY;
            }
         }
      }
   }

   for (i=0; i<n; i++)
      printf("%d %d\n", i, d[i] == INFTY ? -1 : d[i]);
}

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

   scanf("%d", &n);
   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<n; j++){
         scanf("%d %d", &v, &c);
         M[u][v] = c;
      }
   }

   dijkstra();

   return 0;
}

Compiler output:
main.c:2:8: error: macro names must be identifiers
    2 | #define???? MAX 100
      |        ^
main.c:3:8: error: macro names must be identifiers
    3 | #define???? INFTY 5000000
      |        ^
main.c:4:8: error: macro names must be identifiers
    4 | #define???? WHITE 0
      |        ^
main.c:5:8: error: macro names must be identifiers
    5 | #define???? GRAY 1
      |        ^
main.c:6:8: error: macro names must be identifiers
    6 | #define???? BLACK 2
      |        ^
main.c:8:10: error: 'MAX' undeclared here (not in a function)
    8 | int n, M[MAX][MAX];
      |          ^~~
main.c: In function 'dijkstra':
main.c:17:14: error: 'INFTY' undeclared (first use in this function)
   17 |       d[i] = INFTY;
      |              ^~~~~
main.c:17:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:18:18: error: 'WHITE' undeclared (first use in this function)
   18 |       color[i] = WHITE;
      |                  ^~~~~
main.c:22:15: error: 'GRAY' undeclared (first use in this function)
   22 |    color[0] = GRAY;
      |               ^~~~
main.c:27:37: error: 'BLACK' undeclared (first use in this function)
   27 |          if (minv>d[i] && color[i]!=BLACK){
      |                                     ^~~~~
main.c: In function 'main':
main.c:57:20: error: 'INFTY' undeclared (first use in this function)
   57 |          M[i][j] = INFTY;
      |                    ^~~~~
Language: C


 
int A[1000][1000], n, k, s, u, v;
void saitan(){
  int i,j,a[2000],minv,b[2000],c[2000];
  for(u=0;u <n;u++){
    b[u]=1000;
    c[u]=-1;
    a[u]=0;
  }
  d[0]=0;
   
  while(1){
    minv=1000;
    for(i=0;i<n;i++){
      if(a[i]!=1&&b[i]<minv){
    minv=b[i];
    u=i;
      
    }
    }
    if(minv==1000){
      break;
    }
    a[u]=1;
    for(v=0;v<n;v++){
      if(a[v]!=1&&b[u]+A[u][v]<b[v]&&A[u][v]!=-1){
    c[v]=u;
    b[v]=b[u]+A[u][v];
      }
    }
  }
 
  for(i=0;i<n;i++){
    if(b[i]!=1000){
      printf("%d %d\n",i,b[i]);
    }
  }
   
}
 
int main(){
 
  int i, j;
 
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      A[i][j]=1000;
   }
  }
   
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      scanf("%d",&A[u][v]);
   }
  }
 
  saitan();
 
  return 0;
}
 

Compiler output:
main.c: In function 'saitan':
main.c:11:3: error: 'd' undeclared (first use in this function)
   11 |   d[0]=0;
      |   ^
main.c:11:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:36:7: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   36 |       printf("%d %d\n",i,b[i]);
      |       ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | 
main.c:36:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   36 |       printf("%d %d\n",i,b[i]);
      |       ^~~~~~
main.c:36:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: In function 'main':
main.c:46:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   46 |   scanf("%d",&n);
      |   ^~~~~
main.c:46:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:46:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
main.c:46:3: note: include '<stdio.h>' or provide a declaration of 'scanf'