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

#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
#define maxn 0x3f3f3f3f

int e[1005][1005],vis[1005][1005];
int k,i,j,n,m;
int a,b,x;
int X,Y;

int main() {
	while(~scanf("%d%d",&n,&m)&&n&&m) {
		//初始化
		for(i=0; i<n; i++) {
			for(j=0; j<n; j++) {
				if(i==j) e[i][j]=0;
				else e[i][j]=maxn;
			}
		}
		memset(vis,0,sizeof(vis));
		//读边,要判重边
		for(i=0; i<m; i++) {
        	scanf("%d%d%d",&a,&b,&x);
        	e[a][b]=min(e[a][b],x);
			e[b][a]=e[a][b];
//			if(e[a][b]>x) {
//			    
//				e[a][b]=x;
//				e[b][a]=x;
//			//	vis[a][b]=1;
//			//	vis[b][a]=1;
//			}

		}
		//核心
		for(k=0; k<n; k++) {
			for(i=0; i<n; i++) {
				for(j=0; j<n; j++) {
					if(e[i][j]>e[i][k]+e[k][j])
						e[i][j]=e[i][k]+e[k][j];
				}
			}
		}

//	for(i=0;i<n;i++) {
//		for(j=0;j<n;j++) {
//			printf("%10d",e[i][j]);
//		}
//		printf("\n");
//	}
		scanf("%d%d",&X,&Y);
		if(e[X][Y]!=maxn)
			printf("%d\n",e[X][Y]);
		else printf("-1\n");
	}

	return 0;
}


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

#include <stdio.h>
#define INF 100000000 
#define N 100

int n;
int size[N];
int to[N][N];
int cost[N][N];
int dist[N];
 
void DFS(int,int);

void DFS(int p, int c){
  int i;
  dist[p] = c;
  for(i=0;i<size[p];i++){
    if(dist[to[p][i]] > c + cost[p][i]) dfs(to[p][i], c + cost[p][i]);
  }
}
 
main(int argc,char *argv[]){
  int i, j;
  scanf("%d", &n);
  for(i=0;i<n;i++){
    int u;
    scanf("%d", &u);
    scanf("%d", &size[u]);
    for(j=0;j<size[u];j++){
      scanf("%d", &to[u][j]);
      scanf("%d", &cost[u][j]);
    }
  }
  for(i=0;i<n;i++) dist[i] = INF;
  dfs(0, 0);
  for(i=0;i<n;i++){
    printf("%d %d\n", i, dist[i]);
  }
  return 0;
}
void DFS(int p, int c){
  int i;
  dist[p] = c;
  for(i=0;i<size[p];i++){
    if(dist[to[p][i]] > c + cost[p][i])
      DFS(to[p][i], c + cost[p][i]);
  }
}

Compiler output:
main.c: In function 'DFS':
main.c:17:41: error: implicit declaration of function 'dfs' [-Wimplicit-function-declaration]
   17 |     if(dist[to[p][i]] > c + cost[p][i]) dfs(to[p][i], c + cost[p][i]);
      |                                         ^~~
main.c: At top level:
main.c:21:1: error: return type defaults to 'int' [-Wimplicit-int]
   21 | main(int argc,char *argv[]){
      | ^~~~
main.c:40:6: error: redefinition of 'DFS'
   40 | void DFS(int p, int c){
      |      ^~~
main.c:13:6: note: previous definition of 'DFS' with type 'void(int,  int)'
   13 | void DFS(int p, int c){
      |      ^~~
Language: C

#include <stdio.h>
#define INF 100000000 
#define N 100

int n;
int size[N];
int to[N][N];
int cost[N][N];
int dist[N];
 
void DFS(int,int);
 
main(int argc,char *argv[]){
  int i, j;
  scanf("%d", &n);
  for(i=0;i<n;i++){
    int u;
    scanf("%d", &u);
    scanf("%d", &size[u]);
    for(j=0;j<size[u];j++){
      scanf("%d", &to[u][j]);
      scanf("%d", &cost[u][j]);
    }
  }
  for(i=0;i<n;i++) dist[i] = INF;
  dfs(0, 0);
  for(i=0;i<n;i++){
    printf("%d %d\n", i, dist[i]);
  }
  return 0;
}
void DFS(int p, int c){
  int i;
  dist[p] = c;
  for(i=0;i<size[p];i++){
    if(dist[to[p][i]] > c + cost[p][i])
      DFS(to[p][i], c + cost[p][i]);
  }
}
 

Compiler output:
main.c:13:1: error: return type defaults to 'int' [-Wimplicit-int]
   13 | main(int argc,char *argv[]){
      | ^~~~
main.c: In function 'main':
main.c:26:3: error: implicit declaration of function 'dfs' [-Wimplicit-function-declaration]
   26 |   dfs(0, 0);
      |   ^~~
Language: C

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

#define WHITE 0
#define BRACK 1
#define GRAY 2
#define NILL -1

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


int check(int x,int A[],int c){
  int i;
  for(i=0;i<c;i++){
    if(A[i]==x)return 0;
  }
  return 1;
}

main(){
  int d[N];
  int e1[N];
  int v2[N];
  int B[N][N];
  int n;
  int i, j, e, sum=0,k,w,v1;
  int p[N];
  int flag=0,
    min=INFTY,
    v[N],
    c=1,
    Min[N];
  
  Min[0]=0;
  
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      A[i][j]=WHITE;
      B[i][j]=INFTY;
    }
  }

  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    scanf("%d%d",&v2[i],&e1[i]);
    for(j=0;j<e1[i];j++){
      scanf("%d%d",&v1,&w);
      B[i][v1]=w;
    }
  }

  for(i=0;i<n-1;i++){
    min=INFTY;
    for(k=0;k<c;k++){
      for(j=0;j<n;j++){
	if(check(j,v,c)==1&&min>B[v[k]][j]){
	  min=B[v[k]][j];
	  flag=j;
	}
      }
    }
    
    v[c]=flag;
    p[v[i]]=v[c];

    c++;
    sum+=min;
    Min[flag]=sum;
  }

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(B[i][j]<=Min[i]) {
	d[i]=B[i][j];
	break;
      }
      else{
	d[i]=Min[i];
	break;
      }
    }
  }
  
  for(i=0;i<n;i++)printf("%d %d\n",i,d[i]);
  
  return 0;
}

