Language: C++

#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;
int n,m,K;
int cost[100][100],time[100][100];
int main()
{
    while(cin>>n>>m&&(n||m)){
		fill(cost[0],cost[100],1000000);
		fill(time[0],time[100],1000000);
		for(int i=0;i<n;i++){
			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;
		}
		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]);
				}
		cin>>K;
		while(K--){
			int p,q,r;
			cin>>p>>q>>r;p--;q--;
			if(r==0)cout<<cost[p][q]<<endl;
			else cout<<time[p][q]<<endl;
		}
	}
    return 0;
}

Compiler output:
a.cc:10:33: error: 'int time [100][100]' redeclared as different kind of entity
   10 | int cost[100][100],time[100][100];
      |                                 ^
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:15:28: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   15 |                 fill(time[0],time[100],1000000);
      |                            ^
a.cc:15:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   15 |                 fill(time[0],time[100],1000000);
      |                                      ^
a.cc:19:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   19 |                         time[a][b]=time[b][a]=t;
      |                               ^
a.cc:19:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   19 |                         time[a][b]=time[b][a]=t;
      |                                  ^
a.cc:19:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   19 |                         time[a][b]=time[b][a]=t;
      |                                          ^
a.cc:19:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   19 |                         time[a][b]=time[b][a]=t;
      |                                             ^
a.cc:19:46: error: assignment of read-only location '*(time + (((sizetype)b) + ((sizetype)a)))'
   19 |                         time[a][b]=time[b][a]=t;
      |                                    ~~~~~~~~~~^~
a.cc:25:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   25 |                                         time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                                               ^
a.cc:25:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   25 |                                         time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                                                  ^
a.cc:25:62: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   25 |                                         time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                                                              ^
a.cc:25:65: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   25 |                                         time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                                                                 ^
a.cc:25:73: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   25 |                                         time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                                                                         ^
a.cc:25:76: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   25 |                                         time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                                                                            ^
a.cc:25:84: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   25 |                                         time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                                                                                    ^
a.cc:25:87: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   25 |                                         time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |                                                                                       ^
a.cc:25:77: 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+'
   25 |                                         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:32:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   32 |                         else cout<<time[p][q]<<endl;
      |                                          ^
a.cc:32:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   32 |                         else cout<<time[p][q]<<endl;
      |                                             ^
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long int (*)(long int*) noexcept; _Tp = int; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]':
/usr/include/c++/14/bits/stl_algobase.h:998:21:   required from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = long int (*)(long int*) noexcept; _Tp = int]'
  998 |     { std::__fill_a1(__first, __last, __value); }
      |       ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1029:20:   required from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long int (*)(long int*) noexcept; _Tp = int]'
 1029 |       std::__fill_a(__first, __last, __value);
      |       ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:15:7:   required from here
   15 |                 fill(time[0],time[100],1000000);
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:952:18: error: assignment of read-only location '* __first'
  952 |         *__first = __tmp;
      |         ~~~~~~~~~^~~~~~~