Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
const int INF = 1000000;
int cost[301][301],time[301][301];
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] = INF;
					time[i][j] = 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 d = 0;d < c;++d){
			cin >> a >> b >> r;
			for(int k = 0;k <= m;++k){
				for(int i = 0;i <= m;++i){
					for(int j = 0;j <= m;++j){
						if(r == 1) time[i][j] = min(time[i][j],time[i][k] + time[k][j]);
						else cost[i][j] = min(cost[i][j],cost[i][k] + cost[k][j]);
					}
				}
			}
			if(r == 1) cout << time[a][b] << endl;
			else 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 'int main()':
a.cc:14:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   14 |                                         time[i][i] = 0;
      |                                               ^
a.cc:14:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   14 |                                         time[i][i] = 0;
      |                                                  ^
a.cc:14:52: error: assignment of read-only location '*(time + (((sizetype)i) * 2))'
   14 |                                         time[i][i] = 0;
      |                                         ~~~~~~~~~~~^~~
a.cc:18:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   18 |                                         time[i][j] = INF;
      |                                               ^
a.cc:18:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   18 |                                         time[i][j] = INF;
      |                                                  ^
a.cc:18:52: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
   18 |                                         time[i][j] = INF;
      |                                         ~~~~~~~~~~~^~~~~
a.cc:25:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   25 |                         time[a][b] = time[b][a] = itime;
      |                               ^
a.cc:25:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   25 |                         time[a][b] = time[b][a] = itime;
      |                                  ^
a.cc:25:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   25 |                         time[a][b] = time[b][a] = itime;
      |                                            ^
a.cc:25:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   25 |                         time[a][b] = time[b][a] = itime;
      |                                               ^
a.cc:25:49: error: assignment of read-only location '*(time + (((sizetype)b) + ((sizetype)a)))'
   25 |                         time[a][b] = time[b][a] = itime;
      |                                      ~~~~~~~~~~~^~~~~~~
a.cc:33:66: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   33 |                                                 if(r == 1) time[i][j] = min(time[i][j],time[i][k] + time[k][j]);
      |                                                                  ^
a.cc:33:69: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   33 |                                                 if(r == 1) time[i][j] = min(time[i][j],time[i][k] + time[k][j]);
      |                                                                     ^
a.cc:33:83: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   33 |                                                 if(r == 1) time[i][j] = min(time[i][j],time[i][k] + time[k][j]);
      |                                                                                   ^
a.cc:33:86: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   33 |                                                 if(r == 1) time[i][j] = min(time[i][j],time[i][k] + time[k][j]);
      |                                                                                      ^
a.cc:33:94: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   33 |                                                 if(r == 1) time[i][j] = min(time[i][j],time[i][k] + time[k][j]);
      |                                                                                              ^
a.cc:33:97: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   33 |                                                 if(r == 1) time[i][j] = min(time[i][j],time[i][k] + time[k][j]);
      |                                                                                                 ^
a.cc:33:107: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   33 |                                                 if(r == 1) time[i][j] = min(time[i][j],time[i][k] + time[k][j]);
      |                                                                                                           ^
a.cc:33:110: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   33 |                                                 if(r == 1) time[i][j] = min(time[i][j],time[i][k] + time[k][j]);
      |                                                                                                              ^
a.cc:33:99: 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+'
   33 |                                                 if(r == 1) 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:38:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   38 |                         if(r == 1) cout << time[a][b] << endl;
      |                                                  ^
a.cc:38:53: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   38 |                         if(r == 1) cout << time[a][b] << endl;
      |                                                     ^