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){
                int a;
                i==j?a=0:a=INF;
                time[i][j]=a;
                cost[i][j]=a;
            }
        }
        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:14:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   14 |                 time[i][j]=a;
      |                       ^
a.cc:14:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   14 |                 time[i][j]=a;
      |                          ^
a.cc:14:27: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
   14 |                 time[i][j]=a;
      |                 ~~~~~~~~~~^~
a.cc:24:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   24 |             time[a][b]=t;
      |                   ^
a.cc:24:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   24 |             time[a][b]=t;
      |                      ^
a.cc:24:23: error: assignment of read-only location '*(time + (((sizetype)a) + ((sizetype)b)))'
   24 |             time[a][b]=t;
      |             ~~~~~~~~~~^~
a.cc:25:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   25 |             time[b][a]=t;
      |                   ^
a.cc:25:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   25 |             time[b][a]=t;
      |                      ^
a.cc:25:23: error: assignment of read-only location '*(time + (((sizetype)b) + ((sizetype)a)))'
   25 |             time[b][a]=t;
      |             ~~~~~~~~~~^~
a.cc:31:27: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   31 |                     time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                           ^
a.cc:31:30: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   31 |                     time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                              ^
a.cc:31:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   31 |                     time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                                          ^
a.cc:31:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   31 |                     time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                                             ^
a.cc:31:53: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   31 |                     time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                                                     ^
a.cc:31:56: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   31 |                     time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                                                        ^
a.cc:31:64: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   31 |                     time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                                                                ^
a.cc:31:67: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   31 |                     time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                                                                   ^
a.cc:31: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+'
   31 |                     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:44:29: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   44 |                 cout<<time[p][q]<<endl;
      |                             ^
a.cc:44:32: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   44 |                 cout<<time[p][q]<<endl;
      |                                ^