Language: C++

#include <iostream>
using namespace std;
#define INF 1000000
int time[110][110];
int cost[110][110];
int main()
{
    int n,m;
    while(cin>>n>>m,n){
        for(int i=0;i<m;++i){
            for(int j=0;j<m;++j){
                if(i==j){
                    time[i][j]=0;
                    cost[i][j]=0;
                }else{
                    time[i][j]=INF;
                    cost[i][j]=INF;
                }
            }
        }
        for(int i=0;i<n;++i){
            int a,b,c,t;
            cin>>a>>b>>c>>t;
            a--;b--;
            cost[a][b]=c;
            cost[b][a]=c;
            time[a][b]=t;
            time[b][a]=t;
        }
        for(int k=0;k<m;++k){
            for(int i=0;i<m;++i){
                for(int j=0;j<m;++j){
                    cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j]);
                    time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
                }
            }
        }
        int k;
        cin>>k;
        for(int i=0;i<k;++i){
            int p,q,r;
            cin>>p>>q>>r;
            p--;q--;
            if(!r)
                cout<<cost[p][q]<<endl;
            else
                cout<<time[p][q]<<endl;
        }
    }
    return 0;
}

Compiler output:
a.cc:4:18: error: 'int time [110][110]' redeclared as different kind of entity
    4 | int time[110][110];
      |                  ^
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:27: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   13 |                     time[i][j]=0;
      |                           ^
a.cc:13:30: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   13 |                     time[i][j]=0;
      |                              ^
a.cc:13:31: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
   13 |                     time[i][j]=0;
      |                     ~~~~~~~~~~^~
a.cc:16:27: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   16 |                     time[i][j]=INF;
      |                           ^
a.cc:16:30: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   16 |                     time[i][j]=INF;
      |                              ^
a.cc:16:31: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
   16 |                     time[i][j]=INF;
      |                               ^
a.cc:27:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   27 |             time[a][b]=t;
      |                   ^
a.cc:27:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   27 |             time[a][b]=t;
      |                      ^
a.cc:27:23: error: assignment of read-only location '*(time + (((sizetype)a) + ((sizetype)b)))'
   27 |             time[a][b]=t;
      |             ~~~~~~~~~~^~
a.cc:28:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   28 |             time[b][a]=t;
      |                   ^
a.cc:28:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   28 |             time[b][a]=t;
      |                      ^
a.cc:28:23: error: assignment of read-only location '*(time + (((sizetype)b) + ((sizetype)a)))'
   28 |             time[b][a]=t;
      |             ~~~~~~~~~~^~
a.cc:34:27: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                     time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                           ^
a.cc:34:30: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                     time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                              ^
a.cc:34:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                     time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                                          ^
a.cc:34:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                     time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                                             ^
a.cc:34:53: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                     time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                                                     ^
a.cc:34:56: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                     time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                                                        ^
a.cc:34:64: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                     time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                                                                ^
a.cc:34:67: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                     time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                                                                   ^
a.cc:34:57: 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+'
   34 |                     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:47:29: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   47 |                 cout<<time[p][q]<<endl;
      |                             ^
a.cc:47:32: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   47 |                 cout<<time[p][q]<<endl;
      |                                ^