Language: C

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

#define MAX_HEAP_SIZE       500001      /* 最大ヒープ領域(ヒープ配列を1オリジンで持つため500000+1) */
#define MAX_BUILDING_NUM    101         /* 最大ビル数(1オリジン) */
#define INFINITE_VAL        100000000
#define FIX                 1
#define NOT_FIX             0
#define MAX_MOVING_DISTANCE 50
#define CONNECT             1
#define NOT_CONNECT         0

int n;
int m;
int HeapSize;
int StartNode;
int GoalNode;
int HeapArray[MAX_HEAP_SIZE];
int PathBuffer[MAX_BUILDING_NUM];
struct Coordinate {
	int x;
	int y;
}cordinate[MAX_BUILDING_NUM];

struct Node {
	int ConnectNode[MAX_BUILDING_NUM];
	double ConnectCost[MAX_BUILDING_NUM];
	int NodeFromThis;
	int FixNodeFlag;
	double CostToThis;
}node[MAX_BUILDING_NUM];


void inputBuildingData(void)
{
	int i;
	int BuildingNum;
	int x;
	int y;

	scanf_s("%d", &n);
	if (n != 0) {
		for (i = 1; i <= n; i++) {
			scanf_s("%d", &BuildingNum);
			scanf_s("%d%d", &cordinate[BuildingNum].x, &cordinate[BuildingNum].y);
		}
		scanf_s("%d", &m);
	}
}

void inputDataSet(void)
{
	scanf_s("%d%d", &StartNode, &GoalNode);
}

void initVer(void)
{
	int i;
	int j;

	HeapSize = 0;
	for (i = 1; i <= n; i++) {
		for (j = 1; j <= n; j++) {
			node[i].ConnectNode[j] = NOT_CONNECT;
			node[i].ConnectNode[j] = INFINITE_VAL;
		}
		node[i].NodeFromThis = 0;
		node[i].CostToThis = INFINITE_VAL;
		node[i].FixNodeFlag = NOT_FIX;
		PathBuffer[i] = 0;
	}

}

void makeUndirectedGraph(void)
{
	int i;
	int j;
	double NodeDistance;
	double MoveDistance;
	int NodeDistance_x;
	int NodeDistance_y;

	MoveDistance = sqrt(MAX_MOVING_DISTANCE * MAX_MOVING_DISTANCE);
	for (i = 1; i <= n; i++) {
		for (j = i+1; j <= n; j++) {
			NodeDistance_x = abs(cordinate[i].x - cordinate[j].x);
			NodeDistance_y = abs(cordinate[i].y - cordinate[j].y);
			NodeDistance = sqrt(NodeDistance_x * NodeDistance_x + NodeDistance_y * NodeDistance_y);
			if (NodeDistance <= MoveDistance) {
				node[i].ConnectNode[j] = CONNECT;
				node[i].ConnectCost[j] = NodeDistance;
				node[j].ConnectNode[i] = CONNECT;
				node[j].ConnectCost[i] = NodeDistance;
			}
		}
	}
}

#if 0
/****************************************************************************/
/* 関数名   | maxHeapify                                                    */
/* 関数仕様 | Nodeを根とする部分木をmax-ヒープ木にする                      */
/****************************************************************************/
void
maxHeapify(int Node)
{
	int LeftNode;
	int RightNode;
	int SmallestNode;
	int TmpHeapVal;

	/* ヒープ配列は、Nodeの要素数をnとすると、Nodeの子の要素数は左が2n、右が2n×1 */
	LeftNode = 2 * Node;
	RightNode = LeftNode + 1;

	/* NodeとNodeの子の中で、最大値の要素数を求める */
	if ((LeftNode <= HeapSize)
		&& (node[LeftNode].CostToThis < node[Node].CostToThis))
	{
		SmallestNode = LeftNode;
	}
	else {
		SmallestNode = Node;
	}
	if ((RightNode <= HeapSize)
		&& (node[RightNode].CostToThis < node[Node].CostToThis))
	{
		SmallestNode = RightNode;
	}

	/* Nodeに対しNodeの子の方が大きい場合、NodeとNodeの子の値を入れ替える */
	if (SmallestNode != Node)
	{
		TmpHeapVal = HeapArray[Node];
		HeapArray[Node] = HeapArray[SmallestNode];
		HeapArray[SmallestNode] = TmpHeapVal;
		/* NodeとNodeの子の値を入れ替えたヒープ配列に対し、Nodeの子にmaxHeapifyを適用する */
		maxHeapify(SmallestNode);
	}
}
#endif

