Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <functional>
using namespace std;

int n, m;
int k;
int cost[100][100];
int time[100][100];

int main()
{
	memset(cost, 0x0f, sizeof cost);
	memset(time, 0x0f, sizeof time);

	cin >> n >> m;
	for (int i = 0; i < n; ++i)
	{
		int a, b, cost_, time_;
		cin >> a >> b >> cost_ >> time_;

		cost[a - 1][b - 1] = cost_;
		cost[b - 1][a - 1] = cost_;

		time[a - 1][b - 1] = time_;
		time[b - 1][a - 1] = time_;
	}

	for (int k = 0; k < m; ++k)
	{
		for (int i = 0; i < m; ++i)
		{
			for (int j = 0; j < m; ++j)
			{
				cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
			}
		}
	}
	for (int k = 0; k < m; ++k)
	{
		for (int i = 0; i < m; ++i)
		{
			for (int j = 0; j < m; ++j)
			{
				time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
			}
		}
	}

	cin >> k;
	for (int i = 0; i < k; ++i)
	{
		int p, q, r;
		cin >> q >> p >> r;
		if (r == 0)
		{
			cout << cost[q - 1][p - 1] << endl;
		}
		else
		{
			cout << time[q - 1][p - 1] << endl;
		}
	}
}

Compiler output:
a.cc:10:18: error: 'int time [100][100]' redeclared as different kind of entity
   10 | int time[100][100];
      |                  ^
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'int main()':
a.cc:14:9: error: 'memset' was not declared in this scope
   14 |         memset(cost, 0x0f, sizeof cost);
      |         ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <functional>
  +++ |+#include <cstring>
    5 | using namespace std;
a.cc:15:35: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive]
   15 |         memset(time, 0x0f, sizeof time);
      |                                   ^~~~
a.cc:26:27: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   26 |                 time[a - 1][b - 1] = time_;
      |                           ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:26:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   26 |                 time[a - 1][b - 1] = time_;
      |                                  ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:26:36: error: assignment of read-only location '*(time + ((((sizetype)a) + ((sizetype)b)) + 18446744073709551614))'
   26 |                 time[a - 1][b - 1] = time_;
      |                 ~~~~~~~~~~~~~~~~~~~^~~~~~~
a.cc:27:27: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   27 |                 time[b - 1][a - 1] = time_;
      |                           ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:27:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   27 |                 time[b - 1][a - 1] = time_;
      |                                  ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:27:36: error: assignment of read-only location '*(time + ((((sizetype)b) + ((sizetype)a)) + 18446744073709551614))'
   27 |                 time[b - 1][a - 1] = time_;
      |                 ~~~~~~~~~~~~~~~~~~~^~~~~~~
a.cc:46:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   46 |                                 time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
      |                                       ^
a.cc:46:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   46 |                                 time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
      |                                          ^
a.cc:46:56: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   46 |                                 time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
      |                                                        ^
a.cc:46:59: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   46 |                                 time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
      |                                                           ^
a.cc:46:68: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   46 |                                 time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
      |                                                                    ^
a.cc:46:71: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   46 |                                 time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
      |                                                                       ^
a.cc:46:81: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   46 |                                 time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
      |                                                                                 ^
a.cc:46:84: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   46 |                                 time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
      |                                                                                    ^
a.cc:46:73: error: invalid operands of types 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'} to binary 'operator+'
   46 |                                 time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
      |                                                              ~~~~~~~~~~ ^ ~~~~~~~~~~
      |                                                                       |            |
      |                                                                       |            time_t(time_t*) noexcept {aka long int(long int*) noexcept}
      |                                                                       time_t(time_t*) noexcept {aka long int(long int*) noexcept}
a.cc:62:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   62 |                         cout << time[q - 1][p - 1] << endl;
      |                                           ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:62:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   62 |                         cout << time[q - 1][p - 1] << endl;
      |                                                  ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]