Compiler output:
main.c:22:1: error: return type defaults to 'int' [-Wimplicit-int]
   22 | main(){
      | ^~~~
main.c: In function 'main':
main.c:40:7: error: 'A' undeclared (first use in this function)
   40 |       A[i][j]=WHITE;
      |       ^
main.c:40:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

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

main(){
  int n, i, j;
  int u,v,c,k,l;
  int M[MAX][MAX],N[MAX],O[MAX];

  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;
    }
  }

  for(i=0;i<n;i++)
    {
      O[i]=0;
      N[i]=INFTY;
    }
  N[0]=0;

  while(1)
    {
      l=INFTY;
      u=-1;
      for(i=0;i<n;i++)
	{
	  if(N[i]<l&&O[i]==0)
	    {
	      u=i;
	      l=N[i];
	    }
	}

      if(u==-1) break;

      O[u]=1;

      for(v=0;v<n;v++)
	{
	  if(N[v]>=N[u]+M[u][v])
	    {
	      N[v]=N[u]+M[u][v];
	    }
	}
 

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

  return 0;
}

Compiler output:
main.c:6:1: error: return type defaults to 'int' [-Wimplicit-int]
    6 | main(){
      | ^~~~
main.c: In function 'main':
main.c:60:27: error: 'd' undeclared (first use in this function)
   60 |     printf("%d %d\n", i, (d[i]==INFTY?-1:d[i]));
      |                           ^
main.c:60:27: note: each undeclared identifier is reported only once for each function it appears in
main.c:64:1: error: expected declaration or statement at end of input
   64 | }
      | ^
Language: C

#include<stdio.h>

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

