Language: C++

#include<math.h>
#include<iostream>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define INF (1<<30)

using namespace std;

int cost[200][200], time[200][200],dist[200];
int x[200][200];
bool vis[200];
int M,N;

void dij(int p, int q, int r){
	int i,j,k,l,m,n,mn;
	rep(i,M)rep(j,M)x[i][j]= ((r==0)?(cost[i][j]):(time[i][j]));
	rep(i,M)vis[i]=false,dist[i]=INF;
	dist[p-1]=0;
	for(;;){
		k=-1,mn=INF;
		rep(i,M)if(!vis[i]&&dist[i]<mn){mn=dist[i],k=i;}
		if(k==-1 || mn>=INF) break;
		if(k==q-1)break;
		vis[k]=true;
		rep(i,M)if(!vis[i])dist[i]=min(dist[i],dist[k]+x[k][i]);
	}
	cout<<dist[q-1]<<endl;
}

int main(){
	int i,j,k,l,m,n;
	
	while(cin>>N>>M){
		if((N|M)==0) break;

		rep(i,M){
			dist[i]=INF; 
		    rep(j,M){
			  if(i==j) {cost[i][j]=time[i][j]=0; continue;}
			  cost[i][j]=time[i][j]=INF;
			}
		}
		rep(i,N){
			int a,b,c,t;
			cin>>a>>b>>c>>t;
			a--; b--;
			cost[a][b]=cost[b][a]=c; time[a][b]=time[b][a]=t;
		}
		cin>>k;
		rep(i,k){
			int p,q,r;
			cin>>p>>q>>r;
			dij(p,q,r);
		}
	}
}

Compiler output:
a.cc:9:34: error: 'int time [200][200]' redeclared as different kind of entity
    9 | int cost[200][200], time[200][200],dist[200];
      |                                  ^
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:2:
/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 dij(int, int, int)':
a.cc:16:62: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   16 |         rep(i,M)rep(j,M)x[i][j]= ((r==0)?(cost[i][j]):(time[i][j]));
      |                                                              ^
a.cc:16:65: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   16 |         rep(i,M)rep(j,M)x[i][j]= ((r==0)?(cost[i][j]):(time[i][j]));
      |                                                                 ^
a.cc:16:41: error: operands to '?:' have different types 'int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'}
   16 |         rep(i,M)rep(j,M)x[i][j]= ((r==0)?(cost[i][j]):(time[i][j]));
      |                                   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:39:54: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   39 |                           if(i==j) {cost[i][j]=time[i][j]=0; continue;}
      |                                                      ^
a.cc:39:57: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   39 |                           if(i==j) {cost[i][j]=time[i][j]=0; continue;}
      |                                                         ^
a.cc:39:58: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
   39 |                           if(i==j) {cost[i][j]=time[i][j]=0; continue;}
      |                                                ~~~~~~~~~~^~
a.cc:40:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   40 |                           cost[i][j]=time[i][j]=INF;
      |                                            ^
a.cc:40:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   40 |                           cost[i][j]=time[i][j]=INF;
      |                                               ^
a.cc:40:48: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
   40 |                           cost[i][j]=time[i][j]=INF;
      |                                                ^
a.cc:47:56: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   47 |                         cost[a][b]=cost[b][a]=c; time[a][b]=time[b][a]=t;
      |                                                        ^
a.cc:47:59: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   47 |                         cost[a][b]=cost[b][a]=c; time[a][b]=time[b][a]=t;
      |                                                           ^
a.cc:47:67: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   47 |                         cost[a][b]=cost[b][a]=c; time[a][b]=time[b][a]=t;
      |                                                                   ^
a.cc:47:70: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   47 |                         cost[a][b]=cost[b][a]=c; time[a][b]=time[b][a]=t;
      |                                                                      ^
a.cc:47:71: error: assignment of read-only location '*(time + (((sizetype)b) + ((sizetype)a)))'
   47 |                         cost[a][b]=cost[b][a]=c; time[a][b]=time[b][a]=t;
      |                                                             ~~~~~~~~~~^~