Language: C++

#include "stdio.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
    while(1)
    {
        vector<pair<int,int> > ten[100];
        int n,k;
        scanf("%d %d",&n,&k);
        if(n == 0 && k == 0)
        {
            break;
        }
        for(int i = 0; i < k; i++)
        {
            int w;
            scanf("%d",&w);
            if(w == 0)
            {
                int a,b;
                scanf("%d %d",&a,&b);
                a--;
                b--;
                int e[100];
                for(int i = 0; i < n; i++)
                {
                    e[i] = (2e9);
                }
                priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q;
                q.push(make_pair(0,a));
                while(q.size() > 0)
                {
                    if(e[q.top().second] > q.top().first)
                    {
                        e[q.top().second] = q.top().first;
                        if(q.top().second == b)
                        {
                            break;
                        }
                        for(int ii = 0; ii < ten[q.top().second].size(); ii++)
                        {
                            q.push(make_pair(q.top().first + ten[q.top().second][ii].second,ten[q.top().second][ii].first));
                        }
                    }
                    q.pop();
                }
                if(e[b] == (2e9))
                {
                    printf("-1\n");
                }
                else
                {
                    printf("%d\n",e[b]);
                }
            }
            else
            {
                int a,b,c;
                scanf("%d %d %d",&a,&b,&c);
                a--;
                b--;
                ten[a].push_back(make_pair(b,c));
                ten[b].push_back(make_pair(a,c));
            }
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:17: error: 'priority_queue' was not declared in this scope
   35 |                 priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q;
      |                 ^~~~~~~~~~~~~~
a.cc:6:1: note: 'std::priority_queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>'
    5 | #include <functional>
  +++ |+#include <queue>
    6 | 
a.cc:35:45: error: expected primary-expression before ',' token
   35 |                 priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q;
      |                                             ^
a.cc:35:68: error: expected primary-expression before ',' token
   35 |                 priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q;
      |                                                                    ^
a.cc:35:93: error: expected primary-expression before '>' token
   35 |                 priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q;
      |                                                                                             ^
a.cc:35:95: error: 'q' was not declared in this scope
   35 |                 priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q;
      |                                                                                               ^