Language: C++

#include <queue>
#include <stdint.h>
#include <vector>

typedef void (*single_source_shortest_path_callback_t)(int32_t index, int32_t weight);

#define GRAPH_MAX_SIZE 10000
enum color_t { WHITE, GRAY, BLACK };

static int32_t weights[GRAPH_MAX_SIZE];
static color_t colors[GRAPH_MAX_SIZE];

bool single_source_shortest_path(vector<pair<int32_t, int32_t>> *graph, size_t size, single_source_shortest_path_callback_t callback)
{
  if ((graph == nullptr) || (size == 0)) return false;

  int32_t i;
  for (i = 0; i < GRAPH_MAX_SIZE; i++) {
    weights[i] = INT32_MAX;
    colors[i] = WHITE;
  }

  weights[0] = 0;
  priority_queue<pair<int32_t, int32_t>> que;
  que.push(make_pair(-1 * weights[0], 0));

  while (!que.empty()) {
    pair<int, int> top = que.top();
    que.pop();
    int32_t top_index = top.second;
    int32_t top_weights = (-1) * top.first;
    if (top_weights > weights[top_index]) continue;

    callback(top_index, top_weights);
    colors[top_index] = BLACK;

    vector<pair<int32_t, int32_t>> vertex = graph[top_index];
    for (auto connect_to = vertex.begin(); connect_to != vertex.end(); connect_to++) {
      int32_t index = (*connect_to).first;
      if (colors[index] != BLACK) {
        int32_t new_weight = weights[top_index] + (*connect_to).second;

        if (new_weight < weights[index]) {
          weights[index] = new_weight;
          colors[index] = GRAY;
          que.push(make_pair(-1 * weights[index], index));
        }
      }
    }
  }
  return true;
}

#if !defined(TEST)
static vector<pair<int32_t, int32_t>> graph[GRAPH_MAX_SIZE];
static int32_t routes[GRAPH_MAX_SIZE];

void callback(int32_t index, int32_t weight)
{
  routes[index] = weight;
}

int32_t main(void)
{
  int32_t num;
  scanf("%d", &num);

  uint32_t i;
  for (i = 0; i < num; i++) {
    int32_t index, len;
    scanf("%d", &index);
    scanf("%d", &len);
    uint32_t j;
    for (j = 0; j < len; j++) {
      int32_t k, v;
      scanf("%d %d", &k, &v);
      graph[i].push_back(make_pair(k, v));
    }
  }
  single_source_shortest_path(graph, num, callback);

  for (i = 0; i < num; i++) {
    printf("%d %d\n", i, routes[i]);
  }

  return 0;
}
#endif

Compiler output:
a.cc:13:34: error: 'vector' was not declared in this scope
   13 | bool single_source_shortest_path(vector<pair<int32_t, int32_t>> *graph, size_t size, single_source_shortest_path_callback_t callback)
      |                                  ^~~~~~
a.cc:13:34: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/queue:63,
                 from a.cc:1:
/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:13:41: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   13 | bool single_source_shortest_path(vector<pair<int32_t, int32_t>> *graph, size_t size, single_source_shortest_path_callback_t callback)
      |                                         ^~~~
      |                                         std::pair
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/deque:62,
                 from /usr/include/c++/14/queue:62:
/usr/include/c++/14/bits/stl_pair.h:89:12: note: 'std::pair' declared here
   89 |     struct pair;
      |            ^~~~
a.cc:13:53: error: expected primary-expression before ',' token
   13 | bool single_source_shortest_path(vector<pair<int32_t, int32_t>> *graph, size_t size, single_source_shortest_path_callback_t callback)
      |                                                     ^
a.cc:13:62: error: expected primary-expression before '>>' token
   13 | bool single_source_shortest_path(vector<pair<int32_t, int32_t>> *graph, size_t size, single_source_shortest_path_callback_t callback)
      |                                                              ^~
a.cc:13:66: error: 'graph' was not declared in this scope
   13 | bool single_source_shortest_path(vector<pair<int32_t, int32_t>> *graph, size_t size, single_source_shortest_path_callback_t callback)
      |                                                                  ^~~~~
a.cc:13:80: error: expected primary-expression before 'size'
   13 | bool single_source_shortest_path(vector<pair<int32_t, int32_t>> *graph, size_t size, single_source_shortest_path_callback_t callback)
      |                                                                                ^~~~
a.cc:13:125: error: expected primary-expression before 'callback'
   13 | bool single_source_shortest_path(vector<pair<int32_t, int32_t>> *graph, size_t size, single_source_shortest_path_callback_t callback)
      |                                                                                                                             ^~~~~~~~
a.cc:13:133: error: expression list treated as compound expression in initializer [-fpermissive]
   13 | bool single_source_shortest_path(vector<pair<int32_t, int32_t>> *graph, size_t size, single_source_shortest_path_callback_t callback)
      |                                                                                                                                     ^
a.cc:55:8: error: 'vector' does not name a type
   55 | static vector<pair<int32_t, int32_t>> graph[GRAPH_MAX_SIZE];
      |        ^~~~~~
a.cc: In function 'int32_t main()':
a.cc:66:3: error: 'scanf' was not declared in this scope
   66 |   scanf("%d", &num);
      |   ^~~~~
a.cc:77:7: error: 'graph' was not declared in this scope
   77 |       graph[i].push_back(make_pair(k, v));
      |       ^~~~~
a.cc:77:26: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   77 |       graph[i].push_back(make_pair(k, v));
      |                          ^~~~~~~~~
      |                          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)
      |     ^~~~~~~~~
a.cc:80:31: error: 'graph' was not declared in this scope
   80 |   single_source_shortest_path(graph, num, callback);
      |                               ^~~~~
a.cc:80:30: error: 'single_source_shortest_path' cannot be used as a function
   80 |   single_source_shortest_path(graph, num, callback);
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
a.cc:83:5: error: 'printf' was not declared in this scope
   83 |     printf("%d %d\n", i, routes[i]);
      |     ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 | #include <stdint.h>
  +++ |+#include <cstdio>
    3 | #include <vector>