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

#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
using namespace std;
main(){
  int m,n;
  while(cin>>m>>n,n){
    int a1[n][n],a2[n][n],q,w,e,r;
    r(i,n)r(j,n){
      if(i==j)a2[i][j]=a1[i][j]=0;
      else a2[i][j]=a1[i][j]=INF;
    }
    while(m--){
      scanf("%d%d%d%d",&q,&w,&e,&r)q--;w--;
      a1[q][w]=e;
      a2[q][w]=r;
    }
    r(k,n)r(i,n)r(j,n){
      a1[i][j]=min(a1[i][j],a1[i][k]+a1[k][j]);
      a2[i][j]=min(a2[i][j],a2[i][k]+a2[k][j]);
    }
    cin>>e;
    while(e--){
      scanf("%d%d%d",&q,&w,&e);q--;w--;
      if(r)cout<<a2[w][q]<<endl;
      else cout<<a1[w][q]<<endl;
    }
  }
}

Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:14:36: error: expected ';' before 'q'
   14 |       scanf("%d%d%d%d",&q,&w,&e,&r)q--;w--;
      |                                    ^
      |                                    ;
Language: C++

#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
using namespace std;
main(){
  int m,n;
  while(cin>>m>>n,n){
    int a1[n][n],a2[n][n],q,w,e,r;
    r(i,n)r(j,n){
      if(i==j)a2[i][j]=a1[i][j]=0;
      else a2[i][j]=a1[i][j]=INF;
    }
    while(m--){
      scanf("%d%d%d%d",&q,&w,&e,&r);q--;w--;
      a1[q][w]=a1[w][q]=e;
      a2[q][w]=a2[w][q]=r;
    }
    r(k,n)r(i,n)r(j,n){
      a1[i][j]=min(a1[i][j],a1[i][k]+a1[k][j]);
      a2[i][j]=min(a2[i][j],a2[i][k]+a2[k][j]);
    }
    cin>>e;
    while(e--){
      scanf("%d%d%d",&q,&w,&r)q--;w--;
      if(r)cout<<a2[q][w]<<endl;
      else cout<<a1[q][w]<<endl;
    }
  }
}

Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:24:31: error: expected ';' before 'q'
   24 |       scanf("%d%d%d",&q,&w,&r)q--;w--;
      |                               ^
      |                               ;
Language: C++

#include <bits/stdc++.h>
#define r(i,a,n) for(int i=a;i<n;i++)
#define INF 1<<29
using namespace std;
main(){
  int m,n;
  while(cin>>m>>n,n){
    int a1[n][n],a2[n][n],q,w,e,r;
    r(i,0,n)r(j,0,n){
      if(i==j)a2[i][j]=a1[i][j]=0;
      else a2[i][j]=a1[i][j]=INF;
    }
    while(m--){
      scanf("%d%d%d%d",&q,&w,&e,&r);q--;w--;
      a1[q][w]=a1[w][q]=e;
      a2[q][w]=a2[w][q]=r;
    }
    r(k,0,n)r(i,0,n)r(j,i+1,n){
      a1[i][j]=a[j][i]=min(a1[i][j],a1[i][k]+a1[k][j]);
      a2[i][j]=a[j][i]=min(a2[i][j],a2[i][k]+a2[k][j]);
    }
    cin>>e;
    while(e--){
      scanf("%d%d%d",&q,&w,&r);q--;w--;
      if(r)cout<<a2[q][w]<<endl;
      else cout<<a1[q][w]<<endl;
    }
  }
}

Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:19:16: error: 'a' was not declared in this scope
   19 |       a1[i][j]=a[j][i]=min(a1[i][j],a1[i][k]+a1[k][j]);
      |                ^
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <queue>
#include <functional>
#define N 101
#define INF 2000000000
using namespace std;
 
int dist[N];
typedef pair<int,int> pii;
 
std::vector<pii> e1[N];
std::vector<pii> e2[N];
 
int dijk1(int a,int b){
    dist[a]=0;
    std::priority_queue<pii> pq;
    for(int i=0;i<e2[a].size();i++){
        pq.push(e2[a][i]);
    }
    while(!pq.empty()){
        pii temp=pq.top();
        int now=temp.second;
        int c=temp.first;
        pq.pop();
        if(dist[now]!=INF)continue;
        dist[now]=-c;
        if(now==b)break;
        for(int i=0;i<e2[now].size();i++){
            pq.push(make_pair(c+e2[now][i].first,e2[now][i].second));
        }
    }
    return dist[b];
}
 
int dijk(int a,int b){
    dist[a]=0;
    std::priority_queue<pii> pq;
    for(int i=0;i<e1[a].size();i++){
        pq.push(e1[a][i]);
    }
    while(!pq.empty()){
        pii temp=pq.top();
        int now=temp.second;
        int c=temp.first;
        pq.pop();
        if(dist[now]!=INF)continue;
        dist[now]=-c;
        if(now==b)break;
        for(int i=0;i<e1[now].size();i++){
            pq.push(make_pair(c+e1[now][i].first,e1[now][i].second));
        }
    }
    return dist[b];
}
 
