Language: C++

#include<iostream>
#include<algorithm>

using namespace std;
int time[3001][3001];
int cost[3001][3001];


int main(){
	
	int i,j,k,a,b,t,c;
	int rail, station;
	int q,start,goal,dotti;
	int temp;
	
	


	while (1){
		
		cin >> rail >> station;
		
		if (rail == 0 && station == 0){
			break;
		}


		for (i = 0; i < station+1; i++){
			for (j = 0; j < station+1; j++){
				time[i][j] = 1000000;
				cost[i][j] = 1000000;
			}
		}

		for (i = 0; i < rail; i++){
			cin >> a >> b >> c >> t;
			time[a][b] = t;
			time[b][a] = t;
			cost[a][b] = c;
			cost[b][a] = c;
		}


		cin >> q;

		for (;q>0;q--){
			cin >> start >> goal >> dotti;

			for (k = 1; k <= station; k++){
				for (i = 1; i <= station; i++){
					for (j = 1; j <= station; j++){
						cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
					}
				}
			}

			for (k = 1; k <= station; k++){
				for (i = 1; i <= station; i++){
					for (j = 1; j <= station; j++){
						time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
					}
				}
			}


			if (dotti == 0){
				cout << cost[start][goal] << endl;
			}

			if (dotti == 1){
				cout << time[start][goal] << endl;
			}


		}
	


	}



}

Compiler output:
a.cc:5:20: error: 'int time [3001][3001]' redeclared as different kind of entity
    5 | int time[3001][3001];
      |                    ^
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:30:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   30 |                                 time[i][j] = 1000000;
      |                                       ^
a.cc:30:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   30 |                                 time[i][j] = 1000000;
      |                                          ^
a.cc:30:44: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
   30 |                                 time[i][j] = 1000000;
      |                                 ~~~~~~~~~~~^~~~~~~~~
a.cc:37:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   37 |                         time[a][b] = t;
      |                               ^
a.cc:37:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   37 |                         time[a][b] = t;
      |                                  ^
a.cc:37:36: error: assignment of read-only location '*(time + (((sizetype)a) + ((sizetype)b)))'
   37 |                         time[a][b] = t;
      |                         ~~~~~~~~~~~^~~
a.cc:38:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   38 |                         time[b][a] = t;
      |                               ^
a.cc:38:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   38 |                         time[b][a] = t;
      |                                  ^
a.cc:38:36: error: assignment of read-only location '*(time + (((sizetype)b) + ((sizetype)a)))'
   38 |                         time[b][a] = t;
      |                         ~~~~~~~~~~~^~~
a.cc:60:55: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   60 |                                                 time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
      |                                                       ^
a.cc:60:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   60 |                                                 time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
      |                                                          ^
a.cc:60:72: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   60 |                                                 time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
      |                                                                        ^
a.cc:60:75: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   60 |                                                 time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
      |                                                                           ^
a.cc:60:84: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   60 |                                                 time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
      |                                                                                    ^
a.cc:60:87: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   60 |                                                 time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
      |                                                                                       ^
a.cc:60:97: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   60 |                                                 time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
      |                                                                                                 ^
a.cc:60:100: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   60 |                                                 time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
      |                                                                                                    ^
a.cc:60:89: 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+'
   60 |                                                 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:71:51: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   71 |                                 cout << time[start][goal] << endl;
      |                                                   ^
a.cc:71:57: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   71 |                                 cout << time[start][goal] << endl;
      |                                                         ^