main(){
  int n, i, j, e, sum;
 
  int u;

  int M[100][100];

  int key[100];


  scanf("%d", &n);

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

  

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

  while(1){
    int u=NIL;
    int v = MAX;
    for(i=0;i<n;i++){
      if(key[i]<max && ){
	u = i;
	min v = key[i];
      }
      if(u==NIL){
	break;
      }
    }
    for(v=0;v<n;v++){
      if(w[u][v] < key[v]){
	key[v] = w[u][v];
	Pi[v]= 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:6:1: error: return type defaults to 'int' [-Wimplicit-int]
    6 | main(){
      | ^~~~
main.c: In function 'main':
main.c:29:5: error: 'pi' undeclared (first use in this function); did you mean 'i'?
   29 |     pi[u] =NIL;
      |     ^~
      |     i
main.c:29:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:29:12: error: 'NIL' undeclared (first use in this function)
   29 |     pi[u] =NIL;
      |            ^~~
main.c:37:17: error: 'max' undeclared (first use in this function)
   37 |       if(key[i]<max && ){
      |                 ^~~
main.c:37:24: error: expected expression before ')' token
   37 |       if(key[i]<max && ){
      |                        ^
main.c:39:9: error: unknown type name 'min'
   39 |         min v = key[i];
      |         ^~~
main.c:46:10: error: 'w' undeclared (first use in this function)
   46 |       if(w[u][v] < key[v]){
      |          ^
main.c:48:9: error: 'Pi' undeclared (first use in this function); did you mean 'i'?
   48 |         Pi[v]= u;
      |         ^~
      |         i
main.c:60:10: error: 'p' undeclared (first use in this function)
   60 |     if ( p[i] != -1 ) sum += M[i][p[i]];
      |          ^
Language: C

#include<stdio.h>
 
#define N 100
 
static const int MAX = 500;
static const int INFTY = (1<<21);
 
main(){
  int l, i, j, x, v,c=0,k=0;
  int u = 0,mincost = 0;
  int cost[N];
  int d[N];
  int p[N],M[N][N];
   
   
  scanf("%d", &l);
  for ( i = 0; i< l; i++ ){
    for ( j = 0; j < l; j++ ){
      M[i][j] = INFTY;
    }
  }
   
  for ( i = 0; i < l; i++ ){
    scanf("%d %d", &u, &k);
    for ( j = 0; j < k; j++ ){
      scanf("%d %d", &v, &c);
      M[u][v] = c;
    }
  }
   
  for(i=0;i < n;i++){
    d[i] = INFTY;
    p[i] = -1;
    cost[i] = 0;
  }
   
  d[0] = 0;
   
  while(1){
    u = -1;
    mincost = INFTY;
     
    for(i=0;i < l;i++){
      if(d[i] < mincost && cost[i] == 0){
    mincost = d[i];
    u = i;
      }
    }
     
    if(u == -1) break;
     
    cost[u] = 1;
     
    for(v=0;v <n;v++){
      if(d[v] > d[u]+M[u][v]){
    p[v] = u;
    d[v] = d[u]+M[u][v];
      }
    }
  }
   
  for ( i = 0; i < l; i++ ){
    printf("%d %d\n", i, (d[i]==INFTY?-1:d[i]));
  }
   
  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:31:15: error: 'n' undeclared (first use in this function)
   31 |   for(i=0;i < n;i++){
      |               ^
main.c:31:15: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

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

main(){
  int n, i, j,u,v,k,c;
  /**/
  int M[MAX][MAX],d[MAX],k[MAX],p[MAX];
  /**/
  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;
    }
  }
  
  /**/  
  for(i=0;i<n;i++){
    p[i]=-1;
    d[i]=INFTY;
    k[i]=0;
    }
  
  d[0]=0;
  
  
  while(u!=-1){
    u=-1;
    m=INFTY;
    
    for(i=0;i<n;i++){
      if(m>d[i] && (key[i]==0)){
	u=i;
	m=d[i];
	
      }
        }
    key[u]=1;
    for(i=0;i<n;i++) {
      if(d[i] >= M[u][i]+d[u] && (key[i] == 0)) {
	d[i] = M[u][i]+d[u];
	p[i] = u;
      }
    }    

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

Compiler output:
main.c:6:1: error: return type defaults to 'int' [-Wimplicit-int]
    6 | main(){
      | ^~~~
main.c: In function 'main':
main.c:9:26: error: conflicting types for 'k'; have 'int[MAX]'
    9 |   int M[MAX][MAX],d[MAX],k[MAX],p[MAX];
      |                          ^
main.c:7:19: note: previous declaration of 'k' with type 'int'
    7 |   int n, i, j,u,v,k,c;
      |                   ^
main.c:38:5: error: 'm' undeclared (first use in this function)
   38 |     m=INFTY;
      |     ^
main.c:38:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:41:21: error: 'key' undeclared (first use in this function)
   41 |       if(m>d[i] && (key[i]==0)){
      |                     ^~~
main.c:61:1: error: expected declaration or statement at end of input
   61 | }
      | ^
Language: C

#include<stdio.h>

void koria(int,int);

void koria(int i, int c){
 printf("%d %d\n", i, c);
}


static const int MAX = 500;
static const int INY = (1<<21);
 
int main(){
  int n;
  int i;
  int j;
  int u;
  int v;
  int c;
  int k;
  int min = INY;
  int M[MAX][MAX];
  int cost[MAX];
  int vis[MAX];
  int p[MAX];
   
  scanf("%d", &n);
  for ( i = 0; i< n; i++ ){
    for ( j = 0; j < n; j++ ){
      M[i][j] = INY;
    }
  }
 
  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;
    }
  }
 
 
 
  for(i=0;i<n;i++){
    cost[i]=INY;
    p[i]=-1;
    vis[i]=0;
  }
  cost[0]=0;
   
  while(1){
    u=-1;
    min=INY;
  
    for(i=0;i<n;i++){
      if (cost[i]<min && !vis[i]){
    u=i;
    min=cost[i];
      }
    }
     
    if(u==-1) break;
    vis[u]=1;
    int c = 0;
    for(v=0;v<n;v++){
      if(cost[u]+M[u][v]<cost[v] && !vis[v])

{
    cost[v]=cost[u]+M[u][v];
    p[v]=u;
+ )

{
       c = cost[i];
       

     koria(i,c);
  }
 
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:71:3: error: expected expression before ')' token
   71 | + )
      |   ^
main.c:71:3: error: expected statement before ')' token
main.c:81:1: error: expected declaration or statement at end of input
   81 | }
      | ^
main.c:81:1: error: expected declaration or statement at end of input
main.c:81:1: error: expected declaration or statement at end of input
Language: C

#include<stdio.h>




static const int MAX = 500;
static const int INY = (1<<21);
 
int main(){
  int n;
  int i;
  int j;
  int u;
  int v;
  int c;
  int k;
  int min = INY;
  int M[MAX][MAX];
  int cost[MAX];
  int vis[MAX];
  int p[MAX];
   
  scanf("%d", &n);
  for ( i = 0; i< n; i++ ){
    for ( j = 0; j < n; j++ ){
      M[i][j] = INY;
    }
  }
 
  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;
    }
  }
 
 
 
  for(i=0;i<n;i++){
    cost[i]=INY;
    p[i]=-1;
    vis[i]=0;
  }
  cost[0]=0;
   
  while(1){
    u=-1;
    min=INY;
  
    for(i=0;i<n;i++){
      if (cost[i]<min && !vis[i]){
    u=i;
    min=cost[i];
      }
    }
     
    if(u==-1) break;
    vis[u]=1;
    int c = 0;
    for(v=0;v<n;v++){
      if(cost[u]+M[u][v]<cost[v] && !vis[v])

{
    cost[v]=cost[u]+M[u][v];
    p[v]=u;
      }
    }
  }

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

{
       c = cost[i];
       

     koria(i,c);
  }
 
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:77:6: error: implicit declaration of function 'koria' [-Wimplicit-function-declaration]
   77 |      koria(i,c);
      |      ^~~~~
Language: C

#include<stdio.h>

void koria(int,int);

void koria(int i, int c){
 printf("%d \n, c);
}


static const int MAX = 500;
static const int INY = (1<<21);
 
int main(){
  int n;
  int i;
  int j;
  int u;
  int v;
  int c;
  int k;
  int min = INY;
  int M[MAX][MAX];
  int cost[MAX];
  int vis[MAX];
  int p[MAX];
   
  scanf("%d", &n);
  for ( i = 0; i< n; i++ ){
    for ( j = 0; j < n; j++ ){
      M[i][j] = INY;
    }
  }
 
  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;
    }
  }
 
 
 
  for(i=0;i<n;i++){
    cost[i]=INY;
    p[i]=-1;
    vis[i]=0;
  }
  cost[0]=0;
   
  while(1){
    u=-1;
    min=INY;
  
    for(i=0;i<n;i++){
      if (cost[i]<min && !vis[i]){
    u=i;
    min=cost[i];
      }
    }
     
    if(u==-1) break;
    vis[u]=1;
    int c = 0;
    for(v=0;v<n;v++){
      if(cost[u]+M[u][v]<cost[v] && !vis[v])

{
    cost[v]=cost[u]+M[u][v];
    p[v]=u;
      }
    }
  }

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

{
       c = cost[i];
       

     koria(i,c);
  }
 
  return 0;
}

Compiler output:
main.c: In function 'koria':
main.c:6:9: warning: missing terminating " character
    6 |  printf("%d \n, c);
      |         ^
main.c:6:9: error: missing terminating " character
    6 |  printf("%d \n, c);
      |         ^~~~~~~~~~~
main.c:7:1: error: expected expression before '}' token
    7 | }
      | ^
main.c:6:9: error: expected ';' before '}' token
    6 |  printf("%d \n, c);
      |         ^
      |         ;
    7 | }
      | ~
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
 
#define WHITE 0
#define BRACK 1
 
int **matrix;
int *d;
int *parent;
int *color;
 
void dijkstra(int);
 
int main()
{
  int n,i,j,k,u,v;
  scanf("%d",&n);
 
  color =  malloc(n * sizeof(int ));
  d =  malloc(n * sizeof(int ));
  parent = malloc(n * sizeof(int));
 
  matrix = malloc(n * sizeof(int *));
  for(i=0;i<n;i++)
    matrix[i] = malloc(n * sizeof(int));
  
  for(i=0;i<n;i++)
    for(j=0;j<n;j++)
      matrix[i][j] = -1;
  
  for(i=0;i<n;i++)
    {
      scanf("%d%d",&u,&k);
      for(j=0;j<k;j++)
	{
	  scanf("%d",&v);
	  scanf("%d",&matrix[u][v]);
	}
    }
  
  dijkstra(n);
  
  for(i=0;i<n;i++) printf("%d %d\n",i,d[i]);
  
  free(d);
  free(color);
  free(parent);
  for(i=0;i<n;i++) free(matrix[i]);
  free(matrix);
 
  return 0;
   
}
 
 
void dijkstra(int n)
{
  int mincost;
  int i,j,u;
  
  for(i=0;i<n;i++)
    {
      d[i] = INT_MAX;
      parent[i] = -1;
      color[i] = WHITE;
    }
  
  d[0] = 0;
  
  while(1)
    {
      mincost = INT_MAX;
      
      for(i=0;i<n;i++)
	{
	  if(color[i] != BLACK && d[i] < mincost)
	    {
	      mincost = d[i];
	      u = i;
	    }
	}
      
      if(mincost == INT_MAX) break;
      
      color[u] = BlACK;
      
      for(i=0;i<n;i++)
	{
	  if(color[i] != BlACK && matrix[u][i] != -1 && matrix[u][i] + d[u] < d[i])
	    {
	      d[i] = matrix[u][i] + d[u];
	      parent[i] = u;
	    }
	}
    }
}

Compiler output:
main.c: In function 'dijkstra':
main.c:77:26: error: 'BLACK' undeclared (first use in this function); did you mean 'BRACK'?
   77 |           if(color[i] != BLACK && d[i] < mincost)
      |                          ^~~~~
      |                          BRACK
main.c:77:26: note: each undeclared identifier is reported only once for each function it appears in
main.c:86:18: error: 'BlACK' undeclared (first use in this function); did you mean 'BRACK'?
   86 |       color[u] = BlACK;
      |                  ^~~~~
      |                  BRACK
Language: C

typedef struct{
  int u;
  int k;
  int v[100];
  int c[100];
  int used;
  int cost;
} WeightedGraph;
WeightedGraph G[100];
void SSSP(int);
 
main(){
  int i, j, n, u, k;
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%d %d", &G[i].u, &G[i].k);
    for(j = 0; j < G[i].k; j++){
      scanf("%d %d", &G[i].v[j], &G[i].c[j]);
    }
  }
  SSSP(n);
  for(i = 0; i < n; i++){
    printf("%d %d\n", G[i].u, G[i].cost);
  }
  return 0;
}
 
void SSSP(int n){
  int i, j, res, minCost, pos, next_pos, next_cost;
   
  for(i = 0; i < n; i++){
    G[i].used = 0;
    G[i].cost = INF;
  }
  G[0].cost = 0;
 
  while(1){
    minCost = INF;
    for(i = 0; i < n; i++){
      if(G[i].used == 0 && minCost > G[i].cost){
    minCost = G[i].cost;
    pos = i;
      }
    }
    if(minCost == INF) break;
    G[pos].used = 1;
 
    for(i = 0; i < G[pos].k; i++){
      next_pos = G[pos].v[i];
      next_cost = G[pos].c[i] + minCost;
      if(G[next_pos].cost > next_cost) G[next_pos].cost = next_cost;
    }
  }
}

Compiler output:
main.c:12:1: error: return type defaults to 'int' [-Wimplicit-int]
   12 | main(){
      | ^~~~
main.c: In function 'main':
main.c:14:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   14 |   scanf("%d", &n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | typedef struct{
main.c:14:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   14 |   scanf("%d", &n);
      |   ^~~~~
main.c:14:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:23:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   23 |     printf("%d %d\n", G[i].u, G[i].cost);
      |     ^~~~~~
main.c:23:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:23:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:23:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: In function 'SSSP':
main.c:33:17: error: 'INF' undeclared (first use in this function)
   33 |     G[i].cost = INF;
      |                 ^~~
main.c:33:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

#define N 101
#define INF 150000

int main(){
  int i, j, min, x, y, z;
  int M[N][N];
  int color[N], d[N];

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    color[i] = 0;
    d[i] = INF;
    for(j = 0; j < n; j++){
      M[i][j] = -1;
    }
  }

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

  d[0] = 0;

  while(1){
    min = INF;
    for(i = 0; i < n; i++){
      if(color[i] != 1 && d[i] < min){
        min = d[i];
        x = i;
      }
    }

    if(min == INF)
      break;

    for(i = 0; i < n; i++){
      if(M[x][i] != -1 && color[i] != 1 && d[x] + M[x][i] < d[i])
        d[i] = d[x] + M[x][i];
    }

    color[x] = 1;

  }

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

  return 0;
}

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


#include <stdio.h>
#include <stdlib.h>
#define INFTY (1 << 21)
#define N 100
#define BLACK 1
#define WHITE 0

int main(){
  int i,j,n,v,c,v1,c1;
  int G[N][N],color[N],d[N],p[N];
 int mincost,u;

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

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

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

  d[0] = 0;

  while(1){
    mincost = INFTY;
    for(i = 0;i < n;i++){
      if(color[i] != 2 && d[i] < mincost){
mincost = d[i];
        u = i;
      }
    }
    if(mincost == INFTY) break;
    color[u] = 2;
     for(i = 0;i < n;i++){
      if(G[u][i] != -1 && color[i] != 2 && (G[u][i]+d[u]) < d[i]){
        p[i] = u;
        d[i] = G[u][i]+ d[u];
        color[i] = BLACK;
      }
    }  for(i = 0;i < n;i++){
    printf("%d %d\n",i,d[i]);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:57:1: error: expected declaration or statement at end of input
   57 | }
      | ^
Language: C

#include <stdio.h>
#include <limits.h>
#define WHITE 0
#define BLACK 1
#define NILL -1
#define N 1000

int d[N], w[N][N], int color[N], v;

int main(){
   int n, i, j, u, k, s = 0, mincost;
 
  scanf("%d",&n);

  for(i = 0;i < n; i++){
    for(j = 0;j < n; j++){
      w[i][j] = INT_MAX;
    }
  }
 
  for(i = 0; i < n; i++){
    d[i] = INT_MAX;
    color[i] = 0;
    scanf("%d %d", &u, &k);
    for(j = 0;j < k; j++){
      scanf("%d", &v);
      scanf("%d", &w[u][v]);
    }
  }
  d[s] = 0;
 
  while(1){
    mincost = INT_MAX;
      for(i = 0;i < n; i++){
    if(d[i] < mincost && color[i] == WHITE){
      mincost = d[i];
      u = i;
    }
      }
 
    if(mincost == INT_MAX){
      break;
    }
    color[u] = BLACK;
 
    for(v = 0;v <= n; v++){
      if(w[u][v] == INT_MAX){
        continue;
      }
      if(d[v] > d[u] + w[u][v]){
        d[v] = d[u] + w[u][v];
      }
    }
  }
  for(i = 0;i < n; i++){
    printf("%d %d\n", i, d[i]);
  }
  return 0;
}

Compiler output:
main.c:8:20: error: expected identifier or '(' before 'int'
    8 | int d[N], w[N][N], int color[N], v;
      |                    ^~~
main.c: In function 'main':
main.c:23:5: error: 'color' undeclared (first use in this function)
   23 |     color[i] = 0;
      |     ^~~~~
main.c:23:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:26:20: error: 'v' undeclared (first use in this function)
   26 |       scanf("%d", &v);
      |                    ^
Language: C

#include<stdio.h>
 static const int INFTY = (1<<21);
 
main(){
  int n, i, j,u,v,t,k,m;
  int M[501][501],a[501],t[501];
 
  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, &t);
      M[u][v] = c;
    }
  }
 
  for(i = 0; i<n; i++){
      t[i]=0;
      a[i]=INFTY;
  }
  a[0]=0;
  
 
  while(1){
      m=INFTY;
      u=-1;
      for(i = 0; i<n; i++){
          if(a[i]<m && t[i]==0){
              u=i;
              m=a[i];
          }
      }
 
      if(u==-1)break;
 
      t[u]=1;
 
      for(v=0; v<n; v++){
          if(a[v] >=a[u]+M[u][v]) a[v]=a[u]+M[u][v];
      }
  }
  for ( i = 0; i < n; i++ ){
     printf("%d %d\n", i, (a[i]==INFTY?-1:a[i]));
}
  return 0;
}

Compiler output:
main.c:4:1: error: return type defaults to 'int' [-Wimplicit-int]
    4 | main(){
      | ^~~~
main.c: In function 'main':
main.c:6:26: error: conflicting types for 't'; have 'int[501]'
    6 |   int M[501][501],a[501],t[501];
      |                          ^
main.c:5:19: note: previous declaration of 't' with type 'int'
    5 |   int n, i, j,u,v,t,k,m;
      |                   ^
main.c:19:17: error: 'c' undeclared (first use in this function)
   19 |       M[u][v] = c;
      |                 ^
main.c:19:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
 static const int INFTY = (1<<21);
 
main(){
  int n, i, j,u,v,t,k,m;
  int M[501][501],a[501],t[501];
 
  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, &t);
      M[u][v] = t;
    }
  }
 
  for(i = 0; i<n; i++){
      t[i]=0;
      a[i]=INFTY;
  }
  a[0]=0;
  
 
  while(1){
      m=INFTY;
      u=-1;
      for(i = 0; i<n; i++){
          if(a[i]<m && t[i]==0){
              u=i;
              m=a[i];
          }
      }
 
      if(u==-1)break;
 
      t[u]=1;
 
      for(v=0; v<n; v++){
          if(a[v] >=a[u]+M[u][v]) a[v]=a[u]+M[u][v];
      }
  }
  for ( i = 0; i < n; i++ ){
     printf("%d %d\n", i, (a[i]==INFTY?-1:a[i]));
}
  return 0;
}

Compiler output:
main.c:4:1: error: return type defaults to 'int' [-Wimplicit-int]
    4 | main(){
      | ^~~~
main.c: In function 'main':
main.c:6:26: error: conflicting types for 't'; have 'int[501]'
    6 |   int M[501][501],a[501],t[501];
      |                          ^
main.c:5:19: note: previous declaration of 't' with type 'int'
    5 |   int n, i, j,u,v,t,k,m;
      |                   ^
Language: C

#include<stdio.h>
#define WHITE 1
#define BLACK 0
 
int main(){
 
  int d[100], color[100], w[100][100],i, j, v, c,n, u, k,min;
 
  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", &v, &c);   
      w[i][v] = c;
    }
  }
 
  for(i = 0; i <=n+1; i++){
    d[i] = 1000000;
    color[i] = WHITE;
  }
 
  d[0] = 0;
   
  while(1){
    min =1000000;
    for(i = 0; i < n; i++){
      if(d[i] < min && color[i] ==WHITE){
        min = d[i];
        u = i;
      }
    }
     
    if(min == 1000000)break;
    color[u] = BLACK;
     
    for(v = 0; v < n; v++){
      if(w[u][v] == -1) continue;
      if(d[v]+1=>  d[u] + w[u][v]) d[v] = d[u] + w[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:45:17: error: expected expression before '>' token
   45 |       if(d[v]+1=>  d[u] + w[u][v]) d[v] = d[u] + w[u][v];
      |                 ^
Language: C

#define N 2000

void MSTPrim();

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

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

int 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;
    }
  }
  sum = 0;
  MSTPrim();
  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;
  for(u=0;u<n;u++){
    key[u]=INFTY;
    p[u]=NIL;
    d[u]=INFTY;
  }
 
  key[0]=0;
  
  while(1){
    int minv=INFTY;
    u=NIL;
    for(i=0; i<n; i++){
      if(key[i]<minv && p[i]==NIL){
	u=i;
	minv=key[i];
      }
    }
    if(u==NIL) break;
    p[u]=1;
    d[u]=key[u];
    for(v=0;v<n;v++){
      if(p[v]!=1 && key[u]+M[u][v]<key[v]){
	key[v]=key[u]+M[u][v];
      }
    }
  }
}

Compiler output:
main.c:8:9: error: 'A' undeclared here (not in a function)
    8 | int key[A], M[A][A], p[A], S[A], d[A], n, sum;
      |         ^
main.c: In function 'main':
main.c:12:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   12 |   scanf("%d", &n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | #define N 2000
main.c:12:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   12 |   scanf("%d", &n);
      |   ^~~~~
main.c:12:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:28:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   28 |     printf("%d %d\n", i, (d[i]==INFTY?-1:d[i]));
      |     ^~~~~~
main.c:28:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:28:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:28:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: In function 'MSTPrim':
main.c:38:10: error: 'NIL' undeclared (first use in this function)
   38 |     p[u]=NIL;
      |          ^~~
main.c:38:10: note: each undeclared identifier is reported only once for each function it appears in
Language: C

include<stdio.h>

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

void MSTPrim();

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

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

int 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;
    }
  }
  sum = 0;
  MSTPrim();
  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;
  for(u=0;u<n;u++){
    key[u]=INFTY;
    p[u]=NIL;
    d[u]=INFTY;
  }
 
  key[0]=0;
  
  while(1){
    int minv=INFTY;
    u=NIL;
    for(i=0; i<n; i++){
      if(key[i]<minv && p[i]==NIL){
	u=i;
	minv=key[i];
      }
    }
    if(u==NIL) break;
    p[u]=1;
    d[u]=key[u];
    for(v=0;v<n;v++){
      if(p[v]!=1 && key[u]+M[u][v]<key[v]){
	key[v]=key[u]+M[u][v];
      }
    }
  }
}

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
main.c: In function 'main':
main.c:16:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   16 |   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:16:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   16 |   scanf("%d", &n);
      |   ^~~~~
main.c:16:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:30:3: error: implicit declaration of function 'MSTPrim' [-Wimplicit-function-declaration]
   30 |   MSTPrim();
      |   ^~~~~~~
main.c:32:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   32 |     printf("%d %d\n", i, (d[i]==INFTY?-1:d[i]));
      |     ^~~~~~
main.c:32:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:32:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:32:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:38:6: warning: conflicting types for 'MSTPrim'; have 'void()'
   38 | void MSTPrim(){
      |      ^~~~~~~
main.c:30:3: note: previous implicit declaration of 'MSTPrim' with type 'void()'
   30 |   MSTPrim();
      |   ^~~~~~~
Language: C

#include <stdio.h>
#define MAX 100
int main(){
  int n,i,j,sum=0,tmp=0,u[MAX],k[MAX],v[MAX],c[MAX];
  scanf("%d",&n);

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



  }

Compiler output:
main.c: In function 'main':
main.c:9:20: warning: comparison between pointer and integer
    9 |     for ( j = 0 ;j < k; j++){
      |                    ^
main.c:20:3: error: expected declaration or statement at end of input
   20 |   }
      |   ^
Language: C

#include<stdio.h>

int n,size[101],t[101][101],cost[101][101],distance[101];

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]);
  }
}

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;
}

Compiler output:
main.c: In function 'main':
main.c:32:22: error: request for member 'distance' in something not a structure or union
   32 |     printf("%d%d\n",i.distance[i]);
      |                      ^
Language: C

#include<stdio.h>

#define MAX 100
#define INFTY 100000000000
#define WHITE 0
#define GAY 1
#define BLACK 2

int n,M[MAX][MAX];

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

	for(i=0;i<n;i++){
		d[i]=INFTY;
		color[i]=WHITE;
	}
	int u;
	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++){
		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%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:4:15: warning: overflow in conversion from 'long int' to 'int' changes value from '100000000000' to '1215752192' [-Woverflow]
    4 | #define INFTY 100000000000
      |               ^~~~~~~~~~~~
main.c:16:22: note: in expansion of macro 'INFTY'
   16 |                 d[i]=INFTY;
      |                      ^~~~~
main.c:17:17: error: 'color' undeclared (first use in this function); did you mean 'clor'?
   17 |                 color[i]=WHITE;
      |                 ^~~~~
      |                 clor
main.c:17:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:21:18: error: 'GRAY' undeclared (first use in this function); did you mean 'GAY'?
   21 |         color[0]=GRAY;
      |                  ^~~~
      |                  GAY
main.c:4:15: warning: overflow in conversion from 'long int' to 'int' changes value from '100000000000' to '1215752192' [-Woverflow]
    4 | #define INFTY 100000000000
      |               ^~~~~~~~~~~~
main.c:23:22: note: in expansion of macro 'INFTY'
   23 |                 minv=INFTY;
      |                      ^~~~~
main.c:33:29: error: 'V' undeclared (first use in this function)
   33 |                 for(v=0;v<n;V++){
      |                             ^
main.c: In function 'main':
main.c:59:32: error: expected expression before ']' token
   59 |                         M[i][j[]]=INFTY;
      |                                ^
Language: C

#include<stdio.h>
#define MAX 100
#define INFTY 10000000

int n,M[MAX][MAX];


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

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

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

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

kbtit();

return 0;
}

Compiler output:
main.c: In function 'main':
main.c:43:9: error: 'j' undeclared (first use in this function)
   43 |     for(j=0;j<n;j++){
      |         ^
main.c:43:9: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'kbtit':
main.c:60:1: error: expected declaration or statement at end of input
   60 | }
      | ^
Language: C

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

#define N 100001
#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);
void initializeSingleSource(int);

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;
}


