Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
const int INF = 1000000;
int cost[301][301],time[301][301];
void time_WF(int m){
	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]);
			}
		}
	}
	return;
}
void cost_WF(int m){
	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]);
			}
		}
	}
	return;
}
int main(){
	int n,m;
	while(cin >> n >> m,n || m){
		int a,b,icost,itime,c,r;
		for(int i = 0;i <= m;++i){
			for(int j = 0;j <= m;++j){
				if(i == j) {
					cost[i][i] = 0;
					time[i][i] = 0;
				}
				else {
					cost[i][j] = cost[j][i] = INF;
					time[i][j] = time[j][i] = INF;
				}
			}
		}
		for(int i = 0;i < n;++i){
			cin >> a >> b >> icost >> itime;
			cost[a][b] = cost[b][a] = icost;
			time[a][b] = time[b][a] = itime;
		}
		cin >> c;
		for(int i = 0;i < c;++i){
			cin >> a >> b >> r;
			if(r == 1){
				time_WF(m);
				cout << time[a][b] << endl;
			}
			else {
				cost_WF(m);
				cout << cost[a][b] << endl;
			}
		}
	}
	return 0;
}

Compiler output:
a.cc:5:33: error: 'int time [301][301]' redeclared as different kind of entity
    5 | int cost[301][301],time[301][301];
      |                                 ^
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 'void time_WF(int)':
a.cc:10:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   10 |                                 time[i][j] = min(time[i][j],time[i][k] + time[k][j]);
      |                                       ^
a.cc:10:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   10 |                                 time[i][j] = min(time[i][j],time[i][k] + time[k][j]);
      |                                          ^
a.cc:10:56: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   10 |                                 time[i][j] = min(time[i][j],time[i][k] + time[k][j]);
      |                                                        ^
a.cc:10:59: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   10 |                                 time[i][j] = min(time[i][j],time[i][k] + time[k][j]);
      |                                                           ^
a.cc:10:67: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   10 |                                 time[i][j] = min(time[i][j],time[i][k] + time[k][j]);
      |                                                                   ^
a.cc:10:70: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   10 |                                 time[i][j] = min(time[i][j],time[i][k] + time[k][j]);
      |                                                                      ^
a.cc:10:80: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   10 |                                 time[i][j] = min(time[i][j],time[i][k] + time[k][j]);
      |                                                                                ^
a.cc:10:83: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   10 |                                 time[i][j] = min(time[i][j],time[i][k] + time[k][j]);
      |                                                                                   ^
a.cc:10:72: 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+'
   10 |                                 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: In function 'int main()':
a.cc:34:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                                         time[i][i] = 0;
      |                                               ^
a.cc:34:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                                         time[i][i] = 0;
      |                                                  ^
a.cc:34:52: error: assignment of read-only location '*(time + (((sizetype)i) * 2))'
   34 |                                         time[i][i] = 0;
      |                                         ~~~~~~~~~~~^~~
a.cc:38:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   38 |                                         time[i][j] = time[j][i] = INF;
      |                                               ^
a.cc:38:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   38 |                                         time[i][j] = time[j][i] = INF;
      |                                                  ^
a.cc:38:60: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   38 |                                         time[i][j] = time[j][i] = INF;
      |                                                            ^
a.cc:38:63: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   38 |                                         time[i][j] = time[j][i] = INF;
      |                                                               ^
a.cc:38:65: error: assignment of read-only location '*(time + (((sizetype)j) + ((sizetype)i)))'
   38 |                                         time[i][j] = time[j][i] = INF;
      |                                                      ~~~~~~~~~~~^~~~~
a.cc:45:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   45 |                         time[a][b] = time[b][a] = itime;
      |                               ^
a.cc:45:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   45 |                         time[a][b] = time[b][a] = itime;
      |                                  ^
a.cc:45:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   45 |                         time[a][b] = time[b][a] = itime;
      |                                            ^
a.cc:45:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   45 |                         time[a][b] = time[b][a] = itime;
      |                                               ^
a.cc:45:49: error: assignment of read-only location '*(time + (((sizetype)b) + ((sizetype)a)))'
   45 |                         time[a][b] = time[b][a] = itime;
      |                                      ~~~~~~~~~~~^~~~~~~
a.cc:52:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   52 |                                 cout << time[a][b] << endl;
      |                                               ^
a.cc:52:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   52 |                                 cout << time[a][b] << endl;
      |                                                  ^