Language: C++

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

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:11:9: error: 'vector' was not declared in this scope
   11 |         vector<pair<int,int> > ten[100];
      |         ^~~~~~
a.cc:11:9: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:11:16: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   11 |         vector<pair<int,int> > ten[100];
      |                ^~~~
      |                std::pair
In file included from /usr/include/c++/14/string:48,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_iterator.h:3013:12: note: 'std::pair' declared here
 3013 |     struct pair;
      |            ^~~~
a.cc:11:21: error: expected primary-expression before 'int'
   11 |         vector<pair<int,int> > ten[100];
      |                     ^~~
a.cc:33:17: error: 'priority_queue' was not declared in this scope
   33 |                 priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q;
      |                 ^~~~~~~~~~~~~~
a.cc:33:37: error: expected primary-expression before 'int'
   33 |                 priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q;
      |                                     ^~~
a.cc:34:17: error: 'q' was not declared in this scope
   34 |                 q.push(make_pair(0,a));
      |                 ^
a.cc:34:24: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   34 |                 q.push(make_pair(0,a));
      |                        ^~~~~~~~~
      |                        std::make_pair
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
a.cc:44:46: error: 'ten' was not declared in this scope
   44 |                         for(int ii = 0; ii < ten[q.top().second].size(); ii++)
      |                                              ^~~
a.cc:66:17: error: 'ten' was not declared in this scope
   66 |                 ten[a].push_back(make_pair(b,c));
      |                 ^~~
a.cc:66:34: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   66 |                 ten[a].push_back(make_pair(b,c));
      |                                  ^~~~~~~~~
      |                                  std::make_pair
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~