/****************************************************************************/
/* 関数名   | maxHeapify                                                    */
/* 関数仕様 | Nodeを根とする部分木をmax-ヒープ木にする                      */
/****************************************************************************/
void
maxHeapify(int Node)
{
	int LeftNode;
	int RightNode;
	int SmallestNode;
	int TmpHeapVal;

	/* ヒープ配列は、Nodeの要素数をnとすると、Nodeの子の要素数は左が2n、右が2n×1 */
	LeftNode = 2 * Node;
	RightNode = LeftNode + 1;

	/* NodeとNodeの子の中で、最大値の要素数を求める */
	if ((LeftNode <= HeapSize)
		&& (node[LeftNode].CostToThis < node[Node].CostToThis))
	{
		SmallestNode = LeftNode;
	}
	else {
		SmallestNode = Node;
	}
	if ((RightNode <= HeapSize)
		&& (node[RightNode].CostToThis < node[SmallestNode].CostToThis))
	{
		SmallestNode = RightNode;
	}

	/* Nodeに対しNodeの子の方が大きい場合、NodeとNodeの子の値を入れ替える */
	if (SmallestNode != Node)
	{
		TmpHeapVal = HeapArray[Node];
		HeapArray[Node] = HeapArray[SmallestNode];
		HeapArray[SmallestNode] = TmpHeapVal;
		/* NodeとNodeの子の値を入れ替えたヒープ配列に対し、Nodeの子にmaxHeapifyを適用する */
		maxHeapify(SmallestNode);
	}
}

void pushVal(int insertval) {
	int tmpNode;
	int TmpHeapVal;
	HeapSize++;
	tmpNode = HeapSize;
	HeapArray[HeapSize] = insertval;
	while (tmpNode > 1 && node[tmpNode / 2].CostToThis > node[tmpNode].CostToThis) {
		TmpHeapVal = HeapArray[tmpNode];
		HeapArray[tmpNode] = HeapArray[tmpNode / 2];
		HeapArray[tmpNode / 2] = TmpHeapVal;
		tmpNode = tmpNode / 2;
	}
}

int popVal(void) {
	int ret;

	if (HeapSize >= 1) {
		ret = HeapArray[1];
		HeapArray[1] = HeapArray[HeapSize];
		HeapSize--;
		maxHeapify(1);
	}
	return ret;
}

void findShortestPath(void)
{
	int i;
	int TmpNode;

	node[StartNode].CostToThis = 0;
	node[StartNode].NodeFromThis = StartNode;
	pushVal(StartNode);

	while (HeapSize != 0) {
		TmpNode = popVal();
		if (node[TmpNode].FixNodeFlag == NOT_FIX) {
			for (i = 1; i < MAX_BUILDING_NUM; i++) {
				if (node[TmpNode].ConnectNode[i] == CONNECT){
					pushVal(i);
					if (node[i].CostToThis > node[TmpNode].CostToThis + node[TmpNode].ConnectCost[i]) {
						node[i].CostToThis = node[TmpNode].CostToThis + node[TmpNode].ConnectCost[i];
						node[i].NodeFromThis = TmpNode;
					}
				}
			}
			node[TmpNode].FixNodeFlag = FIX;
		}
	}
}


void outputVal(void)
{
	int i;
	int nodenum;

	nodenum = 1;

	i = GoalNode;
	PathBuffer[nodenum] = i;
	nodenum++;
	do{
		i = node[i].NodeFromThis;
		PathBuffer[nodenum] = i;
		nodenum++;
	} while (i != 0 && i != StartNode);

	if (i == StartNode) {
		for (i = nodenum-1; i > 0; i--) {
			printf("%d ", PathBuffer[i]);
		}
	}
	else {
		printf("NA");
	}
	printf("\n");
}

int main(void)
{
	int i;
	do{
		/* 入力部 */
		inputBuildingData();
		if(n != 0){
			initVer();
			for (i = 1; i <= m; i++) {
				inputDataSet();
				/* 制御部 */
				makeUndirectedGraph();
				findShortestPath();

				/* 出力部 */
				outputVal();
			}
		}
	} while (n != 0);
	while (1);
}




Compiler output:
main.c: In function 'inputBuildingData':
main.c:42:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   42 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf