Language: C++

#include <iostream>
#include <cstring>
using namespace std;

const int INF = 1000000;
const int MAX_V = 101;

int cost[MAX_V][MAX_V];
int time[MAX_V][MAX_V];
int d[MAX_V];
bool used[MAX_V];
int V;

int n,m;

void dijkstra(int s,bool r){
    fill(d,d+m,INF);
    memset(used,false,sizeof(used));
    d[s]=0;
    while(1){
        int v=-1;
        for(int u=0;u<m;u++){
            if(used[u]) continue;
            if(v==-1||d[u]<d[v]){
                v=u;
            }
        }
        if(v==-1) break;
        used[v]=true;
        for(int u=0;u<m;u++){
            int c;
            if(r) c=cost[u][v];
            else c=time[u][v];
            d[u]=min(d[u],d[v]+c);
        }
    }
}
int main(){
    while(cin >> n >> m,n+m){
        for(int i=0;i<m+1; i++){
            for(int j=0; j<m; j++){
                cost[i][j]=INF;
                time[i][j]=INF;
            }
        }
        for (int i = 0; i < m+1; ++i) {
            cost[i][i]=0;
            time[i][i]=0;
        }
        for (int i = 0; i < n; ++i) {
            int to,from,c,t;
            cin >> to>>from>>c>>t;
            to--; from--;
            cost[to][from]=c;
            cost[from][to]=c;
            time[to][from]=t;
            time[from][to]=t;
        }
        int k; cin>>k;
        for (int i = 0; i < k; ++i) {
            int p,q,r;
            cin>>p>>q>>r;
            p--; q--;
            dijkstra(p,!r);
            cout<<d[q]<<endl;
        }
    }
}

Compiler output:
a.cc:9:22: error: 'int time [101][101]' redeclared as different kind of entity
    9 | int time[MAX_V][MAX_V];
      |                      ^
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 dijkstra(int, bool)':
a.cc:33:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   33 |             else c=time[u][v];
      |                          ^
a.cc:33:29: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   33 |             else c=time[u][v];
      |                             ^
a.cc:33:29: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
   33 |             else c=time[u][v];
      |                    ~~~~~~~~~^
      |                             |
      |                             time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc: In function 'int main()':
a.cc:43:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   43 |                 time[i][j]=INF;
      |                       ^
a.cc:43:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   43 |                 time[i][j]=INF;
      |                          ^
a.cc:43:27: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
   43 |                 time[i][j]=INF;
      |                 ~~~~~~~~~~^~~~
a.cc:48:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   48 |             time[i][i]=0;
      |                   ^
a.cc:48:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   48 |             time[i][i]=0;
      |                      ^
a.cc:48:23: error: assignment of read-only location '*(time + (((sizetype)i) * 2))'
   48 |             time[i][i]=0;
      |             ~~~~~~~~~~^~
a.cc:56:20: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   56 |             time[to][from]=t;
      |                    ^
a.cc:56:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   56 |             time[to][from]=t;
      |                          ^
a.cc:56:27: error: assignment of read-only location '*(time + (((sizetype)to) + ((sizetype)from)))'
   56 |             time[to][from]=t;
      |             ~~~~~~~~~~~~~~^~
a.cc:57:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   57 |             time[from][to]=t;
      |                      ^
a.cc:57:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   57 |             time[from][to]=t;
      |                          ^
a.cc:57:27: error: assignment of read-only location '*(time + (((sizetype)from) + ((sizetype)to)))'
   57 |             time[from][to]=t;
      |             ~~~~~~~~~~~~~~^~