void dijkstra(int edges){

  int i,flag;

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

Compiler output:
main.c: In function 'dijkstra':
main.c:48:4: error: expected declaration or statement at end of input
   48 |    d[i]=INF;
      |    ^
main.c:48:4: error: expected declaration or statement at end of input
Language: C

#include<stdio.h>

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

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

  scanf("%d",&k);

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

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

  while(1){
    int b=NIL;
    int c=MAX;
    for(i=0;i<k;i++){
      if(key[i]<max &&){
	b=i;
	min c = key[i];
      }
      if(b==NIL){
	break;
      }
    }
    for(c=0;c<k;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:6:1: error: return type defaults to 'int' [-Wimplicit-int]
    6 | main(){
      | ^~~~
main.c: In function 'main':
main.c:22:5: error: 'pi' undeclared (first use in this function); did you mean 'i'?
   22 |     pi[b]=NIL;
      |     ^~
      |     i
main.c:22:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:22:11: error: 'NIL' undeclared (first use in this function)
   22 |     pi[b]=NIL;
      |           ^~~
main.c:28:11: error: 'MAX' undeclared (first use in this function)
   28 |     int c=MAX;
      |           ^~~
main.c:30:17: error: 'max' undeclared (first use in this function)
   30 |       if(key[i]<max &&){
      |                 ^~~
main.c:30:23: error: expected expression before ')' token
   30 |       if(key[i]<max &&){
      |                       ^
main.c:32:9: error: unknown type name 'min'
   32 |         min c = key[i];
      |         ^~~
main.c:39:10: error: 'w' undeclared (first use in this function)
   39 |       if(w[b][c]<key[c]){
      |          ^
main.c:41:9: error: 'Pi' undeclared (first use in this function); did you mean 'i'?
   41 |         Pi[c]=u;
      |         ^~
      |         i
main.c:41:15: error: 'u' undeclared (first use in this function)
   41 |         Pi[c]=u;
      |               ^
main.c:48:13: error: 'n' undeclared (first use in this function)
   48 |   for(i=0;i<n;i++){
      |             ^
main.c:49:9: error: 'p' undeclared (first use in this function)
   49 |     if (p[i]!=-1)sum+=M[i][p[i]];
      |         ^
Language: C

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

int n, A[N][N];
void dijkstra();

int main(){
  int i, j, u, t, v, 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,&t);
    for(j=0; j<t; j++){
      scanf("%d%d",&v,&c);
      A[u][v] = c;
    }
  }
  dijkstra();

  return 0;
}

void dijkstra(){
  int i, u, v, m;
  int c[N], d[N];

  for(i=0; i<n; i++){
    c[i] = WHITE;
    d[i] = INF;
  }
  d[0] = 0;
  c[0] = GRAY;

  while(1){
    m = INF;
    u = -1;
    for(i=0; i<n; i++){
      if(c[i] != BLACK && d[i] < minc){
	minc = d[i];
	u = i;
      }
    }
    if(m == INF) break; 
    c[u] = BLACK;
    for(v=0; v<n; v++){
      if(c[v] != BLACK && A[u][v] != INF){
	if(d[u] + A[u][v] < d[v]){
	  d[v] = d[u] + A[u][v];
	  c[v] = GRAY;
	}
      }
    }
  }
  for(i=0; i<n; i++){
    if(d[i] == INF) {
      printf("%d -1\n", i);
    } else printf("%d %d\n",i ,d[i]);
  }
}

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

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

int n, A[N][N];
void dijkstra();

int main(){
  int i, j, u, t, v, 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,&t);
    for(j=0; j<t; j++){
      scanf("%d%d",&v,&c);
      A[u][v] = c;
    }
  }
  dijkstra();

  return 0;
}

void dijkstra(){
  int i, u, v, m;
  int c[N], d[N];

  for(i=0; i<n; i++){
    c[i] = WHITE;
    d[i] = INF;
  }
  d[0] = 0;
  c[0] = GRAY;

  while(1){
    m = INF;
    u = -1;
    for(i=0; i<n; i++){
      if(c[i] != BLACK && d[i] < m){
	minc = d[i];
	u = i;
      }
    }
    if(m == INF) break; 
    c[u] = BLACK;
    for(v=0; v<n; v++){
      if(c[v] != BLACK && A[u][v] != INF){
	if(d[u] + A[u][v] < d[v]){
	  d[v] = d[u] + A[u][v];
	  c[v] = GRAY;
	}
      }
    }
  }
  for(i=0; i<n; i++){
    if(d[i] == INF) {
      printf("%d -1\n", i);
    } else printf("%d %d\n",i ,d[i]);
  }
}

Compiler output:
main.c: In function 'dijkstra':
main.c:49:9: error: 'minc' undeclared (first use in this function)
   49 |         minc = d[i];
      |         ^~~~
main.c:49:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C

include<stdio.h>
#define INF 1000000
#define NIL -1
#define WHITE 0
#define GRAY 1
#define BLACK 2


int n;
int M[100][100];

void dkr(){
  int d[100];
  int color[100];
  int min,u;
  int i,v;

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

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

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

    if(u == NIL)break;
    color[u] = BLACK;

    for(v=0;v<n;v++){
      if(color[v] != BLACK && M[u][v] != INF){
        if(d[u] + M[u][v] < d[v]){
          d[v] = d[u] + M[u][v];
          color[v] = GRAY;
        }
      }
    }
  }

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

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


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

  dkr();

  return 0;
}

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
main.c: In function 'dkr':
main.c:18:13: error: 'n' undeclared (first use in this function)
   18 |   for(i=0;i<n;i++){
      |             ^
main.c:18:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:50:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   50 |     printf("%d %d\n",i,(d[i] == INF? -1 : 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:50:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   50 |     printf("%d %d\n",i,(d[i] == INF? -1 : d[i]));
      |     ^~~~~~
main.c:50:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: In function 'main':
main.c:59:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   59 |   scanf("%d",&n);
      |   ^~~~~
main.c:59:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:59:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
main.c:59:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:59:15: error: 'n' undeclared (first use in this function)
   59 |   scanf("%d",&n);
      |               ^
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] = INFTY;
    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]==INFTY?-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:37:15: error: 'INFTY' undeclared (first use in this function); did you mean 'INF'?
   37 |     data[c] = INFTY;
      |               ^~~~~
      |               INF
main.c:37:15: note: each undeclared identifier is reported only once for each function it appears in