int main(void){
    int a,b,c,d;
    int n,m;
    while(cin>>n>>m,n||m){
        for(int i=0;i<n;i++){
            cin>>a>>b>>c>>d;
e1[b].push_back(make_pair(-c,a);
            e1[a].push_back(make_pair(-c,b));
            e2[a].push_back(make_pair(-d,b));
e2[b].push_back(make_pair(-d,a);
        }
        int k;
        cin>>k;
        while(k--){
            for(int i=1;i<=m;i++)dist[i]=INF;
            cin>>a>>b>>c;
            if(c) cout<<dijk1(a,b)<<endl;
            else cout<<dijk(a,b)<<endl;
            // for(int i=1;i<=m;i++)printf("dist[%d]:%d\n",i,dist[i]);
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:32: error: expected ')' before ';' token
   65 | e1[b].push_back(make_pair(-c,a);
      |                ~               ^
      |                                )
a.cc:68:32: error: expected ')' before ';' token
   68 | e2[b].push_back(make_pair(-d,a);
      |                ~               ^
      |                                )
Language: C++

#include <iostream>
#include <vector>
#define INF 1<<29
??
using namespace std;
??
int main(void) {
????????int n,m,k,p,q,r;
????????while (cin >> n >> m && n && m) {
????????????????int dp[101][101][2];
????????????????for (int i = 0; i < m + 1; ++i) {
????????????????????????for (int j = 0; j < m + 1; ++j) {
????????????????????????????????for (int k = 0; k < 2; ++k) {
????????????????????????????????????????if (i == j) {
????????????????????????????????????????????????dp[i][j][k] = 0;
????????????????????????????????????????}
????????????????????????????????????????else {
????????????????????????????????????????????????dp[i][j][k] = INF;
????????????????????????????????????????}
????????????????????????????????}
????????????????????????}
????????????????}
??
????????????????int a,b,c,t;
????????????????for (int i = 0; i < n; ++i) {
????????????????????????cin >> a >> b >> dp[a][b][0] >> dp[a][b][1];
????????????????????????dp[b][a][0] = dp[a][b][0];
????????????????????????dp[b][a][1] = dp[a][b][1];
????????????????}
??
????????????????for (int mode = 0; mode < 2; ++mode) {
????????????????????????for (int k = 1; k < m + 1; ++k) {
????????????????????????????????for (int i = 1; i < m + 1; ++i) {
????????????????????????????????????????for (int j = 1; j < m + 1; ++j) {
????????????????????????????????????????????????dp[i][j][mode] = min(dp[i][j][mode], dp[i][k][mode]+dp[k][j][mode]);
????????????????????????????????????????}
????????????????????????????????}
????????????????????????}
????????????????}
??
????????????????cin >> k;
????????????????for (int i = 0; i < k; ++i) {
????????????????????????cin >> p >> q >> r;
????????????????????????cout << dp[p][q][r] << endl;
????????????????}
????????}
????????return 0;
}

Compiler output:
a.cc:4:1: error: expected unqualified-id before '?' token
    4 | ??
      | ^
a.cc:6:1: error: expected unqualified-id before '?' token
    6 | ??
      | ^
Language: C++

#include<iostream>

#define INF 1001;
using namespace std;


int main(){
  int n,m;
  while(1){
    cin>>n>>m;
    if(n==0&&m==0)break;
    int s_tim[m][m];
    int c_money[m][m];
    int a,b,cost,tim;

    for(int i=0;i<m;i++){
      for(int j=0;j<n;j++){
        s_tim[i][j]=INF;
        c_money[i][j]=INF;
      }
    }
    for(int i=0;i<m;i++){
      s_tim[i][i]=0;
      c_money[i][i]=0;
    }
    for(int i=0;i<n;i++){
      cin>>a>>b>>cost>>tim;
      s_tim[a-1][b-1]=tim;s_tim[b-1][a-1]=tim;
      c_money[a-1][b-1]=cost;c_money[b-1][a-1]=cost;
    }

    for(int k=0;k<m;k++){
      for(int i=0;i<m;i++){
        for(int j=0;j<m;j++){
          if(s_tim[i][j]>s_tim[i][k]+s_tim[k][j]){
            s_tim[i][j]=s_tim[i][k]+s_tim[k][j];
          }
          if(c_money[i][j]>c_money[i][k]+c_money[k][j]){
            c_money[i][j]=c_money[i][k]+c_money[k][j];
          }
        }
      }
    }

    int contacts,p,q,r;
    cin>>contacts;

    for(int i=0;i<contacts;i++){
      cin>>p>>q>>r;
      if(r){cout<<s_tim[p-1][q-1];}
      else{ cout<<c_money[p-1][q-1];}


Compiler output:
a.cc: In function 'int main()':
a.cc:51:38: error: expected '}' at end of input
   51 |       else{ cout<<c_money[p-1][q-1];}
      |                                      ^
a.cc:48:32: note: to match this '{'
   48 |     for(int i=0;i<contacts;i++){
      |                                ^
a.cc:51:38: error: expected '}' at end of input
   51 |       else{ cout<<c_money[p-1][q-1];}
      |                                      ^
a.cc:9:11: note: to match this '{'
    9 |   while(1){
      |           ^
a.cc:51:38: error: expected '}' at end of input
   51 |       else{ cout<<c_money[p-1][q-1];}
      |                                      ^
a.cc:7:11: note: to match this '{'
    7 | int main(){
      |           ^
Language: C++

#include<iostream>

#define INF ;
using namespace std;


int main(){
  int n,m;
  while(1){
    cin>>n>>m;
    if(n==0&&m==0){break;}
    int s_tim[m][m];
    int c_money[m][m];
    int a,b,cost,tim;

    for(int i=0;i<m;i++){
      for(int j=0;j<m;j++){
        s_tim[i][j]=INF;
        c_money[i][j]=INF;
      }
    }
    for(int i=0;i<m;i++){
      s_tim[i][i]=0;
      c_money[i][i]=0;
    }
    for(int i=0;i<n;i++){
      cin>>a>>b>>cost>>tim;
      s_tim[a-1][b-1]=tim;s_tim[b-1][a-1]=tim;
      c_money[a-1][b-1]=cost;c_money[b-1][a-1]=cost;
    }

    for(int k=0;k<m;k++){
      for(int i=0;i<m;i++){
        for(int j=0;j<m;j++){
          if(s_tim[i][j]>s_tim[i][k]+s_tim[k][j]){
            s_tim[i][j]=s_tim[i][k]+s_tim[k][j];
          }
          if(c_money[i][j]>c_money[i][k]+c_money[k][j]){
            c_money[i][j]=c_money[i][k]+c_money[k][j];
          }
        }
      }
    }

    int contacts,p,q,r;
    cin>>contacts;

    for(int i=0;i<contacts;i++){
      cin>>p>>q>>r;
      if(r){cout<<s_tim[p-1][q-1];}
      else{ cout<<c_money[p-1][q-1];}
      cout<<endl;
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:13: error: expected primary-expression before ';' token
    3 | #define INF ;
      |             ^
a.cc:18:21: note: in expansion of macro 'INF'
   18 |         s_tim[i][j]=INF;
      |                     ^~~
a.cc:3:13: error: expected primary-expression before ';' token
    3 | #define INF ;
      |             ^
a.cc:19:23: note: in expansion of macro 'INF'
   19 |         c_money[i][j]=INF;
      |                       ^~~
Language: C++

##include <iostream>
using namespace std;

const int INF = 1000000000;

int main()
{
  int count=0;
	while(count!=50){
		int n, m;
		cin >> n >> m;

		if(n==0 && m==0)
			break;

		 int C[100][100];
		 int T[100][100];
	   for(int i=0; i<m; i++){
		   for(int j=0; j<m; j++){
			   if(i==j){
	         C[i][j] = T[i][j] = 0;
		     }else{
			     C[i][j] = T[i][j] = INF;
		     }
		   }
     }

	   for(int i=0; i<n; i++){
		   int a, b, c, t;
		   cin >> a >> b >> c >> t;

	     C[a-1][b-1] = C[b-1][a-1] = c;
		   T[a-1][b-1] = T[b-1][a-1] = t;
    }

    int k;
    cin>>k;
    for(int i=0;i<k;i++){
      int p, q, r;
      int a=0;
      cin>>p>>q>>r;
      int d[m][m];
      if(r==0){
        for(int i=0;i<m;i++){
          for(int j=0;j<m;j++){
            d[i][j]=C[i][j];
          }
        }
        for(int k=0;k<m;k++){
          for(int i=0;i<m;i++){
            for(int j=0;j<m;j++){
              if(d[i][j]>d[i][k]+d[k][j]){
                d[i][j]=d[i][k]+d[k][j];
              }
            }
          }
        }
        a=d[p-1][q-1];
        cout<<a<<endl;
      }
      if(r==1){
        for(int i=0;i<m;i++){
          for(int j=0;j<m;j++){
            d[i][j]=T[i][j];
          }
        }
        for(int k=0;k<m;k++){
          for(int i=0;i<m;i++){
            for(int j=0;j<m;j++){
              if(d[i][j]>d[i][k]+d[k][j]){
                d[i][j]=d[i][k]+d[k][j];
              }
            }
          }
        }
        a=d[p-1][q-1];
        cout<<a<<endl;
      }
    }
    count++;
	}

	return 0;
}



Compiler output:
a.cc:1:1: error: stray '##' in program
    1 | ##include <iostream>
      | ^~
a.cc:1:3: error: 'include' does not name a type
    1 | ##include <iostream>
      |   ^~~~~~~
a.cc: In function 'int main()':
a.cc:11:17: error: 'cin' was not declared in this scope
   11 |                 cin >> n >> m;
      |                 ^~~
a.cc:59:9: error: 'cout' was not declared in this scope; did you mean 'count'?
   59 |         cout<<a<<endl;
      |         ^~~~
      |         count
a.cc:59:18: error: 'endl' was not declared in this scope
   59 |         cout<<a<<endl;
      |                  ^~~~
a.cc:77:9: error: 'cout' was not declared in this scope; did you mean 'count'?
   77 |         cout<<a<<endl;
      |         ^~~~
      |         count
a.cc:77:18: error: 'endl' was not declared in this scope
   77 |         cout<<a<<endl;
      |                  ^~~~
Language: C++

##include <iostream>
using namespace std;

const int INF = 1000000000;

int main()
{
  int count=0;
	while(count!=50){
		int n, m;
		cin >> n >> m;

		if(n==0 && m==0)
			break;

		 int C[100][100];
		 int T[100][100];
	   for(int i=0; i<m; i++){
		   for(int j=0; j<m; j++){
			   if(i==j){
	         C[i][j] = T[i][j] = 0;
		     }else{
			     C[i][j] = T[i][j] = INF;
		     }
		   }
     }

	   for(int i=0; i<n; i++){
		   int a, b, c, t;
		   cin >> a >> b >> c >> t;

	     C[a-1][b-1] = C[b-1][a-1] = c;
		   T[a-1][b-1] = T[b-1][a-1] = t;
    }

    int k;
    cin>>k;
    for(int i=0;i<k;i++){
      int p, q, r;
      int a=0;
      cin>>p>>q>>r;
      int d[m][m];
      if(r==0){
        for(int i=0;i<m;i++){
          for(int j=0;j<m;j++){
            d[i][j]=C[i][j];
          }
        }
        for(int k=0;k<m;k++){
          for(int i=0;i<m;i++){
            for(int j=0;j<m;j++){
              if(d[i][j]>d[i][k]+d[k][j]){
                d[i][j]=d[i][k]+d[k][j];
              }
            }
          }
        }
        a=d[p-1][q-1];
        cout<<a<<endl;
      }
      if(r==1){
        for(int i=0;i<m;i++){
          for(int j=0;j<m;j++){
            d[i][j]=T[i][j];
          }
        }
        for(int k=0;k<m;k++){
          for(int i=0;i<m;i++){
            for(int j=0;j<m;j++){
              if(d[i][j]>d[i][k]+d[k][j]){
                d[i][j]=d[i][k]+d[k][j];
              }
            }
          }
        }
        a=d[p-1][q-1];
        cout<<a<<endl;
      }
    }
	}

	return 0;
}



Compiler output:
a.cc:1:1: error: stray '##' in program
    1 | ##include <iostream>
      | ^~
a.cc:1:3: error: 'include' does not name a type
    1 | ##include <iostream>
      |   ^~~~~~~
a.cc: In function 'int main()':
a.cc:11:17: error: 'cin' was not declared in this scope
   11 |                 cin >> n >> m;
      |                 ^~~
a.cc:59:9: error: 'cout' was not declared in this scope; did you mean 'count'?
   59 |         cout<<a<<endl;
      |         ^~~~
      |         count
a.cc:59:18: error: 'endl' was not declared in this scope
   59 |         cout<<a<<endl;
      |                  ^~~~
a.cc:77:9: error: 'cout' was not declared in this scope; did you mean 'count'?
   77 |         cout<<a<<endl;
      |         ^~~~
      |         count
a.cc:77:18: error: 'endl' was not declared in this scope
   77 |         cout<<a<<endl;
      |                  ^~~~
Language: C++

##include <iostream>
using namespace std;

const int INF = 1000000000;

int main()
{
  int count=0;
	while(count==50){
		int n, m;
		cin >> n >> m;

		if(n==0 && m==0)
			break;

		 int C[100][100];
		 int T[100][100];
	   for(int i=0; i<m; i++){
		   for(int j=0; j<m; j++){
			   if(i==j){
	         C[i][j] = T[i][j] = 0;
		     }else{
			     C[i][j] = T[i][j] = INF;
		     }
		   }
     }

	   for(int i=0; i<n; i++){
		   int a, b, c, t;
		   cin >> a >> b >> c >> t;

	     C[a-1][b-1] = C[b-1][a-1] = c;
		   T[a-1][b-1] = T[b-1][a-1] = t;
    }

    int k;
    cin>>k;
    for(int i=0;i<k;i++){
      int p, q, r;
      int a=0;
      cin>>p>>q>>r;
      int d[m][m];
      if(r==0){
        for(int i=0;i<m;i++){
          for(int j=0;j<m;j++){
            d[i][j]=C[i][j];
          }
        }
        for(int k=0;k<m;k++){
          for(int i=0;i<m;i++){
            for(int j=0;j<m;j++){
              if(d[i][j]>d[i][k]+d[k][j]){
                d[i][j]=d[i][k]+d[k][j];
              }
            }
          }
        }
        a=d[p-1][q-1];
        cout<<a<<endl;
      }
      if(r==1){
        for(int i=0;i<m;i++){
          for(int j=0;j<m;j++){
            d[i][j]=T[i][j];
          }
        }
        for(int k=0;k<m;k++){
          for(int i=0;i<m;i++){
            for(int j=0;j<m;j++){
              if(d[i][j]>d[i][k]+d[k][j]){
                d[i][j]=d[i][k]+d[k][j];
              }
            }
          }
        }
        a=d[p-1][q-1];
        cout<<a<<endl;
      }
    }
    count++;
	}

	return 0;
}



Compiler output:
a.cc:1:1: error: stray '##' in program
    1 | ##include <iostream>
      | ^~
a.cc:1:3: error: 'include' does not name a type
    1 | ##include <iostream>
      |   ^~~~~~~
a.cc: In function 'int main()':
a.cc:11:17: error: 'cin' was not declared in this scope
   11 |                 cin >> n >> m;
      |                 ^~~
a.cc:59:9: error: 'cout' was not declared in this scope; did you mean 'count'?
   59 |         cout<<a<<endl;
      |         ^~~~
      |         count
a.cc:59:18: error: 'endl' was not declared in this scope
   59 |         cout<<a<<endl;
      |                  ^~~~
a.cc:77:9: error: 'cout' was not declared in this scope; did you mean 'count'?
   77 |         cout<<a<<endl;
      |         ^~~~
      |         count
a.cc:77:18: error: 'endl' was not declared in this scope
   77 |         cout<<a<<endl;
      |                  ^~~~
Language: C++

##include <iostream>
using namespace std;

const int INF = 1000000000;

int main()
{
  int count=0;
	while(count=50){
		int n, m;
		cin >> n >> m;

		if(n==0 && m==0)
			break;

		 int C[100][100];
		 int T[100][100];
	   for(int i=0; i<m; i++){
		   for(int j=0; j<m; j++){
			   if(i==j){
	         C[i][j] = T[i][j] = 0;
		     }else{
			     C[i][j] = T[i][j] = INF;
		     }
		   }
     }

	   for(int i=0; i<n; i++){
		   int a, b, c, t;
		   cin >> a >> b >> c >> t;

	     C[a-1][b-1] = C[b-1][a-1] = c;
		   T[a-1][b-1] = T[b-1][a-1] = t;
    }

    int k;
    cin>>k;
    for(int i=0;i<k;i++){
      int p, q, r;
      int a=0;
      cin>>p>>q>>r;
      int d[m][m];
      if(r==0){
        for(int i=0;i<m;i++){
          for(int j=0;j<m;j++){
            d[i][j]=C[i][j];
          }
        }
        for(int k=0;k<m;k++){
          for(int i=0;i<m;i++){
            for(int j=0;j<m;j++){
              if(d[i][j]>d[i][k]+d[k][j]){
                d[i][j]=d[i][k]+d[k][j];
              }
            }
          }
        }
        a=d[p-1][q-1];
        cout<<a<<endl;
      }
      if(r==1){
        for(int i=0;i<m;i++){
          for(int j=0;j<m;j++){
            d[i][j]=T[i][j];
          }
        }
        for(int k=0;k<m;k++){
          for(int i=0;i<m;i++){
            for(int j=0;j<m;j++){
              if(d[i][j]>d[i][k]+d[k][j]){
                d[i][j]=d[i][k]+d[k][j];
              }
            }
          }
        }
        a=d[p-1][q-1];
        cout<<a<<endl;
      }
    }
    count++;
	}

	return 0;
}



Compiler output:
a.cc:1:1: error: stray '##' in program
    1 | ##include <iostream>
      | ^~
a.cc:1:3: error: 'include' does not name a type
    1 | ##include <iostream>
      |   ^~~~~~~
a.cc: In function 'int main()':
a.cc:11:17: error: 'cin' was not declared in this scope
   11 |                 cin >> n >> m;
      |                 ^~~
a.cc:59:9: error: 'cout' was not declared in this scope; did you mean 'count'?
   59 |         cout<<a<<endl;
      |         ^~~~
      |         count
a.cc:59:18: error: 'endl' was not declared in this scope
   59 |         cout<<a<<endl;
      |                  ^~~~
a.cc:77:9: error: 'cout' was not declared in this scope; did you mean 'count'?
   77 |         cout<<a<<endl;
      |         ^~~~
      |         count
a.cc:77:18: error: 'endl' was not declared in this scope
   77 |         cout<<a<<endl;
      |                  ^~~~
Language: C++

##include <iostream>
using namespace std;

const int INF = 1000000000;

int main()
{
	while(false){
		int n, m;
		cin >> n >> m;

		if(n==0 && m==0)
			break;

		 int C[100][100];
		 int T[100][100];
	   for(int i=0; i<m; i++){
		   for(int j=0; j<m; j++){
			   if(i==j){
	         C[i][j] = T[i][j] = 0;
		     }else{
			     C[i][j] = T[i][j] = INF;
		     }
		   }
     }

	   for(int i=0; i<n; i++){
		   int a, b, c, t;
		   cin >> a >> b >> c >> t;

	     C[a-1][b-1] = C[b-1][a-1] = c;
		   T[a-1][b-1] = T[b-1][a-1] = t;
    }

    int k;
    cin>>k;
    for(int i=0;i<k;i++){
      int p, q, r;
      int a=0;
      cin>>p>>q>>r;
      int d[m][m];
      if(r==0){
        for(int i=0;i<m;i++){
          for(int j=0;j<m;j++){
            d[i][j]=C[i][j];
          }
        }
        for(int k=0;k<m;k++){
          for(int i=0;i<m;i++){
            for(int j=0;j<m;j++){
              if(d[i][j]>d[i][k]+d[k][j]){
                d[i][j]=d[i][k]+d[k][j];
              }
            }
          }
        }
        a=d[p-1][q-1];
        cout<<a<<endl;
      }
      if(r==1){
        for(int i=0;i<m;i++){
          for(int j=0;j<m;j++){
            d[i][j]=T[i][j];
          }
        }
        for(int k=0;k<m;k++){
          for(int i=0;i<m;i++){
            for(int j=0;j<m;j++){
              if(d[i][j]>d[i][k]+d[k][j]){
                d[i][j]=d[i][k]+d[k][j];
              }
            }
          }
        }
        a=d[p-1][q-1];
        cout<<a<<endl;
      }
    }
	}

	return 0;
}



Compiler output:
a.cc:1:1: error: stray '##' in program
    1 | ##include <iostream>
      | ^~
a.cc:1:3: error: 'include' does not name a type
    1 | ##include <iostream>
      |   ^~~~~~~
a.cc: In function 'int main()':
a.cc:10:17: error: 'cin' was not declared in this scope
   10 |                 cin >> n >> m;
      |                 ^~~
a.cc:58:9: error: 'cout' was not declared in this scope
   58 |         cout<<a<<endl;
      |         ^~~~
a.cc:58:18: error: 'endl' was not declared in this scope
   58 |         cout<<a<<endl;
      |                  ^~~~
a.cc:76:9: error: 'cout' was not declared in this scope
   76 |         cout<<a<<endl;
      |         ^~~~
a.cc:76:18: error: 'endl' was not declared in this scope
   76 |         cout<<a<<endl;
      |                  ^~~~
Language: C++

#include <iostream>
using namespace std;

const int INF = 1000000000;

int main()
{
	while(false){
		int n, m;
		cin >> n >> m;

		if(n==0 && m==0)
			break;

		 int C[100][100];
		 int T[100][100];
	   for(int i=0; i<m; i++){
		   for(int j=0; j<m; j++){
			   if(i==j){
	         C[i][j] = T[i][j] = 0;
		     }else{
			     C[i][j] = T[i][j] = INF;
		     }
		   }
     }

	   for(int i=0; i<n; i++){
		   int a, b, c, t;
		   cin >> a >> b >> c >> t;

	     C[a-1][b-1] = C[b-1][a-1] = c;
		   T[a-1][b-1] = T[b-1][a-1] = t;
    }

    int k;
    cin>>k;
    for(int k=0;k<m;k++){
      for(int i=0;i<m;i++){
        for(int j=0;j<m;j++){
          if(d[i][j]>d[i][k]+d[k][j]){
            d[i][j]=d[i][k]+d[k][j];
          }
        }
      }
    }
    for(int i=0;i<k;i++){
      int p, q, r;
      int a=0;
      cin>>p>>q>>r;
      int d[m][m];
      if(r==0){
        for(int i=0;i<m;i++){
          for(int j=0;j<m;j++){
            d[i][j]=C[i][j];
          }
        }
        a=d[p-1][q-1];
        cout<<a<<endl;
      }
      if(r==1){
        for(int i=0;i<m;i++){
          for(int j=0;j<m;j++){
            d[i][j]=T[i][j];
          }
        }
        a=d[p-1][q-1];
        cout<<a<<endl;
      }
    }
	}

	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:40:14: error: 'd' was not declared in this scope
   40 |           if(d[i][j]>d[i][k]+d[k][j]){
      |              ^
Language: C++

#include<iostream>
#include<queue>

#define inf 1000000000

using namespace std;

int C[101][101],T[101][101];
	int n,m;

class sint{
	public:
	int n,m;
	sint(){}
	sint(int a,int b){n=a;m=b;}
	operator < (const sint &a) const{
		return m>a.m;
	}
};

int dike(int st,int en,int va){
	priority_queue<sint> state;
	
	int visit[101];
	int now[101];
	for(int i=0;i<101;i++){
		visit[i]=0;
		now[i]=inf;
	}
	
	state.push(sint(st,0));
	now[st]=0;
	
	while(1){
		sint u;
		u=state.top();
		state.pop();
		visit[u.n]=1;
		/*
		printf("come %d %d\n",u.n,u.m);
		for(int i=1;i<=m;i++){
			printf("%4d",now[i]);
		}
		puts("");
		for(int i=1;i<=m;i++){
			printf("%4d",visit[i]);
		}puts("");
		*/if(u.n==en){
			return u.m;
		}
		
		
		for(int i=1;i<=m;i++){
			int cost=C[u.n][i];
			if(va==1){
				cost=T[u.n][i];
			}
			if(cost==inf||visit[i]==1){
				continue;
			}
			if(cost+u.m < now[i]){
				now[i]=cost+u.m;
				state.push(sint(i,now[i]));
			}
		}
	}
}

int main(){
	
	while(1){
		cin>>n>>m;
		if(n==0){
			break;
		}
		for(int i=0;i<101;i++){
			for(int j=0;j<101;j++){
				C[i][j]=T[i][j]=inf;
			}
		}
		
		for(int i=0;i<n;i++){
			int a,b,c,d;
			cin>>a>>b>>c>>d;
			C[a][b]=C[b][a]=c;
			T[a][b]=T[b][a]=d;
		}
		
		int l;
		cin>>l;
		
		for(int i=0;i<l;i++){
			int a,b,c;
			cin>>a>>b>>c;
			printf("%d\n",dike(a,b,c));
		}
	}
}

Compiler output:
a.cc:16:9: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
   16 |         operator < (const sint &a) const{
      |         ^~~~~~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

static const int TYPE_COST =0;
static const int TYPE_TIME =1;

class station{
public:
	int cost;
	bool visited;
	vector<int> edge_to;
	vector<int> edge_cost;
	vector<int> edge_time;
	
	 public:
		station() :  cost(-1), visited(false){}
		void add_to(int to, int cost, int time)
		{
			this->edge_to.push_back(to);
			this->edge_cost.push_back(cost);
			this->edge_time.push_back(time);
		}
};

int dijkstra(station* sta, int size, int from, int to, int type);
bool contain(vector<station> sta, station elem);
void reset(station* sta, int size);

int main(int argc, char** argv)
{
	while( 1 ){
		int n, m, from, to, cost, time, type;
		cin >> n;
		cin >> m;
		if(n==0 && m==0) break;
		
		station sta[m];
		for(int i=0; i<m; i++){
			sta[i] = station();
		}
		
		for(int i=0; i<n; i++){
			cin >> from;
			cin >> to;
			cin >> cost;
			cin >> time;
			sta[from-1].add_to(to-1, cost, time);
		}
		cin >> n;
		for(int i=0; i<n; i++){
			cin >> from;
			cin >> to;
			cin >> type;
			cout << dijkstra(sta, m, from-1, to-1, type) << endl;
			reset(sta, m);
		}
	}
	
	return 0;
}

int dijkstra(station* sta, int size, int start, int goal, int type)
{
	int to, cost;
	station done;
	vector<station> q;
	sta[start].cost = 0;
	q.push_back(sta[start]);
	
	while(!q.empty()){
		done = q[0];
		q.erase(q.begin());
		done.visited = true;
		
		for(int i=0; i<done.edge_to.size(); i++){
			to = done.edge_to[i];
			if(type==TYPE_COST) cost = done.cost + done.edge_cost[i];
			if(type==TYPE_TIME) cost = done.cost + done.edge_time[i];
			if(sta[to].cost < 0 || cost < sta[to].cost){
				sta[to].cost = cost;
				if(!contain(q, sta[to])){
					q.push_back(sta[to]);
				}
			}
		}	
	}
	
	return sta[goal].cost;
}

bool contain(vector<station> sta, station elem)
{
	int size = sta.size();
	bool is_match = false;
	for(int i=0; i<size; i++){
		if(memcmp(&sta[i], &elem, sizeof(station)) == 0){
			is_match = true;
			break;
		}
	}
	return is_match;
}

void reset(station* sta, int size)
{
	for(int i=0; i<size; i++){
		sta[i].visited = false;
		sta[i].cost = -1;
	}
}

Compiler output:
a.cc: In function 'bool contain(std::vector<station>, station)':
a.cc:98:20: error: 'memcmp' was not declared in this scope
   98 |                 if(memcmp(&sta[i], &elem, sizeof(station)) == 0){
      |                    ^~~~~~
a.cc:3:1: note: 'memcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <vector>
  +++ |+#include <cstring>
    3 |
Language: C++

#include <iostream>
#include <vector>
#include <stdlib.h>

using namespace std;

static const int TYPE_COST =0;
static const int TYPE_TIME =1;

class station{
public:
	int cost;
	bool visited;
	vector<int> edge_to;
	vector<int> edge_cost;
	vector<int> edge_time;
	
	 public:
		station() :  cost(-1), visited(false){}
		void add_to(int to, int cost, int time)
		{
			this->edge_to.push_back(to);
			this->edge_cost.push_back(cost);
			this->edge_time.push_back(time);
		}
};

int dijkstra(station* sta, int size, int from, int to, int type);
bool contain(vector<station> sta, station elem);
void reset(station* sta, int size);

int main(int argc, char** argv)
{
	while( 1 ){
		int n, m, from, to, cost, time, type;
		cin >> n;
		cin >> m;
		if(n==0 && m==0) break;
		
		station sta[m];
		for(int i=0; i<m; i++){
			sta[i] = station();
		}
		
		for(int i=0; i<n; i++){
			cin >> from;
			cin >> to;
			cin >> cost;
			cin >> time;
			sta[from-1].add_to(to-1, cost, time);
		}
		cin >> n;
		for(int i=0; i<n; i++){
			cin >> from;
			cin >> to;
			cin >> type;
			cout << dijkstra(sta, m, from-1, to-1, type) << endl;
			reset(sta, m);
		}
	}
	
	return 0;
}

int dijkstra(station* sta, int size, int start, int goal, int type)
{
	int to, cost;
	station done;
	vector<station> q;
	sta[start].cost = 0;
	q.push_back(sta[start]);
	
	while(!q.empty()){
		done = q[0];
		q.erase(q.begin());
		done.visited = true;
		
		for(int i=0; i<done.edge_to.size(); i++){
			to = done.edge_to[i];
			if(type==TYPE_COST) cost = done.cost + done.edge_cost[i];
			if(type==TYPE_TIME) cost = done.cost + done.edge_time[i];
			if(sta[to].cost < 0 || cost < sta[to].cost){
				sta[to].cost = cost;
				if(!contain(q, sta[to])){
					q.push_back(sta[to]);
				}
			}
		}	
	}
	
	return sta[goal].cost;
}

bool contain(vector<station> sta, station elem)
{
	int size = sta.size();
	bool is_match = false;
	for(int i=0; i<size; i++){
		if(memcmp(&sta[i], &elem, sizeof(station)) == 0){
			is_match = true;
			break;
		}
	}
	return is_match;
}

void reset(station* sta, int size)
{
	for(int i=0; i<size; i++){
		sta[i].visited = false;
		sta[i].cost = -1;
	}
}

Compiler output:
a.cc: In function 'bool contain(std::vector<station>, station)':
a.cc:99:20: error: 'memcmp' was not declared in this scope
   99 |                 if(memcmp(&sta[i], &elem, sizeof(station)) == 0){
      |                    ^~~~~~
a.cc:4:1: note: 'memcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <stdlib.h>
  +++ |+#include <cstring>
    4 |
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

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

#include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> P;
const int INF = 1 << 24;
int c[200][200];
int t[200][200];
int cost[200][200];
int tim[200][200];

int main(){
  int n, m, K;
  int p, q, r;
  while(cin >> n >> m && (n || m)){
    fill(&cost[0][0], &cost[199][199] + 1, INF);
    fill(&tim[0][0], &tim[199][199] + 1, INF);
    for(int i = 1; i <= m; i++){
      cost[i][i] = tim[i][i] = 0;
      c[i][i] = t[i][i] = 0;
    }

    for(int i = 0; i < n; i++){
      int a, b;
      int d, e;
      cin >> a >> b;
      cin >> d >> e;
      cost[b][a] = min(cost[b][a], d);
      cost[a][b] = min(cost[a][b], d);

Compiler output:
a.cc: In function 'int main()':
a.cc:29:39: error: expected '}' at end of input
   29 |       cost[a][b] = min(cost[a][b], d);
      |                                       ^
a.cc:23:31: note: to match this '{'
   23 |     for(int i = 0; i < n; i++){
      |                               ^
a.cc:29:39: error: expected '}' at end of input
   29 |       cost[a][b] = min(cost[a][b], d);
      |                                       ^
a.cc:15:35: note: to match this '{'
   15 |   while(cin >> n >> m && (n || m)){
      |                                   ^
a.cc:29:39: error: expected '}' at end of input
   29 |       cost[a][b] = min(cost[a][b], d);
      |                                       ^
a.cc:12:11: note: to match this '{'
   12 | int main(){
      |           ^
Language: C++

#include<cstdio>
#include<iostream>
#include<string>
#include<map>
#include<queue>
#include<set>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,n) for(int i=1;i<=n;i++)

int main(){
	while(1){
		int m,n;
		cin>>m>>n;
		if(m==0)break;
		
		int dp[2][111][111];
		
		rep(p,2){
			rep(i,111){
				rep(j,111){
					dpc[p][i][j]=dpt[p][i][j]=1000000000;
				}
				dpc[p][i][i]=dpt[p][i][i]=0;
			}
		}
		
		rep(i,m){
			int a,b,c,t;
			cin>>a>>b>>c>>t;
			
			dp[0][a][b]=c;
			dp[1][a][b]=t;
		}
		
		rep(p,2){
			rep(k,n){
				rep(i,n){
					rep(j,n){
						dp[p][i][j] = min(dp[p][i][j],dp[p][i][k]+dp[p][k][j]);
					}
				}
			}
		}
		
		int T;
		cin>>T;
		rep(i,T){
			int a,b,c;
			cin>>a>>b>>c;
			printf("%d\n",dp[c][a][b]);
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:41: error: 'dpc' was not declared in this scope; did you mean 'dp'?
   24 |                                         dpc[p][i][j]=dpt[p][i][j]=1000000000;
      |                                         ^~~
      |                                         dp
a.cc:24:54: error: 'dpt' was not declared in this scope; did you mean 'dp'?
   24 |                                         dpc[p][i][j]=dpt[p][i][j]=1000000000;
      |                                                      ^~~
      |                                                      dp
a.cc:26:33: error: 'dpc' was not declared in this scope; did you mean 'dp'?
   26 |                                 dpc[p][i][i]=dpt[p][i][i]=0;
      |                                 ^~~
      |                                 dp
a.cc:26:46: error: 'dpt' was not declared in this scope; did you mean 'dp'?
   26 |                                 dpc[p][i][i]=dpt[p][i][i]=0;
      |                                              ^~~
      |                                              dp
Language: C++

#include<cstdio>

int costs[100][100][2];

int main(){
 int n,m,a,b;
 scanf("%d%d",&n,&m);
 while(n--){
  scanf("%d%d",&a,&b);
  scanf("%d%d",&costs[a][b][0],&costs[a][b][1]);
  costs[b][a][0]=costs[a][b][0];
  costs[b][a][1]=costs[a][b][1];
 }
 for(int i=0;i<m;i++){
  for(int j=0;j<m;j++){
   for(int k=0;k<m;k++){
    costs[i][j][0]=costs[i][k][0]+costs[k][j][0];
    costs[j][i][0]=costs[i][j][0];
    costs[i][j][1]=costs[i][k][1]+costs[k][j][1];
    costs[j][i][1]=costs[i][j][1];
   }
  }
 }
 scanf("%d",&n);
 while(n--){
 scanf("%d&d&d",&a,&b,&k);
 printf("%d\n",costs[a][b][k]);
}
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:24: error: 'k' was not declared in this scope
   26 |  scanf("%d&d&d",&a,&b,&k);
      |                        ^
Language: C++

#include<iostream>
#include<cstring>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define INF 300000

struct E
{
    int a,b,c,t;
    E(){};
    E(int a,int b,int c,int t):a(a),b(b),c(c),t(t){};
};
//E cs[700];
unsigned int d[150];

int main()
{
    int n,m,k,p,q,r;
    while(cin >> n >> m)
    {
        if(n==0 && m==0)break;
        vector<E> cs;   
        int ta,tb,tc,tt;
        rep(i,n)
        {
            cin >> ta>>tb>>tc >>tt;
            cs.push_back =( E(ta,tb,tc,tt));
            cs.push_back( E(tb,ta,tc,tt));
        }

        cin >> k;
        rep(i,k)
        {
            memset(d,INF,150*sizeof(int));
            cin >> p >> q >>r;
            d[p] = 0;

            bool update = false;
            if(r==0)while(true)
            {
                update = false;
                rep(j,m*2)
                {
                   if(d[cs[j].a] != INF && d[cs[j].b] > d[cs[j].a] + cs[j].c)
                   {
                       update = true;
                       d[cs[j].b] =  d[cs[j].a] + cs[j].c;
                   }
                }
                if(!update) break;
            }
            if(r==1)while(true)
            {
                update = false;
                rep(j,m*2)
                {
                   if(d[cs[j].a] != INF && d[cs[j].b] > d[cs[j].a] + cs[j].t)
                   {
                       update = true;
                       d[cs[j].b] =  d[cs[j].a] + cs[j].t;
                   }
                }
                if(!update) break;
            }
            cout << d[q] << endl;
        }
        
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:16: error: invalid use of member function 'std::vector<E>::push_back' (did you forget the '()' ?)
   28 |             cs.push_back =( E(ta,tb,tc,tt));
      |             ~~~^~~~~~~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;

int cost[101][101];
int gtime[101][101];

struct tSta{
	int val, sta;
	tSta( int s ){
		val = 0;
		sta = s;
	}
};

bool operator<( const tSta& l, const tSta& r ){
	return l.val > r.val;
}

int main(){
	priority_queue<tSta> que;
	int n, m, k;
	while( cin >> n >> m, n||m ){
		memset( cost, 0, sizeof(cost) );
		memset( gtime, 0, sizeof(gtime) );
		for( int i=0; i<n; i++ ){
			int a, b, c, t;
			cin >> a >> b >> c >> t;
			cost[a][b] = cost[b][a] = c;
			gtime[a][b] = gtime[b][a] = t;
		}
		cin >> k;
		for( int i=0; i<k; i++ ){
			int p, q, r;
			cin >> p >> q >> r;
			while( !que.empty() )	que.pop();
			que.push( tSta(p) );
			while( !que.empty() ){
				tSta ts = que.top();
				if( ts.sta == q )	break;
				que.pop();
				if( r==0 ){	// cost
					for( int j=1; j<=m; j++ ){
						if( cost[ts.sta][j] > 0 ){
							tSta next(j);
							next.val = ts.val + cost[ts.sta][j];
							que.push( next );
						}
					}
				}else if( r==1 ){	// time
					for( int j=1; j<=m; j++ ){
						if( gtime[ts.sta][j] > 0 ){
							tSta next(j);
							next.sta = j;
							next.val = ts.val + gtime[ts.sta][j];
							que.push( next );
						}
					}
				}
			}
			cout << que.top().val << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:17: error: 'memset' was not declared in this scope
   25 |                 memset( cost, 0, sizeof(cost) );
      |                 ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<queue>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)

const int INF = 1<<28, MAXM = 101, COST = 0, TIME = 1;

int cost[2][MAXM][MAXM];

int main()
{
    int n, m, a, b, c, t;
    while(cin >> n >> m)
    {
        REP(2)rep(j,m)rep(k,m)cost[i][j][k] = INF;
        //fill(cost, sizeof(cost), INF);
        REP(n)
        {
            cin >> a >> b >> c >> t;
            a--; b--;
            cost[TIME][a][b] = cost[TIME][b][a] = t;
            cost[COST][a][b] = cost[COST][b][a] = c;
        }

        int k;
        cin >> k;
        int p, q, r;
        rep(s,k)
        {
            cin >> p >> q >> r; p--; q--;

            memset(d, INF , sizeof(d));
            //rep(i,m)rep(j,m) d[i][j] = cost[r][i][j];

            rep(l,m)rep(i,m)rep(j,m)
            {
                cost[TIME][i][j] = min(cost[TIME][i][j], cost[TIME][i][l] + cost[TIME][l][j]);
                cost[COST][i][j] = min(cost[COST][i][j], cost[COST][i][l] + cost[COST][l][j]);
            }
            cout << cost[r][p][q] << endl;

        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:20: error: 'd' was not declared in this scope
   37 |             memset(d, INF , sizeof(d));
      |                    ^
Language: C++

#include<stdio.h>

int dijkstra(short int,short int,short int,short int,short int**);

int main(void)
{
	short int f1, f2, n, m, a, b, ic, ti, k, p, q, r, out, **cost, **time;

	while(scanf("%d %d",&n,&m) && n > 0)
	{

		cost = new int *[m];
		time = new int *[n];
		//線路設計
		for(f1 = 0; f1 < n; f1++)
		{
			cost[f1] = new int [m];
			time[f1] = new int [m];
			for(f2 = 0; f2 < m; f2++)
			{
				cost[f1][f2] = 0;
				time[f1][f2] = 0;
			}
		}
		//線路情報入力
		for(f1 = 0; f1 < n; f1++)
		{
			scanf("%d %d %d %d",&a, &b, &ic, &ti);
			a--;
			b--;
			cost[a][b] = ic;
			cost[b][a] = ic;
			time[a][b] = ti;
			time[b][a] = ti;
		}
		//問い合わせ入力
		scanf("%d",&k);
		for(f1 = 1; f1 <= k; f1++)
		{
			scanf("%d %d %d",&p, &q, &r);
			p--;
			q--;
			if(r == 0)
				out = dijkstra(n, m, p, q, cost);
			else
				out = dijkstra(n, m, p, q, time);

			printf("%d\n",out);
		}
	}
	return 0;
}

int dijkstra(int n, int m, int p, int q, int **temp)
{
	int *C, *sum, f1, po = p, min;
	//Cの中身　0：出発していない　1：出発した
	C = new int [m];
	sum = new int [m];
	//初期化
	for(f1 = 0; f1 < m; f1++)
	{
		C[f1] = 0;
		sum[f1] = 0;
	}
	//ダイクストラ探索
	while(po != q)
	{
		//現在いる地点から次の駅までにかかるコストを計算し次に行く駅の現時点での最小コストを求める
		for(f1 = 0; f1 < m; f1++)
		{
			if(temp[po][f1] > 0)
			{
				if(C[f1] == 0 && (sum[f1] == 0 || temp[po][f1] + sum[po] < sum[f1]))
					sum[f1] = temp[po][f1] + sum[po];
			}
		}
		//出発していない駅の中で最小コストを選択する
		min = 0;
		C[po] = 1;
		for(f1 = 0; f1 < m; f1++)
		{
			if(C[f1] == 0 && sum[f1] != 0 && (min == 0 || sum[f1] < min))
			{
				min = sum[f1];
				po = f1;
			}
		}
	}
	return sum[q];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:24: error: cannot convert 'int**' to 'short int**' in assignment
   12 |                 cost = new int *[m];
      |                        ^~~~~~~~~~~~
      |                        |
      |                        int**
a.cc:13:24: error: cannot convert 'int**' to 'short int**' in assignment
   13 |                 time = new int *[n];
      |                        ^~~~~~~~~~~~
      |                        |
      |                        int**
a.cc:17:36: error: cannot convert 'int*' to 'short int*' in assignment
   17 |                         cost[f1] = new int [m];
      |                                    ^~~~~~~~~~~
      |                                    |
      |                                    int*
a.cc:18:36: error: cannot convert 'int*' to 'short int*' in assignment
   18 |                         time[f1] = new int [m];
      |                                    ^~~~~~~~~~~
      |                                    |
      |                                    int*
Language: C++

#include<stdio.h>

int dijkstra(short int,short int,short int,short int,short int**);

int main(void)
{
	short int f1, f2, n, m, a, b, ic, ti, k, p, q, r, out, **cost, **time;

	while(scanf("%d %d",&n,&m) && n > 0)
	{

		cost = new int *[m];
		time = new int *[n];
		//線路設計
		for(f1 = 0; f1 < n; f1++)
		{
			cost[f1] = new int [m];
			time[f1] = new int [m];
			for(f2 = 0; f2 < m; f2++)
			{
				cost[f1][f2] = 0;
				time[f1][f2] = 0;
			}
		}
		//線路情報入力
		for(f1 = 0; f1 < n; f1++)
		{
			scanf("%d %d %d %d",&a, &b, &ic, &ti);
			a--;
			b--;
			cost[a][b] = ic;
			cost[b][a] = ic;
			time[a][b] = ti;
			time[b][a] = ti;
		}
		//問い合わせ入力
		scanf("%d",&k);
		for(f1 = 1; f1 <= k; f1++)
		{
			scanf("%d %d %d",&p, &q, &r);
			p--;
			q--;
			if(r == 0)
				out = dijkstra(n, m, p, q, cost);
			else
				out = dijkstra(n, m, p, q, time);

			printf("%d\n",out);
		}
	}
	return 0;
}

int dijkstra(short int n,short int m,short int p,short int q,short int **temp)
{
	int *C, *sum, f1, po = p, min;
	//Cの中身　0：出発していない　1：出発した
	C = new int [m];
	sum = new int [m];
	//初期化
	for(f1 = 0; f1 < m; f1++)
	{
		C[f1] = 0;
		sum[f1] = 0;
	}
	//ダイクストラ探索
	while(po != q)
	{
		//現在いる地点から次の駅までにかかるコストを計算し次に行く駅の現時点での最小コストを求める
		for(f1 = 0; f1 < m; f1++)
		{
			if(temp[po][f1] > 0)
			{
				if(C[f1] == 0 && (sum[f1] == 0 || temp[po][f1] + sum[po] < sum[f1]))
					sum[f1] = temp[po][f1] + sum[po];
			}
		}
		//出発していない駅の中で最小コストを選択する
		min = 0;
		C[po] = 1;
		for(f1 = 0; f1 < m; f1++)
		{
			if(C[f1] == 0 && sum[f1] != 0 && (min == 0 || sum[f1] < min))
			{
				min = sum[f1];
				po = f1;
			}
		}
	}
	return sum[q];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:24: error: cannot convert 'int**' to 'short int**' in assignment
   12 |                 cost = new int *[m];
      |                        ^~~~~~~~~~~~
      |                        |
      |                        int**
a.cc:13:24: error: cannot convert 'int**' to 'short int**' in assignment
   13 |                 time = new int *[n];
      |                        ^~~~~~~~~~~~
      |                        |
      |                        int**
a.cc:17:36: error: cannot convert 'int*' to 'short int*' in assignment
   17 |                         cost[f1] = new int [m];
      |                                    ^~~~~~~~~~~
      |                                    |
      |                                    int*
a.cc:18:36: error: cannot convert 'int*' to 'short int*' in assignment
   18 |                         time[f1] = new int [m];
      |                                    ^~~~~~~~~~~
      |                                    |
      |                                    int*
Language: C++

#include<stdio.h>

short int dijkstra(short int,short int,short int,short int,short int**);

int main(void)
{
	short int f1, f2, n, m, a, b, ic, ti, k, p, q, r, out, **cost, **time;

	while(scanf("%d %d",&n,&m) && n > 0)
	{

		cost = new short int *[m];
		time = new short int *[n];
		//線路設計
		for(f1 = 0; f1 < n; f1++)
		{
			cost[f1] = new short int [m];
			time[f1] = new short int [m];
			for(f2 = 0; f2 < m; f2++)
			{
				cost[f1][f2] = 0;
				time[f1][f2] = 0;
			}
		}
		//線路情報入力
		for(f1 = 0; f1 < n; f1++)
		{
			scanf("%d %d %d %d",&a, &b, &ic, &ti);
			a--;
			b--;
			cost[a][b] = ic;
			cost[b][a] = ic;
			time[a][b] = ti;
			time[b][a] = ti;
		}
		//問い合わせ入力
		scanf("%d",&k);
		for(f1 = 1; f1 <= k; f1++)
		{
			scanf("%d %d %d",&p, &q, &r);
			p--;
			q--;
			if(r == 0)
				out = dijkstra(n, m, p, q, cost);
			else
				out = dijkstra(n, m, p, q, time);

			printf("%d\n",out);
		}
	}
	return 0;
}

short int dijkstra(short int n,short int m,short int p,short int q,short int **temp)
{
	short int *C, *sum, f1, po = p, min;
	//Cの中身　0：出発していない　1：出発した
	C = new int [m];
	sum = new int [m];
	//初期化
	for(f1 = 0; f1 < m; f1++)
	{
		C[f1] = 0;
		sum[f1] = 0;
	}
	//ダイクストラ探索
	while(po != q)
	{
		//現在いる地点から次の駅までにかかるコストを計算し次に行く駅の現時点での最小コストを求める
		for(f1 = 0; f1 < m; f1++)
		{
			if(temp[po][f1] > 0)
			{
				if(C[f1] == 0 && (sum[f1] == 0 || temp[po][f1] + sum[po] < sum[f1]))
					sum[f1] = temp[po][f1] + sum[po];
			}
		}
		//出発していない駅の中で最小コストを選択する
		min = 0;
		C[po] = 1;
		for(f1 = 0; f1 < m; f1++)
		{
			if(C[f1] == 0 && sum[f1] != 0 && (min == 0 || sum[f1] < min))
			{
				min = sum[f1];
				po = f1;
			}
		}
	}
	return sum[q];
}

Compiler output:
a.cc: In function 'short int dijkstra(short int, short int, short int, short int, short int**)':
a.cc:58:13: error: cannot convert 'int*' to 'short int*' in assignment
   58 |         C = new int [m];
      |             ^~~~~~~~~~~
      |             |
      |             int*
a.cc:59:15: error: cannot convert 'int*' to 'short int*' in assignment
   59 |         sum = new int [m];
      |               ^~~~~~~~~~~
      |               |
      |               int*
Language: C++

#include<cstdio>
#include<algorithm>

using namespace std;




int main()
{
	while(true)
	{
int timedate[2][105][105];
int n,m;
    memset(timedate,0,sizeof(timedate));
	scanf("%d%d",&n,&m);
	if(n==0&&m==0)break;
	int a, b, cost,time;
	for(int i=0;i<n;i++)
	{
		scanf("%d%d%d%d",&a,&b,&cost,&time);
		timedate[0][a][b]=cost;
		timedate[0][b][a]=cost;
		timedate[1][a][b]=time;
		timedate[1][b][a]=time;
	}
	int k;
	scanf("%d",&k);
	for(int i=0;i<k;i++)
	{
		int p,q,r;
		int date[105];
		int omin=1000000,jmin;
		fill(date,date+100,-1);
		scanf("%d%d%d",&p,&q,&r);
		date[p]=0;
		
			for(int u=1;u<100;u++)
			{
			omin=1000000;
			jmin=0;
		for(int j=1;j<100;j++)
		{
			if(date[j]!=-1)
			{
				for(int o=1;o<101;o++)
				{
					if(timedate[r][j][o]!=0&&o!=-1&&omin>date[j]+timedate[r][j][o]&&date[o]==-1)
					{
						omin=date[j]+timedate[r][j][o];
						jmin=o;
					}
				}
			}
		}
		date[jmin]=omin;
			}
		printf("%d\n",date[q]);
	}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'memset' was not declared in this scope
   15 |     memset(timedate,0,sizeof(timedate));
      |     ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<algorithm>
  +++ |+#include <cstring>
    3 |