criyle/codenet-compile-errors huggingface dataset:
Language: C

#include<iostream>
#include<vector>
#include<map>
#include<queue>
#include<functional>
#define pb push_back
#define MAX_V 2000//場合によって変更
#define INF 1000000000
using namespace std;
typedef pair<int,int> P;//firstは最短距離,secondは頂点番号
struct edge{
	int to,cost;
};
int V;//頂点の数
vector<vector<edge> > G;
//-----------
vector<vector<edge> > G2;
//-----------
int dijkstra(int s,int g){
	priority_queue<P,vector<P> , greater<P> > que;
	vector<int> d(V,INF);
	d[s]=0;
	que.push(P(0,0));
	while(!que.empty()){
		P p=que.top();
		que.pop();
		int v=p.second;
		if(d[v]<p.first)
			continue;
		for(int i=0;i<G[v].size();i++){
			edge e=G[v][i];
			if(d[e.to]>d[v]+e.cost){
				d[e.to]=d[v]+e.cost;
				que.push(P(d[e.to],e.to));
			}
		}
	}
	
	return d[g];
}
//-----------
int dijkstra2(int s,int g){
	priority_queue<P,vector<P> , greater<P> > que;
	vector<int> d(V,INF);
	d[s]=0;
	que.push(P(0,0));
	while(!que.empty()){
		P p=que.top();
		que.pop();
		int v=p.second;
		if(d[v]<p.first)
			continue;
		for(int i=0;i<G2[v].size();i++){
			edge e=G2[v][i];
			if(d[e.to]>d[v]+e.cost){
				d[e.to]=d[v]+e.cost;
				que.push(P(d[e.to],e.to));
			}
		}
	}
	
	return d[g];
}
//--------------
int main(){
	int E;
	while(cin>>E>>V,E){
		G.clear();
		G.resize(V);
		//------------
		G2.clear();
		G2.resize(V);
		//---------------
		for(int i=0;i<E;i++){
			int x,y,c,t;
			cin>>x>>y>>c>>t;x--;y--;
			edge e;
			e.cost=c;
			e.to=y;
			G[x].pb(e);
			e.to=x;
			G[y].pb(e);
			//--------------
			e.cost=t;
			e.to=y;
			G2[x].pb(e);
			e.to=x;
			G2[y].pb(e);
			//---------------
		}
		int n;
		cin>>n;
		for(int i=0;i<n;i++){
			int s,t,q;
			cin>>s>>t>>q;
			if(q==0)
			cout<<dijkstra(s-1,t-1)<<endl;
			else
			cout<<dijkstra2(s-1,t-1)<<endl;
		}
	}
	
	return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>


int min(int a,int b){
  if(a > b)return b;
  return a;
}

int main(){
  int i,j,l,n,m,x,y,cost,time,p,q,r,k,matrix1[300][300],matrix2[300][300];
  while(1){
    scanf("%d %d",&n,&m);
    if(n+m == 0)break;
    
    for(i=0;i<m+2;i++){
      for(j=0;j<m+2;j++){
	matrix2[i][j] 100000000;
	matrix1[i][j] = 1000000;
      }
    }
    for(i=0;i<n;i++){
      scanf("%d %d %d %d",&x,&y,&cost,&time);
      matrix1[x][y] = cost; 
      matrix1[y][x] = cost;
      matrix2[y][x] = time;
      matrix2[x][y] = time;
    }
    for(k=1;k<=n;k++){
      for(i=1;i<=n;i++){
	for(j=1;j<=n;j++){
	  matrix1[i][j] = min(matrix1[i][j],matrix1[i][k]+matrix1[k][j]);
	  matrix2[i][j] = min(matrix2[i][j],matrix2[i][k]+matrix2[k][j]);

	}
      }
    }


   
    scanf("%d",&l);
    for(i=0;i<l;i++){
     
      scanf("%d %d %d",&p,&q,&r);
      if(r == 0){
	printf("%d\n",matrix1[p][q]);
      }
      else{
	printf("%d\n",matrix2[p][q]);
      }

    }

  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:22: error: expected ';' before numeric constant
   17 |         matrix2[i][j] 100000000;
      |                      ^~~~~~~~~~
      |                      ;
Language: C

#include <stdio.h>

#define MAX 1000000000
#define min(x,y) ((x)<(y)?(x):(y))

int cost[101];
int check[101];
int route[101][101];
int n,m;

 
void dijkstra(int start, int route[101][101]) {
    int i,j,k;
 
    for (i = 1; i < m + 1; i++) {
    cost[i] = MAX;
    check[i] = 0;
    }
    cost[start] =0;
    
    while (1) {
    k=-1;
	for (j=1;j<m+1;j++) {
        if (check[j] == 0 && (k == -1 || cost[j] < cost[k]))
        k = j;
    }
    if (k == -1)
        break;
        
    check[k] = 1;
 
    for (j=1;j< m + 1;j++) {
        cost[j] = min(cost[j], cost[k] + route[k][j]);
    }
    }
}
 
int main(void) {
    int l, o, count,a, b, cro, tro;;
    int result;
    int croute[101][101];
    int troute[101][101];
 
    while (scanf("%d%d", &n, &m)) {

	if(n+m==0) break;

	for (l = 0; l < 101; l++) {
        for (o = 0; o < 101; o++) {
        croute[l][o] = l == o ? 0 : MAX;
        troute[l][o] = l == o ? 0 : MAX;
        }
    }
    while (n > 0) {
        scanf("%d%d%d%d", &a, &b, &c, &t);
        croute[a][b] = croute[b][a] = cro;
        troute[a][b] = troute[b][a] = tro;
        n--;
    }
    
    scanf("%d", &count);

	while (count > 0) {
        int p, q, r;
        scanf("%d%d%d", &p, &q, &r);
        dijkstra(p, r == 0 ? croute : troute);
        result = cost[q];
        printf("%d\n", result);
        count--;
    }
    }
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:55:36: error: 'c' undeclared (first use in this function)
   55 |         scanf("%d%d%d%d", &a, &b, &c, &t);
      |                                    ^
main.c:55:36: note: each undeclared identifier is reported only once for each function it appears in
main.c:55:40: error: 't' undeclared (first use in this function)
   55 |         scanf("%d%d%d%d", &a, &b, &c, &t);
      |                                        ^
Language: C

#include <stdio.h>
#include <algorithm>

using namespace std;
int cost[101][101][2];
int d[101];   //始点固定は最初
bool used[101];
int n,m;    //mは頂点数


void dijkstra(int s,int r){
	for(int j=0;j<m;j++){
	d[j]=1000000;
	used[j]=false;
	}


    d[s]=0;
	while(true){
		int v=-1;
		for(int u=0; u<m;u++){
			if(!used[u] && (v == -1 || d[u] < d[v]))
				 v=u;
		}
		
		if(v == -1)
			break;
		used[v] = true;
		for ( int u =0; u < m; u++){
			d[u] = min(d[u], d[v] + cost[v][u][r]);
		}
	
		for(int i=0;i<5;i++){
			printf("%d ",d[i]);
		}
		printf("\n");
	}
}

int main(void){
	for(;;){
		int a,b,time,cos;
    	scanf("%d %d",&n,&m);
	if(!(n|m))
		break;
		for(int i=0;i<m;i++){
				for(int j=0;j<m;j++){
    						cost[i][j][0]=1000000;
							cost[i][j][1]=1000000;
				}
		}
    	for(int i=0;i<n;i++){
    		scanf("%d %d %d %d",&a,&b,&cos,&time);
			a--; b--;
			cost[a][b][0]=cos;
			cost[b][a][0]=cos;
			cost[a][b][1]=time;
			cost[b][a][1]=time;
		}
		
		int p,q,r;
		scanf("%d",&n);
		for(int i=0;i<n;i++){
		scanf("%d %d %d",&p,&q,&r);
		p--;q--;
		dijkstra(p,r);
		printf("%d\n",d[q]);
		}
	}

	return 0;
}

Compiler output:
main.c:2:10: fatal error: algorithm: No such file or directory
    2 | #include <algorithm>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C

#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_N 100
#define MAX_M 3000

#define SWAP(type, a, b) do {type _tmp; _tmp = a; a = b; b = _tmp;} while(0)

typedef struct {
	int v;
	int dist;
} state;

bool greater(state a, state b) {
	return a.dist > b.dist;
}

// priority_queue
typedef state value_type;

typedef struct skew_heap{
	struct skew_heap *left, *right;
	value_type value;
} skew_heap;

void swap(skew_heap *a, skew_heap *b) {
	skew_heap *tmp = a;
	a = b;
	b = tmp;
}

skew_heap *meld(skew_heap *a, skew_heap *b) {
	if(a == NULL) return b;
	if(b == NULL) return a;
	if(greater(a->value, b->value)) SWAP(skew_heap *, a, b);
	a->right = meld(a->right, b);
	SWAP(skew_heap *, a->left, a->right);
}

skew_heap *root;

bool empty() {
	return root == NULL;
}

void enqueue(value_type value) {
	skew_heap *new_node = malloc(sizeof(skew_heap));
	new_node->left = NULL;
	new_node->right = NULL;
	new_node->value = value;
	root = meld(root, new_node);
}

value_type dequeue() {
	if(root == NULL) return (value_type){-1, -1};
	value_type res = root->value;
	skew_heap *tmp = meld(root->left, root->right);
	free(root);
	root = tmp;
	return res;
}

// graph
int n, m;
int num;
int head[MAX_N], next[MAX_M * 2], to[MAX_M * 2];
int cost[MAX_M * 2], time[MAX_M * 2];
int dist[MAX_N];

void add_edge(int u, int v, int c, int t) {
	next[num] = head[u];
	head[u] = num;
	to[num] = v;
	cost[num] = c;
	time[num] = t;
	++num;
}

// calc weight
int dijkstra(int start, int goal, int r) {
	int i, e;
	const int *weight = (r ? time : cost);

	for(i = 0; i < n; ++i) dist[i] = INT_MAX;
	enqueue((state){start, 0});
	dist[start] = 0;

	while(!empty()) {
		state current = dequeue();
		if(dist[current.v] < current.dist)
			continue;

		for(e = head[current.v]; e != -1; e = next[e]) {
			int next_dist = current.dist + weight[e];
			if(dist[to[e]] > next_dist) {
				dist[to[e]] = next_dist;
				enqueue((state){to[e], next_dist});
			}
		}
	}

	assert(dist[goal] != INT_MAX);
	return dist[goal];
}

int main(void) {
	int i;
	while(scanf("%d %d", &m, &n) == 2 && n) {
		num = 0;
		memset(head, -1, sizeof(head));

		for(i = 0; i < m; ++i) {
			int u, v, c, t;
			scanf("%d %d %d %d", &u, &v, &c, &t);
			--u; --v;
			add_edge(u, v, c, t);
			add_edge(v, u, c, t);
		}

		int query;
		scanf("%d", &query);

		while(query--) {
			int start, goal, r;
			scanf("%d %d %d", &start, &goal, &r);
			printf("%d\n", dijkstra(start - 1, goal - 1, r));
		}
	}
	return EXIT_SUCCESS;
}

Compiler output:
main.c: In function 'dijkstra':
main.c:105:9: error: implicit declaration of function 'assert' [-Wimplicit-function-declaration]
  105 |         assert(dist[goal] != INT_MAX);
      |         ^~~~~~
main.c:6:1: note: 'assert' is defined in header '<assert.h>'; this is probably fixable by adding '#include <assert.h>'
    5 | #include <string.h>
  +++ |+#include <assert.h>
    6 |
Language: C++

import sys
import heapq as h

inf = sys.maxsize

# おまじない
class heapq:
    def __init__(self):
        self.q = []

    def push(self,v):
        h.heappush(self.q, v)
    
    def pop(self):
        return h.heappop(self.q)

    def is_empty(self):
        return len(self.q) == 0

# 入力:graphと始点s
# 出力:始点sから各頂点tへの距離dist
def shortestPath0(graph, s):
    n = len(graph)

    dist    = [inf for _ in range(n)]
    visited = [False for _ in range(n)]
    dist[s] = 0

    while True:
        idx, u  = -1, inf
        for i in range(n):
            if not visited[i] and dist[i] < u:
                idx = i
                u = dist[i]
        
        if u == inf: break
        
        visited[idx] = True

        for (next, w) in graph[idx]:
            newdist = w + dist[idx]
            if newdist < dist[next]:
                dist[next] = newdist
    return dist

def shortestPath1(graph, s):
    n = len(graph)

    dist    = [inf for _ in range(n)]
    visited = [False for _ in range(n)]
    
    q = heapq()
    q.push((0, s))

    while not q.is_empty():
        (cur_dist, v) = q.pop()

        if visited[v] or dist[v] <= cur_dist:
            continue

        dist[v] = cur_dist
        visited[v] = True

        for next, w in graph[v]:
            if not visited[next] and dist[v] + w < dist[next]:
                q.push((dist[v] + w, next))

    return dist

def main():
    while True:
        n, m = map(int, input().split())
        if n == 0 and m == 0:
            break
        # 隣接リスト
        tgraph = [[] for _ in range(m)]
        cgraph = [[] for _ in range(m)]
        
        for i in range(n):
            a, b, cost, time = map(int, input().split())
            a -= 1
            b -= 1
            cgraph[a].append((b, cost))
            cgraph[b].append((b, cost))
            tgraph[a].append((b, time))
            tgraph[b].append((b, time))
            
        c_dist = [shortestPath1(cgraph, s) for s in range(m)]
        t_dist = [shortestPath1(tgraph, s) for s in range(m)]

        k = int(input())
        for i in range(k):
            p, q, r = map(int, input().split())
            p-=1
            q-=1
            if r == 0:
                print(c_dist[p][q])
            else:
                print(t_dist[p][q])
main()

Compiler output:
a.cc:6:3: error: invalid preprocessing directive #\U0000304a\U0000307e\U00003058\U0000306a\U00003044
    6 | # おまじない
      |   ^~~~~~~~~~
a.cc:20:3: error: invalid preprocessing directive #\U00005165\U0000529b
   20 | # 入力:graphと始点s
      |   ^~~~
a.cc:21:3: error: invalid preprocessing directive #\U000051fa\U0000529b
   21 | # 出力:始点sから各頂点tへの距離dist
      |   ^~~~
a.cc:75:11: error: invalid preprocessing directive #\U000096a3\U000063a5\U000030ea\U000030b9\U000030c8
   75 |         # 隣接リスト
      |           ^~~~~~~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#define _CRT_SECURE_NO_WARNINGS

#include<fstream>
#include<iostream>
#include<string>
#include<iomanip>
#include<list>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

short cost[3000][3000];
short time_data[3000][3000];


short main(){
	short n, m;


	while (cin >> n >> m && (n != 0 && m != 0)) {
		short min_ = 2000; // 答えの最小値
		short min_num = 1; // 答えの町

		short from, to, time_, cost_;
		short k;
		short k_from, k_to, info;

		for (short i = 0; i < 3000; i++) {
			for (short j = 0; j < 3000; j++) {
				cost[i][j] = 2000;
				time_data[i][j] = 2000;
			}
		}
		for (short i = 0; i < 3000; i++) {
			cost[i][i] = 0;
		}
		for (short i = 0; i < n; i++) {
			cin >> from >> to >> cost_ >> time_;
			cost[from][to] = cost_;
			cost[to][from] = cost_;
			time_data[from][to] = time_;
			time_data[to][from] = time_;
		}
		for (short k = 1; k <= m; k++) {
			for (short i = 1; i <= m; i++) {
				for (short j = 1; j <= m; j++) {
					cost[i][j] = min((int)cost[i][j], cost[i][k] + cost[k][j]);

					time_data[i][j] = min((int)time_data[i][j], time_data[i][k] + time_data[k][j]);
				}
			}
		}
		// 答えを求める
		cin >> k;
		for (short i = 0; i < k; i++) {
			cin >> k_from >> k_to >> info;
			if (info == 0) {
				cout << cost[k_from][k_to] << endl;
			} else {
				cout << time_data[k_from][k_to] << endl;
			}
		}
		
  }
	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <algorithm>
#define MAX_M 100
#define INF (1<<21)
using namespace std;

int dp_cost[MAX_M][MAX_M];
int dp_time[MAX_M][MAX_M];
int m;

void warshall_froyd(){
  for(int k=0;k<m;k++){
    for(int i=0;i<m;i++){
      for(int j=0;j<m;j++){
        dp_cost[i][j] = min(dp_cost[i][j], dp_cost[i][k] + dp_cost[k][j]);
        dp_time[i][j] = min(dp_time[i][j], dp_time[i][k] + dp_time[k][j]);
      }
    }
  }
}

int main(){
  int n;
  cin >> n >> m;
  for(int i=0;i<m;i++){
    for(int j=0;j<m;j++){
      dp_time[i][j] = (i==j ? 0 : INF);
      dp_cost[i][j] = (i==j ? 0 : INF);
    }
  }

  for(int i=0;i<n;i++){
    int a,b,cost,time;
    cin >> a >> b >> cost >> time;
    a--;
    b--;
    dp_cost[a][b] = cost; dp_cost[b][a] = cost;
    dp_time[a][b] = time; dp_time[b][a] = time;
  }
  
  warshall_froyd();

  int k,p,q,r;
  cin >> k;
  for(int i=0;i<k;i++){
    cin >> p >> q >> r;
    p--; q--;
    cout << (r == 0 ? dp_cost[p][q] : dp_time[p][q]) << endl;
  }
  cin >> p >> q;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:3: error: 'cin' was not declared in this scope
   23 |   cin >> n >> m;
      |   ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <algorithm>
  +++ |+#include <iostream>
    2 | #define MAX_M 100
a.cc:47:5: error: 'cout' was not declared in this scope
   47 |     cout << (r == 0 ? dp_cost[p][q] : dp_time[p][q]) << endl;
      |     ^~~~
a.cc:47:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:47:57: error: 'endl' was not declared in this scope
   47 |     cout << (r == 0 ? dp_cost[p][q] : dp_time[p][q]) << endl;
      |                                                         ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <algorithm>
  +++ |+#include <ostream>
    2 | #define MAX_M 100
Language: C++

6 5
1 2 200 10
1 4 400 15
1 3 250 25
2 4 100 10
4 5 150 20
3 5 300 20
2
1 5 0
1 5 1
0 0

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 6 5
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <iterator>
using namespace std;

struct AboutTo;

class Node{
public:
	int aa;
	int Lowest;
	bool IsSelected;
	vector<AboutTo> ToCollection;
	Node(){
		Lowest = 2147483647/2;
		IsSelected = false;
	}
	void Reset(){
		Lowest = 2147483647/2;
		IsSelected = false;
	}
};
struct AboutTo{
	Node* To;
	int Cost;
	int Time;
};

int GetShortest(int a,Node GoalNode, int b, vector<Node> &aNodeCol, const int IsTime){
	aNodeCol[a].IsSelected = true;
	int TempMin = 2147483647/2;
	int aNode;
	Node fad;
	for (unsigned int i = 0; i < aNodeCol.size(); ++i){
		if (aNodeCol[i].IsSelected){
			for (unsigned int j = 0; j < aNodeCol[i].ToCollection.size(); ++j){
				if (!(*(aNodeCol[i].ToCollection[j].To)).IsSelected){
					if (IsTime){
						if (TempMin>aNodeCol[i].Lowest + aNodeCol[i].ToCollection[j].Time){
							TempMin = aNodeCol[i].Lowest + aNodeCol[i].ToCollection[j].Time;
							aNode = (*(aNodeCol[i].ToCollection[j].To)).aa;
							fad = *aNodeCol[i].ToCollection[j].To;
						}
					}
					else{
						if (TempMin>aNodeCol[i].Lowest + aNodeCol[i].ToCollection[j].Cost){
							TempMin = aNodeCol[i].Lowest + aNodeCol[i].ToCollection[j].Cost;
							aNode = (*(aNodeCol[i].ToCollection[j].To)).aa;
							fad = *aNodeCol[i].ToCollection[j].To;
						}
					}
				}
			}
		}
	}
	if (b != aNode){
		aNodeCol[aNode].Lowest = TempMin;
		return GetShortest(aNode,GoalNode, b, aNodeCol, IsTime);
	}
	/*if (GoalNode != aNode){
		aNodeCol[aNode].Lowest = TempMin;
		return GetShortest(aNode, GoalNode, b, aNodeCol, IsTime);
	}*/
	return TempMin;
}

int main(){
	int n, m;
	cin >> n >> m;
	vector<Node> NodeCollection;
	for (int i = 0; i < m; ++i){
		Node aNode;
		aNode.aa = i;
		NodeCollection.push_back(aNode);
	}

	for (int i = 0; i < n; ++i){
		int a, b, cost, time;
		cin >> a >> b >> cost >> time;
		NodeCollection[a - 1].ToCollection.push_back({ &NodeCollection[b - 1], cost, time });
		NodeCollection[b - 1].ToCollection.push_back({ &NodeCollection[a - 1], cost, time });
	}
	int k;
	cin >> k;
	for (int i = 0; i < k; ++i){
		int p, q, r;
		cin >> p >> q >> r;
		NodeCollection[p - 1].Lowest = 0;
		cout << GetShortest(p - 1, q - 1, NodeCollection, r) << endl;
		for (auto i = NodeCollection.begin(); i != NodeCollection.end(); ++i){
			(*i).Reset();
		}
	}
	cin >> k >> k;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:91:46: error: could not convert '(q - 1)' from 'int' to 'Node'
   91 |                 cout << GetShortest(p - 1, q - 1, NodeCollection, r) << endl;
      |                                            ~~^~~
      |                                              |
      |                                              int
Language: C++

// 0200.cpp : テ」ツδ。テ」ツつ、テ」ツδウ テ」ツδ療」ツδュテ」ツつクテ」ツつァテ」ツつッテ」ツδ?テ」ツδ陛」ツつ。テ」ツつ、テ」ツδォテ」ツ?ァテ」ツ?凖」ツ??

#include "stdafx.h"
#include <iostream>
#include <cstring>

using namespace std;

const int INF=100000;
int cost[101][101];
int tim[101][101];

int main(void){
	int n,m,a,b,c;
	while(1){
		for(a=0;a<=100;a++){
			for(b=0;b<=100;b++){
				cost[a][b]=INF;
				tim[a][b]=INF;
				if(a==b)cost[a][b]=0,tim[a][b]=0;
			}
		}
		cin >> n >> m;
		if(n==0 && m==0)break;
		for(a=0;a<n;a++){
			int f,t,co,ti;
			scanf("%d%d%d%d",&f,&t,&co,&ti);
			if(cost[f][t]>co)cost[f][t]=co,cost[t][f]=co;
			if(tim[f][t]>ti)tim[f][t]=ti,tim[t][f]=ti;
		}
		for(c=1;c<=m;c++){
			for(b=1;b<=m;b++){
				for(a=1;a<=m;a++){
					cost[a][b]=min(cost[a][b],cost[a][c]+cost[c][b]);
					tim[a][b]=min(tim[a][b],tim[a][c]+tim[c][b]);
				}
			}
		}
		cin >> n;
		for(a=0;a<n;a++){
			int d,f,t;
			scanf("%d%d%d",&f,&t,&d);
			if(d==0)printf("%d\n",cost[f][t]);
			if(d==1)printf("%d\n",tim[f][t]);
		}
	}
    return 0;
}

Compiler output:
a.cc:3:10: fatal error: stdafx.h: No such file or directory
    3 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)

template<typename T>
void remove(vector<T>& vector, unsigned int index){
vector.erase(vector.begin() + index);
}

typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){
	int n, m;
	while(cin >> n >> m, n||m){
		int cost[120][120];
		int timm[120][120];
		rep(i,m)rep(j,m){
			cost[i][j] = 1e9;
			timm[i][j] = 1e9;
		}
		for(int i = 0; i < n; i++){
			int a, b,c,t;
			cin >> a >> b >> c >> t;
			cost[a][b] = c;
			cost[b][a] = c;
			timm[a][b] = t;
			timm[b][a] = t;
		}
		for(int k=0;k<n;++k)for(int i=0;i<n;++i)for(int j=0;j<n;++j){
			cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
			timm[i][j] = min(timm[i][j], timm[i][k] + timm[k][j])
		}
		int k;
		cin >> k;
		rep(i, k){
			int a, b, c;
			cin >> a >> b >> c;
			if(!c)
				cout << cost[a][b] << endl;
			else
				cout << timm[a][b] << endl;
		}
	}

	return 0;
}



int StrToInt(string s){
	stringstream ss;
	ss << s;
	int val;
	ss >> val;
	return val;
}
string IntToStr(int i){
	stringstream ss;
	ss << i;
	return ss.str();
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:78: error: expected ';' before '}' token
   54 |                         timm[i][j] = min(timm[i][j], timm[i][k] + timm[k][j])
      |                                                                              ^
      |                                                                              ;
   55 |                 }
      |                 ~
Language: C++

#include<iostream>
#include<set>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define INF 1e6
using namespace std;
int n,m,k,a,b,c,d,p,q,r;
int cost[101][101],tm[101][101],d[101];
bool used[101];

void dfunc(int s,int r){
	d[s]=0;
	rep(i,101){
		used[i]=true;
		d[i]=INF;
	}
	while(1){
		int mem=INF,now=-1;
		rep(i,101){
			if(used[i] && mem>d[i]){
				now=i;
				mem=d[i];
			}
		}
		if(now==-1)break;
		used[now]=false;
		rep(i,101){
			if(r==0){
				if(cost[now][i]!=INF)d[i]=d[now]+cost[now][i];
			}else{
				if(tm[now][i]!=INF)d[i]=d[now]+tm[now][i];
			}
		}
	}
}

int main(){
	while(cin>>n>>m,n||m){
		rep(i,101)rep(j,101){
			cost[i][j]=INF;
			tm[i][j]=INF;
		}
		rep(i,n){
			cin>>a>>b>>c>>d;
			a--;
			b--;
			cost[b][a]=cost[a][b]=c;
			tm[b][a]=tm[a][b]=d;
		}
		cin>>k;
		rep(i,k){
			cin>>p>>q>>r;
			dfunc(p,r);
			cout<<d[q]<<endl;
		}
	}
	return 0;
}

Compiler output:
a.cc:8:33: error: conflicting declaration 'int d [101]'
    8 | int cost[101][101],tm[101][101],d[101];
      |                                 ^
a.cc:7:17: note: previous declaration as 'int d'
    7 | int n,m,k,a,b,c,d,p,q,r;
      |                 ^
a.cc: In function 'void dfunc(int, int)':
a.cc:12:10: error: invalid types 'int[int]' for array subscript
   12 |         d[s]=0;
      |          ^
a.cc:15:18: error: invalid types 'int[int]' for array subscript
   15 |                 d[i]=INF;
      |                  ^
a.cc:20:44: error: invalid types 'int[int]' for array subscript
   20 |                         if(used[i] && mem>d[i]){
      |                                            ^
a.cc:22:38: error: invalid types 'int[int]' for array subscript
   22 |                                 mem=d[i];
      |                                      ^
a.cc:29:55: error: invalid types 'int[int]' for array subscript
   29 |                                 if(cost[now][i]!=INF)d[i]=d[now]+cost[now][i];
      |                                                       ^
a.cc:29:60: error: invalid types 'int[int]' for array subscript
   29 |                                 if(cost[now][i]!=INF)d[i]=d[now]+cost[now][i];
      |                                                            ^
a.cc:31:53: error: invalid types 'int[int]' for array subscript
   31 |                                 if(tm[now][i]!=INF)d[i]=d[now]+tm[now][i];
      |                                                     ^
a.cc:31:58: error: invalid types 'int[int]' for array subscript
   31 |                                 if(tm[now][i]!=INF)d[i]=d[now]+tm[now][i];
      |                                                          ^
a.cc: In function 'int main()':
a.cc:54:32: error: invalid types 'int[int]' for array subscript
   54 |                         cout<<d[q]<<endl;
      |                                ^
Language: C++

#include<iostream>
#include<algorithm>
#define MAX 1000000
using namespace std;
int main(){
	int n, m, a, b, cost, ti, k, p, q, r, point = 0;
	int cost_[101][101], time_[101][101], k_[101];
	for (int i = 0; i < 101; i++){
		for (int l = 0; l < 101; l++){
			cost_[i][l] = MAX;
			ti_[i][l] = MAX;
		}
	}
	cin >> n >> m;
	while (n != 0 && m != 0){
		for (int i = 0; i < n; i++){
			cin >> a >> b >> cost >> ti;
			cost_[a][b] = cost;
			ti_[a][b] = time;
		}
		cin >> k;
		for (int i = 0; i < k; i++){
			cin >> p >> q >> r;
			k_[point] = p;
			k_[point + 1] = q;
			k_[point + 2] = r;
			point += 3;
		}point = 0;
		for (int i = 1; i <= m; i++){
			for (int j = 1; j <= m; j++){
				for (int o = 1; o <= m; o++){
					if (cost_[j][i] != MAX && cost_[i][o] != MAX &&
						ti_[j][i] != MAX && ti_[i][o] != MAX){
						cost_[j][o] = min(cost_[j][o], cost_[j][i] + cost_[i][o]);
						ti_[j][o] = min(ti_[j][o], ti_[j][i] + ti_[i][o]);
					}
				}
			}
		}
		for (int i = 0; i < k; i++){
			if (k_[point + 2] == 0){
				cout << cost_[k_[point]][k_[point + 1]] << endl;
			}
			else cout << time_[k_[point]][k_[point + 1]] << endl;
			point += 3;
		}
		cin >> n >> m;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:25: error: 'ti_' was not declared in this scope; did you mean 'ti'?
   11 |                         ti_[i][l] = MAX;
      |                         ^~~
      |                         ti
a.cc:19:25: error: 'ti_' was not declared in this scope; did you mean 'ti'?
   19 |                         ti_[a][b] = time;
      |                         ^~~
      |                         ti
a.cc:33:49: error: 'ti_' was not declared in this scope; did you mean 'ti'?
   33 |                                                 ti_[j][i] != MAX && ti_[i][o] != MAX){
      |                                                 ^~~
      |                                                 ti
Language: C++

#include <list>
#include <queue>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#define INF (1LL << 60)
using namespace std;
bool used[100]; long long dist[100];
void dijkstra(int V, int E, int s, vector<pair<int, long long> > X[]) {
	priority_queue<pair<long long, int>, vector<pair<long long, int> >, greater<pair<long long, int> > > Q;
	for (int i = 0; i < V; i++) dist[i] = INF, used[i] = false;
	dist[s] = 0; Q.push(make_pair(0, s));
	int cnt = 0;
	while (!Q.empty()) {
		if (cnt > E) return; // NEGATIVE_CYCLE
		pair<long long, int> p = Q.top(); used[p.second] = true; Q.pop();
		for (int i = 0; i < X[p.second].size(); i++) {
			int to = X[p.second][i].first; long long leng = X[p.second][i].second;
			if (dist[to] > dist[p.second] + leng && !used[to]) {
				dist[to] = dist[p.second] + leng;
				Q.push(make_pair(dist[to], to));
			}
		}
	}
}
int n, m, q, a, b, c, u, v, w1, w2; vector<pair<int, long long> > G1[100], G2[100];
int main() {
	while(cin >> n >> m, n) {
		for(int i = 0; i < m; i++) G1[i].clear(), G2[i].clear();
		for(int i = 0; i < n; i++) {
			cin >> u >> v >> w1 >> w2;
			G1[u].push_back(make_pair(v, w1));
			G1[v].push_back(make_pair(u, w1));
			G2[u].push_back(make_pair(v, w2));
			G2[v].push_back(make_pair(u, w2));
		}
		cin >> q;
		for(int i = 0; i < q; i++) {
			cin >> a >> b >> c;
			if(c == 0) {
				dijksrta(m, n, a, G1);
				cout << dist[b] << endl;
			}
			else {
				dijkstra(m, n, a, G2);
				cout << dist[b] << endl;
			}
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:33: error: 'dijksrta' was not declared in this scope; did you mean 'dijkstra'?
   42 |                                 dijksrta(m, n, a, G1);
      |                                 ^~~~~~~~
      |                                 dijkstra
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int > P;
const int INF = 1 << 30;
int Dijkstra(int s,int g,int r);

int m,n;

int min_cost[2][111];

typedef struct{
  vector<int>edge_to;
  vector<int>edge_cost[2];
}Node_data;

Node_data Graph[111];

priority_queue<P ,vector< P >, greater< P > >que;

int main(){
  int a,b,c,d,k;
  int s,g,r;
  while(1){
    cin >> m >> n;
    if(m == 0 && n == 0)break;
    for(int i = 0;i < m;i++){
      scanf("%d %d %d %d",&a,&b,&c,&d);
      Graph[a - 1].edge_to.push_back(b - 1);
      Graph[a - 1].edge_cost[0].push_back(c);
      Graph[a - 1].edge_cost[1].push_back(d);
      Graph[b - 1].edge_to.push_back(a - 1);
      Graph[b - 1].edge_cost[0].push_back(c);
      Graph[b - 1].edge_cost[1].push_back(d);
    }
    cin >> k;
    for(int i = 0;i < k;i++){

      cin >> s >> g >> r;

      for(int j = 0;j < n;j++){
	min_cost[r][j] = INF;
      }
      cout << Dijkstra(s - 1,g - 1,r) << endl;
    }
  }
  return(0);
}

int Dijkstra(int s,int g,int r){
  int node,cost;
  int newnode,newcost;
  min_cost[r][s] = 0;
  P a;
  a.first = 0;
  a.second = s;
  que.push(a);
  while(!que.empty()){
    node = que.top().second;
    cost = que.top().first;
    que.pop();
    if(node == g)return cost;
    if(cost > min_cost[r][node])continue;
    for(int i = 0;i < Graph[node].edge_to.size();i++){
      newnode = Graph[node].edge_to[i];
      newcost = min_cost[node] + Graph[node].edge_cost[r][i];
      if(min_cost[r][newnode] > newcost){
	min_cost[r][newnode] = newcost;
	a.first = newcost;
	a.second = newnode;
	que.push(a);
      }
    }
  }
  return -1;
}

Compiler output:
a.cc: In function 'int Dijkstra(int, int, int)':
a.cc:65:32: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   65 |       newcost = min_cost[node] + Graph[node].edge_cost[r][i];
Language: C++

#include<iostream>
using namespace std;
#include<algorithm>
#include<string>
#define REP(i,a) for(int  i=0;i<a;i++)
int A[101][101];
int B[101][101];
int main(){
	int a,b=0,c=0,d,n,m;	
	cin>>n>>m;
	while(n!=0||m!=0){
	REP(i,m){
		REP(j,m){
			A[i][j]=1001;
			B[i][j]=1001;
		}
	}
	REP(i,n){
	cin>>a>>b>>c>>d;
	A[a-1][b-1]=c;
	B[a-1][b-1]=d;	
	A[b-1][a-1]=c;
	B[b-1][a-1]=d;
	}
	REP(k,m){
		REP(i,m){
		if(i==j) continue;
	 		REP(j,m){
		A[i][j]=min(A[i][j],A[i][k]+A[k][j]);
		B[i][j]=min(B[i][j],B[i][k]+B[k][j]);
		A[j][i]=A[i][j];
		B[j][i]=B[i][j];
			}
		}	
	}
	cin>>n;
	REP(i,n){
	cin>>a>>b>>c;
	if(c==0) cout<<A[a-1][b-1]<<endl;
	else cout<<B[a-1][b-1]<<endl;
	}
	cin>>n>>m;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:23: error: 'j' was not declared in this scope
   27 |                 if(i==j) continue;
      |                       ^
Language: C++

#include<iostream>
using namespace std;
#include<algorithm>
#include<string>
#define REP(i,a) for(int  i=0;i<a;i++)
int A[101][101];
int B[101][101];
int main(){
	int a,b=0,c=0,d,n,m;	
	cin>>n>>m;
	while(n!=0||m!=0){
	REP(i,m){
		REP(j,m){
			A[i][j]=1001;
			B[i][j]=1001;
		}
	}
	REP(i,n){
	cin>>a>>b>>c>>d;
	A[a-1][b-1]=c;
	B[a-1][b-1]=d;	
	A[b-1][a-1]=c;
	B[b-1][a-1]=d;
	}
	REP(k,m){
		REP(i,m){
		if(i==k) continue;
	 		REP(k,m){
		A[i][j]=min(A[i][j],A[i][k]+A[k][j]);
		B[i][j]=min(B[i][j],B[i][k]+B[k][j]);
		A[j][i]=A[i][j];
		B[j][i]=B[i][j];
			}
		}	
	}
	cin>>n;
	REP(i,n){
	cin>>a>>b>>c;
	if(c==0) cout<<A[a-1][b-1]<<endl;
	else cout<<B[a-1][b-1]<<endl;
	}
	cin>>n>>m;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:22: error: 'j' was not declared in this scope
   29 |                 A[i][j]=min(A[i][j],A[i][k]+A[k][j]);
      |                      ^
Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
#define M 1000000000
using namespace std;
void Warshall_Floyd();
void GYORETU();
int cc[1001][1001],ti[1001][1001];
int n,m,a,b,cost,time,;
int main(void)
{
	while(1) {
		scanf("%d %d",&n,&m);
		if(n==0&&m==0) break;
		GYORETU();
		Warshall_Floyd();
		int s,g,w,kk;
		scanf("%d",&kk);
		for(int i=0;i<kk;i++) {
			scanf("%d %d %d",&s,&g,&w);
			if(w==0) printf("%d\n",cc[s-1][g-1]);
			else printf("%d\n",ti[s-1][g-1]);
		}
	}
}
void GYORETU()
{
	for(int i=0;i<m;i++) {
		for(int j=0;j<m;j++) {
			cc[i][j]=M;
			ti[i][j]=M;
		}
	}
	for(int i=0;i<m;i++) {
		cc[i][i]=0;
		ti[i][i]=0;
	}
	for(int i=0;i<n;i++) {
		scanf("%d %d %d %d",&a,&b,&cost,&time);
		cc[a][b]=cost;
		cc[b][a]=cost;
		ti[a][b]=time;
		ti[b][a]=time;
	}
}
void Warshall_Floyd()
{
	for(int k=0;k<m;k++) {
		for(int i=0;i<m;i++) {
			for(int j=0;j<m;j++) {
				cc[i][j]=min(cc[i][j],cc[i][k]+cc[k][j]);
			}
		}
	}
	for(int k=0;k<m;k++) {
		for(int i=0;i<m;i++) {
			for(int j=0;j<m;j++) {
				ti[i][j]=min(ti[i][j],ti[i][k]+ti[k][j]);
			}
		}
	}
}
		
	

Compiler output:
a.cc:10:23: error: expected unqualified-id before ';' token
   10 | int n,m,a,b,cost,time,;
      |                       ^
Language: C++

#include<iostream>
#include<vector>
#include<string>
#define int long long
using namespace std;

signed main() {
	int a, b;
	while (cin >>b>>a, a | b) {
		vector<vector<int>>cost(a, vector<int>(a, INT_MAX));
		vector<vector<int>>time(a, vector<int>(a, INT_MAX));
		for (int c = 0; c < b; c++) {
			int d, e, f, g;
			cin >> d >> e >> f >> g;
			d--; e--;
			cost[d][e] = cost[e][d] = f;
			time[d][e] = time[e][d] = g;
		}
		for (auto j : cost) {
			for (int i : j)cout << i << " ";
			cout << endl;
		}
		for (int h = 0; h < a; h++) {
			for (int i = 0; i < a; i++) {
				for (int j = 0; j < a; j++) {
					if (i == j)cost[i][j] = time[i][j] = 0;
					else {
						cost[i][j] = (cost[i][j] < cost[i][h] + cost[h][j]) ? (cost[i][j]) : (cost[i][h] + cost[h][j]);
						time[i][j] = (time[i][j] < time[i][h] + time[h][j]) ? (time[i][j]) : (time[i][h] + time[h][j]);
					}
				}
			}
		}
		for (auto j : cost) {
			for (int i : j)cout << i << " ";
			cout << endl;
		}
		int l;
		cin >> l;
		for (int r = 0; r < l; r++) {
			int x, y, z;
			cin >> x >> y >> z;
			x--; y--;
			if (z) { cout << time[x][y] << endl; }
			else { cout << cost[x][y] << endl; }
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:59: error: 'INT_MAX' was not declared in this scope
   10 |                 vector<vector<int>>cost(a, vector<int>(a, INT_MAX));
      |                                                           ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include<vector>
  +++ |+#include <climits>
    3 | #include<string>
Language: C++

#include<stdio.h>
#include<algorithm>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#include <iostream>
#include <functional>
#include <time.h>
using namespace std;
clock_t fi, endtime;

const int INF = 100 * 1000 + 2;
const int r_c = 0;
const int r_t = 1;
const int MAX_V = 100;
const int MAX_E = 6000;

int n, m, a, b, c, t;
int k, p, q, r;

int wft[MAX_V][MAX_V] = { 0 };
int wfc[MAX_V][MAX_V] = { 0 };

int main()
{
	scanf_s("%d %d", &m, &n);
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			wfc[i][j] = INF; wft[i][j] = INF;
		}
	}

	for (int i = 0; i < m; ++i) {
		scanf_s("%d %d %d %d", &a, &b, &c, &t);
		wft[a - 1][b - 1] = t;  wft[b - 1][a - 1] = t;
		wfc[a - 1][b - 1] = c;  wfc[b - 1][a - 1] = c;
	}
	for (int k = 0; k < n; ++k) {
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < n; ++j) {
				if (wft[i][j] > wft[i][k] + wft[k][j]) { wft[i][j] = wft[i][k] + wft[k][j]; }
				if (wfc[i][j] > wfc[i][k] + wfc[k][j]) { wfc[i][j] = wfc[i][k] + wfc[k][j]; }
			}
		}
	}
	scanf_s("%d", &k);
	int ans = 0;
	for (int i = 0; i < k; ++i){
		scanf_s("%d %d %d", &p, &q, &r);
		if (p == 0 && q == 0) break;
		if (r == 0) { ans = wfc[p - 1][q - 1]; }
		else { ans = wft[p - 1][q - 1]; }
		printf("%d\n", ans);
	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   28 |         scanf_s("%d %d", &m, &n);
      |         ^~~~~~~
      |         scanf
Language: C++

#include<stdio.h>
#include<algorithm>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#include <iostream>
#include <functional>
#include <time.h>
using namespace std;
clock_t fi, endtime;

const int INF = INT16_MAX;
const int r_c = 0;
const int r_t = 1;
const int MAX_V = 100;
const int MAX_E = 6000;

int n, m, a, b, c, t;
int k, p, q, r;

int wft[MAX_V][MAX_V] = { 0 };
int wfc[MAX_V][MAX_V] = { 0 };

int main()
{
	scanf_s("%d %d", &n, &m);
	for (int i = 0; i < m; ++i) {
		for (int j = 0; j < m; ++j) {
			wfc[i][j] = INF; wft[i][j] = INF;
		}
	}

	for (int i = 0; i < n; ++i) {
		scanf_s("%d %d %d %d", &a, &b, &c, &t);
		wft[a - 1][b - 1] = t;  wft[b - 1][a - 1] = t;
		wfc[a - 1][b - 1] = c;  wfc[b - 1][a - 1] = c;
	}
	for (int k = 0; k < m; ++k) {
		for (int i = 0; i < m; ++i) {
			for (int j = 0; j < m; ++j) {
				if (wft[i][j] > wft[i][k] + wft[k][j]) { wft[i][j] = wft[i][k] + wft[k][j]; }
				if (wfc[i][j] > wfc[i][k] + wfc[k][j]) { wfc[i][j] = wfc[i][k] + wfc[k][j]; }
			}
		}
	}
	scanf_s("%d", &k);
	int ans = 0;
	for (int i = 0; i < k; ++i){
		scanf_s("%d %d %d", &p, &q, &r);
		if (p == 0 && q == 0) break;
		if (r == 0) { ans = wfc[p - 1][q - 1]; }
		else { ans = wft[p - 1][q - 1]; }
		printf("%d\n", ans);
	}

}

Compiler output:
a.cc:14:17: error: 'INT16_MAX' was not declared in this scope
   14 | const int INF = INT16_MAX;
      |                 ^~~~~~~~~
a.cc:10:1: note: 'INT16_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    9 | #include <functional>
  +++ |+#include <cstdint>
   10 | #include <time.h>
a.cc: In function 'int main()':
a.cc:28:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   28 |         scanf_s("%d %d", &n, &m);
      |         ^~~~~~~
      |         scanf
Language: C++

#include<stdio.h>
#include<algorithm>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#include <iostream>
#include <functional>
#include <time.h>
using namespace std;
clock_t fi, endtime;

const int INF = INT16_MAX;
const int r_c = 0;
const int r_t = 1;
const int MAX_V = 100;
const int MAX_E = 6000;

int n, m, a, b, c, t;
int k, p, q, r;

int wft[MAX_V][MAX_V] = { 0 };
int wfc[MAX_V][MAX_V] = { 0 };

int main()
{
	scanf("%d %d", &n, &m);
	for (int i = 0; i < m; ++i) {
		for (int j = 0; j < m; ++j) {
			wfc[i][j] = INF; wft[i][j] = INF;
		}
	}

	for (int i = 0; i < n; ++i) {
		scanf("%d %d %d %d", &a, &b, &c, &t);
		wft[a - 1][b - 1] = t;  wft[b - 1][a - 1] = t;
		wfc[a - 1][b - 1] = c;  wfc[b - 1][a - 1] = c;
	}
	for (int k = 0; k < m; ++k) {
		for (int i = 0; i < m; ++i) {
			for (int j = 0; j < m; ++j) {
				if (wft[i][j] > wft[i][k] + wft[k][j]) { wft[i][j] = wft[i][k] + wft[k][j]; }
				if (wfc[i][j] > wfc[i][k] + wfc[k][j]) { wfc[i][j] = wfc[i][k] + wfc[k][j]; }
			}
		}
	}
	scanf("%d", &k);
	int ans = 0;
	for (int i = 0; i < k; ++i){
		scanf("%d %d %d", &p, &q, &r);
		if (p == 0 && q == 0) break;
		if (r == 0) { ans = wfc[p - 1][q - 1]; }
		else { ans = wft[p - 1][q - 1]; }
		printf("%d\n", ans);
	}

}

Compiler output:
a.cc:14:17: error: 'INT16_MAX' was not declared in this scope
   14 | const int INF = INT16_MAX;
      |                 ^~~~~~~~~
a.cc:10:1: note: 'INT16_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    9 | #include <functional>
  +++ |+#include <cstdint>
   10 | #include <time.h>
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define INF 1010001000
#define loop(i, n) for (int i = 1; i < n; i++)

int main()
{
int n, m; cin >> n >> m; m++;
vector<vector<int> > time(m,vector<int>(m,INF)), cost(m,vector<int>(m,INF));
loop(i, n+1){
int a,b,c,t; cin>>a>>b>>c>>t;
time[a][b]=t;time[b][a]=t;
cost[a][b]=c;cost[b][a]=c;
}
loop(k, m){loop(i, m){loop(i, m){
time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j]);
}}}
int k; cin>>k;
loop(i, k+1){
int p,q,r; cin>>p>>q>>r;
if(r) cout<<time[p][q]<<endl;
else cout<<cost[p][q]<<endl;
}
return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: 'j' was not declared in this scope
   18 | time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
      |         ^
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<s;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int,int> pii;
#define MAX 99999999
signed main(){
while(1){
	int n,m;
	cin>>n>>m;
    if(!(n+m))break;
	vector<vector<pii>>v(n+1,vector<pii>(n+1,pii(INF,INF)));
	rep(i,n+1)v[i][i]=pii(0,0?\);
	rep(i,n){
		pii temp;
		int s,g;
		cin>>s>>g>>temp.first>>temp.second;
        v[--s][--g]=temp;
	}
    rep(k,m){
        rep(i,m){
            rep(j,m){
                v[i][j].first=min(v[i][k].first+v[k][j].first,v[i][j].first);
                v[i][j].second=min(v[i][k].second+v[k][j].second,v[i][j].second);

            }
        }
    }
    int k; cin>>k;
    rep(i,k){
        int s,g,r; cin>>s>>g>>r;
        if(!r)cout<<v[--s][--g].first<<endl;
        else cout<<v[--s][--g].second<<endl;
    }
    
    }
}

	

Compiler output:
a.cc:37:35: error: stray '\' in program
   37 |         rep(i,n+1)v[i][i]=pii(0,0?\);
      |                                   ^
a.cc: In function 'int main()':
a.cc:37:30: error: expected primary-expression before '(' token
   37 |         rep(i,n+1)v[i][i]=pii(0,0?\);
      |                              ^
a.cc:37:36: error: expected primary-expression before ')' token
   37 |         rep(i,n+1)v[i][i]=pii(0,0?\);
      |                                    ^
a.cc:37:35: error: expected ':' before ')' token
   37 |         rep(i,n+1)v[i][i]=pii(0,0?\);
      |                                   ^~
      |                                   :
a.cc:37:36: error: expected primary-expression before ')' token
   37 |         rep(i,n+1)v[i][i]=pii(0,0?\);
      |                                    ^
Language: C++

#define NODE 0
#define WEIGHT 1
#define COST_IDX 0
#define TIME_IDX 1
#define P_IDX 0
#define Q_IDX 1
#define R_IDX 2
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

int n, m, k;
int weights[101][101][2];
int requests[200][3];

bool read_input() {
  cin >> n >> m;
  if (n*m == 0) 
    return false;
  memset(weights, 0, sizeof(int)*101*101*2);
  for (int i = 0; i < n; i++) {
    int a, b, c, t;
    cin >> a >> b >> c >> t;
    weights[a][b][COST_IDX] = weights[b][a][COST_IDX] = c;
    weights[a][b][TIME_IDX] = weights[b][a][TIME_IDX] = t;
  }
  cin >> k;
  for (int i = 0; i < k; i++) {
    cin >> requests[i][P_IDX] >> requests[i][Q_IDX] >> requests[i][R_IDX];
  }
  return true;
}

int resolve_request(int i_th) {
  int p, q, r;
  p = requests[i_th][P_IDX];
  q = requests[i_th][Q_IDX];
  r = requests[i_th][R_IDX];
  
  int weight_sum_map[101];
  int in_queue[101] = {}; // set all to 0
  memset(weight_sum_map, -1, sizeof(int)*101);
  
  /* starting node has weight_sum of 0 */
  weight_sum_map[p] = 0;
  in_queue[p] = 1;
  int current_node = p; // first in queue is p

  while (current_node != q) {
    int weight_sum = weight_sum_map[current_node];
    in_queue[current_node] = 0;
    
    for (int i = 1; i < 101; i++) {
      if (!weights[current_node][i][r]) 
	continue;
      int adj_node = i;
      int w = weights[current_node][adj_node][r];
      int new_weight_sum =  weight_sum + w;
      if (weight_sum_map[adj_node] == -1 || new_weight_sum < weight_sum_map[adj_node]) {
	weight_sum_map[adj_node] = new_weight_sum;
	in_queue[adj_node] = 1;
      }
    }
    
    int min_sum = -1;
    for (int i = 1; i < 101; i++) {
      if (in_queue[i] && (min_sum == -1 || weight_sum_map[i] < min_sum)) {
	min_sum = weight_sum_map[i];
	current_node = i;
      }
    }
  }
  return weight_sum_map[q];
}

void solve() {
  for (int i = 0; i < k; i++)
    cout << resolve_request(i) << endl;
}

int main() {
  while(read_input()) {
    solve();
  }
  return 0;
}

Compiler output:
a.cc: In function 'bool read_input()':
a.cc:21:3: error: 'memset' was not declared in this scope
   21 |   memset(weights, 0, sizeof(int)*101*101*2);
      |   ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    9 | #include <queue>
  +++ |+#include <cstring>
   10 | #include <vector>
a.cc: In function 'int resolve_request(int)':
a.cc:43:3: error: 'memset' was not declared in this scope
   43 |   memset(weight_sum_map, -1, sizeof(int)*101);
      |   ^~~~~~
a.cc:43:3: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#define NODE 0
#define WEIGHT 1
#define COST_IDX 0
#define TIME_IDX 1
#define P_IDX 0
#define Q_IDX 1
#define R_IDX 2
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

int n, m, k;
int weights[101][101][2];
int min_w[101][101][2];
int requests[200][3];

bool read_input() {
  cin >> n >> m;
  if (n*m == 0) 
    return false;
  memset(weights, 0, sizeof(int)*101*101*2);
  memset(min_w, 0, sizeof(int)*101*101*2);
  for (int i = 0; i < n; i++) {
    int a, b, c, t;
    cin >> a >> b >> c >> t;
    weights[a][b][COST_IDX] = weights[b][a][COST_IDX] = c;
    weights[a][b][TIME_IDX] = weights[b][a][TIME_IDX] = t;
  }
  cin >> k;
  for (int i = 0; i < k; i++) {
    cin >> requests[i][P_IDX] >> requests[i][Q_IDX] >> requests[i][R_IDX];
  }
  return true;
}

int resolve_request(int i_th) {
  int p, q, r;
  p = requests[i_th][P_IDX];
  q = requests[i_th][Q_IDX];
  r = requests[i_th][R_IDX];

  if (min_w[p][q][r])
    return min_w[p][q][r];

  int weight_sum_map[101];
  int in_queue[101] = {}; // set all to 0
  memset(weight_sum_map, -1, sizeof(int)*101);
  
  /* starting node has weight_sum of 0 */
  weight_sum_map[p] = 0;
  in_queue[p] = 1;
  int current_node = p; // first in queue is p

  while (current_node != q) {
    int weight_sum = weight_sum_map[current_node];
    in_queue[current_node] = 0;
    min_w[p][current_node][r] = weight_sum;
    
    for (int i = 1; i < 101; i++) {
      if (!weights[current_node][i][r]) 
	continue;
      int adj_node = i;
      int w = weights[current_node][adj_node][r];
      int new_weight_sum =  weight_sum + w;
      if (weight_sum_map[adj_node] == -1 || new_weight_sum < weight_sum_map[adj_node]) {
	weight_sum_map[adj_node] = new_weight_sum;
	in_queue[adj_node] = 1;
      }
    }
    
    int min_sum = -1;
    for (int i = 1; i < 101; i++) {
      if (in_queue[i] && (min_sum == -1 || weight_sum_map[i] < min_sum)) {
	min_sum = weight_sum_map[i];
	current_node = i;
      }
    }
  }
  return weight_sum_map[q];
}

void solve() {
  for (int i = 0; i < k; i++)
    cout << resolve_request(i) << endl;
}

int main() {
  while(read_input()) {
    solve();
  }
  return 0;
}

Compiler output:
a.cc: In function 'bool read_input()':
a.cc:22:3: error: 'memset' was not declared in this scope
   22 |   memset(weights, 0, sizeof(int)*101*101*2);
      |   ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    9 | #include <queue>
  +++ |+#include <cstring>
   10 | #include <vector>
a.cc: In function 'int resolve_request(int)':
a.cc:48:3: error: 'memset' was not declared in this scope
   48 |   memset(weight_sum_map, -1, sizeof(int)*101);
      |   ^~~~~~
a.cc:48:3: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'