Language: C

#include <stdio.h>

struct road{
  int from;
  int to;
  int distance;
};

int calc_shortestDistance(int, int, int, int, struct *road, int);

int main(void)
{
  int n;
  int a, b, c;
  struct road[45];
  int city_size;
  int max_distance;
  int min_amount, amount;
  int min_city;
  int i, j;

  while(true){
    scanf("%d", n);
    if(n==0) break;

    city_size=0;
    max_distance=0;
    for(i=0; i<n; i++){
      scanf("%d %d %d", &a, &b, &c);
      road[i].from=a;
      road[i].to=b;
      road[i].distance=c;
      if(a<b && b>=city_size) city_size=b+1;
      else if(a>b && a>=city_size) city_size=a+1;
      if(max_distance>c) max_distance=c;
    }

    min_amount=city_size*(max_distance*n+1);
    for(i=0; i<city_size; i++){
      amount=0;
      for(j=0; j<city_size; j++){
	if(i==j) continue;
	amount+=calc_shortestDistance(i, j, city_size, n, road, max_distance);
      }
      if(min_amount>amount){
	min_amount=amount;
	min_city=i;
      }
    }
    printf("%d %d\n", min_city, min_amount);
  }
  return 0;
}

int calc_shortestDistance(int from, int to, int city_size, int road_size, struct *road, int max_distance)
{
  int d[10];
  int is_searched[10]; //0:is not searched, 1:is searched.
  int min_d, min_city;
  int i;

  for(i=0; i<city_size; i++) is_searched[i]=0;
  for(i=0; i<city_size; i++) d[i]=max_distance*n+1;
  d[from]=0;

  while(true){
    min_d=max_distance*n+1;
    for(i=0; i<city_size; i++){
      if(!is_searched[i] && d[i]<min_d){
	min_d=d[i];
	min_city=i;
      }
    }
    if(min_city==to) break;

    for(i=0; i<n; i++){
      if(road[i].from==min_city){
	if(d[road[i].to]>min_d+road[i].distance) d[road[i].to]=min_d+road[i].distance;
      }
      else if(road[i].to==min_city){
	if(d[road[i].from]>min_d+road[i].distance) d[road[i].from]=min_d+road[i].distance;
      }
    }
    is_searched[min_city]=1;
  }

  return d[to];
}

Compiler output:
main.c:9:54: error: expected '{' before '*' token
    9 | int calc_shortestDistance(int, int, int, int, struct *road, int);
      |                                                      ^
main.c:55:82: error: expected '{' before '*' token
   55 | int calc_shortestDistance(int from, int to, int city_size, int road_size, struct *road, int max_distance)
      |                                                                                  ^
main.c: In function 'calc_shortestDistance':
main.c:63:30: error: 'd' undeclared (first use in this function)
   63 |   for(i=0; i<city_size; i++) d[i]=max_distance*n+1;
      |                              ^
main.c:63:30: note: each undeclared identifier is reported only once for each function it appears in
main.c:63:48: error: 'n' undeclared (first use in this function)
   63 |   for(i=0; i<city_size; i++) d[i]=max_distance*n+1;
      |                                                ^
main.c:66:9: error: 'true' undeclared (first use in this function)
   66 |   while(true){
      |         ^~~~
main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include <stdio.h>
  +++ |+#include <stdbool.h>
    2 | 
main.c:77:17: error: request for member 'from' in something not a structure or union
   77 |       if(road[i].from==min_city){
      |                 ^
main.c:78:21: error: request for member 'to' in something not a structure or union
   78 |         if(d[road[i].to]>min_d+road[i].distance) d[road[i].to]=min_d+road[i].distance;
      |                     ^
main.c:78:39: error: request for member 'distance' in something not a structure or union
   78 |         if(d[road[i].to]>min_d+road[i].distance) d[road[i].to]=min_d+road[i].distance;
      |                                       ^
main.c:78:59: error: request for member 'to' in something not a structure or union
   78 |         if(d[road[i].to]>min_d+road[i].distance) d[road[i].to]=min_d+road[i].distance;
      |                                                           ^
main.c:78:77: error: request for member 'distance' in something not a structure or union
   78 |         if(d[road[i].to]>min_d+road[i].distance) d[road[i].to]=min_d+road[i].distance;
      |                                                                             ^
main.c:80:22: error: request for member 'to' in something not a structure or union
   80 |       else if(road[i].to==min_city){
      |                      ^
main.c:81:21: error: request for member 'from' in something not a structure or union
   81 |         if(d[road[i].from]>min_d+road[i].distance) d[road[i].from]=min_d+road[i].distance;
      |                     ^
main.c:81:41: error: request for member 'distance' in something not a structure or union
   81 |         if(d[road[i].from]>min_d+road[i].distance) d[road[i].from]=min_d+road[i].distance;
      |                                         ^
main.c:81:61: error: request for member 'from' in something not a structure or union
   81 |         if(d[road[i].from]>min_d+road[i].distance) d[road[i].from]=min_d+road[i].distance;
      |                                                             ^
main.c:81:81: error: request for member 'distance' in something not a structure or union
   81 |         if(d[road[i].from]>min_d+road[i].distance) d[road[i].from]=min_d+road[i].distance;
      |                                                                                 ^