Language: C++

// dijkstra

struct weight {
  int to,cost;
};

vector<vector<weight>> g;
vi d;

void dijkstra(int s) {
  d.at(s) = 0;
  priority_queue<P,vector<P>,greater<P>> que;
  que.push(P(0,s));
  while(que.size()) {
    P p = que.top();que.pop();
    int nowd = p.fi;
    int edgeNum = p.se;
    if(d.at(edgeNum) < nowd) continue;
    rep(i,g.at(edgeNum).size()) {
      weight w = g.at(edgeNum).at(i);
      if(d.at(w.to) > nowd + w.cost) {
        d.at(w.to) = nowd + w.cost;
        que.push(P(d.at(w.to),w.to));
      }
    }
  }
}

const int INF = 1001001001;
int main() {
  int n,m;cin >> n >> m;

  g = vector<vector<weight>>(n,vector<weight>());
  rep(i,m) {
    int a,b,t;
    t = 1;
    cin >> a >> b;
    a--;b--;
    g.at(a).eb(weight{b,t});
    g.at(b).eb(weight{a,t});
  }
  int ans = 0;
  rep(i,n) {
    d = vi(n,INF);
    dijkstra(i);
    rep(j,d.size()) if(d.at(j) != INF) ans = max(ans,d.at(j));
  }
  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc:7:1: error: 'vector' does not name a type
    7 | vector<vector<weight>> g;
      | ^~~~~~
a.cc:8:1: error: 'vi' does not name a type; did you mean 'void'?
    8 | vi d;
      | ^~
      | void
a.cc: In function 'void dijkstra(int)':
a.cc:11:3: error: 'd' was not declared in this scope
   11 |   d.at(s) = 0;
      |   ^
a.cc:12:3: error: 'priority_queue' was not declared in this scope
   12 |   priority_queue<P,vector<P>,greater<P>> que;
      |   ^~~~~~~~~~~~~~
a.cc:12:18: error: 'P' was not declared in this scope
   12 |   priority_queue<P,vector<P>,greater<P>> que;
      |                  ^
a.cc:12:20: error: 'vector' was not declared in this scope
   12 |   priority_queue<P,vector<P>,greater<P>> que;
      |                    ^~~~~~
a.cc:12:29: error: expected primary-expression before ',' token
   12 |   priority_queue<P,vector<P>,greater<P>> que;
      |                             ^
a.cc:12:30: error: 'greater' was not declared in this scope
   12 |   priority_queue<P,vector<P>,greater<P>> que;
      |                              ^~~~~~~
a.cc:12:42: error: 'que' was not declared in this scope
   12 |   priority_queue<P,vector<P>,greater<P>> que;
      |                                          ^~~
a.cc:15:6: error: expected ';' before 'p'
   15 |     P p = que.top();que.pop();
      |      ^~
      |      ;
a.cc:16:16: error: 'p' was not declared in this scope
   16 |     int nowd = p.fi;
      |                ^
a.cc:19:9: error: 'i' was not declared in this scope
   19 |     rep(i,g.at(edgeNum).size()) {
      |         ^
a.cc:19:11: error: 'g' was not declared in this scope
   19 |     rep(i,g.at(edgeNum).size()) {
      |           ^
a.cc:19:5: error: 'rep' was not declared in this scope
   19 |     rep(i,g.at(edgeNum).size()) {
      |     ^~~
a.cc: In function 'int main()':
a.cc:31:11: error: 'cin' was not declared in this scope
   31 |   int n,m;cin >> n >> m;
      |           ^~~
a.cc:33:3: error: 'g' was not declared in this scope
   33 |   g = vector<vector<weight>>(n,vector<weight>());
      |   ^
a.cc:33:7: error: 'vector' was not declared in this scope
   33 |   g = vector<vector<weight>>(n,vector<weight>());
      |       ^~~~~~
a.cc:33:27: error: expected primary-expression before '>>' token
   33 |   g = vector<vector<weight>>(n,vector<weight>());
      |                           ^~
a.cc:33:45: error: expected primary-expression before '>' token
   33 |   g = vector<vector<weight>>(n,vector<weight>());
      |                                             ^
a.cc:33:47: error: expected primary-expression before ')' token
   33 |   g = vector<vector<weight>>(n,vector<weight>());
      |                                               ^
a.cc:34:7: error: 'i' was not declared in this scope
   34 |   rep(i,m) {
      |       ^
a.cc:34:3: error: 'rep' was not declared in this scope
   34 |   rep(i,m) {
      |   ^~~
a.cc:48:3: error: 'cout' was not declared in this scope
   48 |   cout << ans << endl;
      |   ^~~~
a.cc:48:18: error: 'endl' was not declared in this scope
   48 |   cout << ans << endl;
      |                  ^~~~