Language: C++

#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;
const int INF = (1<<30);
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){//graph info
			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){//question
			int p,q,r;
			cin>>p>>q>>r;
			dij(p,q,r);
		}
	}
}

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