Language: C++

#include <iostream>

#define N 101
#define INF 1e+9

using namespace std;

int cost[N][N],time[N][N];

int main(void){
	int n,m;
	while(cin>>n>>m,n||m){
		for(int i=0;i<n;++i)for(int j=0;j<n;++j){cost[i][j]=time[i][j]=INF;}
		for(int i=0,a,b,c,t;i<n;++i){
			cin>>a>>b>>c>>t;
			cost[a][b]=cost[b][a]=c;
			time[a][b]=time[b][a]=t;
		}
		int k;cin>>k;
		for(int i=0,p,q,r;i<k;++i){
			cin>>p>>q>>r;
			if(r){//time
				int d[N];
				for(int j=0;j<n;++j) d[j]=INF;
				d[p]=0;
				bool f=false;
				for(;;){
					for(int j=0;j<n;++j){//from
						for(int k=0;k<n;++k){//to
							if(d[j]!=INF && d[j] + time[j][k] < d[k]){
								f==true;
								d[k] = d[j] + time[j][k];
							}
						}
					}
					if(f==false) break;
					f=false;
				}
				cout<<d[q]<<endl;
			}else{//cost
				int d[N];
				for(int j=0;j<n;++j) d[j]=INF;
				d[p]=0;
				bool f=false;
				for(;;){
					for(int j=0;j<n;++j){//from
						for(int k=0;k<n;++k){//to
							if(d[j]!=INF && d[j] + cost[j][k] < d[k]){
								f==true;
								d[k] = d[j] + cost[j][k];
							}
						}
					}
					if(f==false) break;
					f=false;
				}
				cout<<d[q]<<endl;
			}
		}
	}
	return 0;
}

Compiler output:
a.cc:8:25: error: 'int time [101][101]' redeclared as different kind of entity
    8 | int cost[N][N],time[N][N];
      |                         ^
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:13:75: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   13 |                 for(int i=0;i<n;++i)for(int j=0;j<n;++j){cost[i][j]=time[i][j]=INF;}
      |                                                                           ^
a.cc:13:78: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   13 |                 for(int i=0;i<n;++i)for(int j=0;j<n;++j){cost[i][j]=time[i][j]=INF;}
      |                                                                              ^
a.cc:13:79: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
   13 |                 for(int i=0;i<n;++i)for(int j=0;j<n;++j){cost[i][j]=time[i][j]=INF;}
      |                                                                               ^
a.cc:17:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   17 |                         time[a][b]=time[b][a]=t;
      |                               ^
a.cc:17:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   17 |                         time[a][b]=time[b][a]=t;
      |                                  ^
a.cc:17:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   17 |                         time[a][b]=time[b][a]=t;
      |                                          ^
a.cc:17:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   17 |                         time[a][b]=time[b][a]=t;
      |                                             ^
a.cc:17:46: error: assignment of read-only location '*(time + (((sizetype)b) + ((sizetype)a)))'
   17 |                         time[a][b]=time[b][a]=t;
      |                                    ~~~~~~~~~~^~
a.cc:30:86: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   30 |                                                         if(d[j]!=INF && d[j] + time[j][k] < d[k]){
      |                                                                                      ^
a.cc:30:89: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   30 |                                                         if(d[j]!=INF && d[j] + time[j][k] < d[k]){
      |                                                                                         ^
a.cc:30:78: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   30 |                                                         if(d[j]!=INF && d[j] + time[j][k] < d[k]){
      |                                                                         ~~~~~^~~~~~~~~~~~
a.cc:30:91: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   30 |                                                         if(d[j]!=INF && d[j] + time[j][k] < d[k]){
      |                                                                         ~~~~~~~~~~~~~~~~~~^~~~~~
a.cc:32:85: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   32 |                                                                 d[k] = d[j] + time[j][k];
      |                                                                                     ^
a.cc:32:88: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   32 |                                                                 d[k] = d[j] + time[j][k];
      |                                                                                        ^
a.cc:32:77: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   32 |                                                                 d[k] = d[j] + time[j][k];
      |                                                                        ~~~~~^~~~~~~~~~~~
a.cc:32:77: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
   32 |                                                                 d[k] = d[j] + time[j][k];
      |                                                                        ~~~~~^~~~~~~~~~~~
      |                                                                             |
      |                                                                             time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}