Language: C++

#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

// O(|V||E|)
struct edge {int from, to, cost;};
bool Bellman_Ford(int V, int E, int s, edge es[], LL dist[]) {
    fill(dist, dist + V, LLINF);
    dist[s] = 0;
    int cnt = 0;
    while (true) {
        bool update = false;
        VI v;
        for (int i = 0; i < E; ++i) {
            bool f = (dist[es[i].from] != LLINF && chmin(dist[es[i].to], dist[es[i].from] + es[i].cost));
            if (f) v.EB(es[i].to);
            update |= f;
        }
        if (!update) break;
        if (cnt == V - 1) {
            FORE(e, v) if (e = v - 1) return true;
            break;
        }
        ++cnt;
    }
    return false;
}

const int MAX_N = 1010;
const int MAX_M = 2020;
int N, M;
edge e[MAX_M];

int main(void) {
    scanf("%d%d", &N, &M);
    REP(i, M) {
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c);
        e[i] = {a - 1, b - 1, -c};
    }
    vector<LL> dist(N);
    if (Bellman_Ford(N, M, 0, e, dist.data())) {
        cout << "inf" << endl;
        DEBUG(-dist[N - 1])
    } else cout << -dist[N - 1] << endl;
}


Compiler output:
a.cc: In function 'bool Bellman_Ford(int, int, int, edge*, LL*)':
a.cc:79:34: error: no match for 'operator-' (operand types are 'VI' {aka 'std::vector<int>'} and 'int')
   79 |             FORE(e, v) if (e = v - 1) return true;
      |                                ~ ^ ~
      |                                |   |
      |                                |   int
      |                                VI {aka std::vector<int>}
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:1:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  618 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note:   template argument deduction/substitution failed:
a.cc:79:36: note:   'VI' {aka 'std::vector<int>'} is not derived from 'const std::reverse_iterator<_Iterator>'
   79 |             FORE(e, v) if (e = v - 1) return true;
      |                                    ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1790 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note:   template argument deduction/substitution failed:
a.cc:79:36: note:   'VI' {aka 'std::vector<int>'} is not derived from 'const std::move_iterator<_IteratorL>'
   79 |             FORE(e, v) if (e = v - 1) return true;
      |                                    ^
In file included from a.cc:8:
/usr/include/c++/14/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const complex<_Tp>&)'
  370 |     operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:370:5: note:   template argument deduction/substitution failed:
a.cc:79:36: note:   'VI' {aka 'std::vector<int>'} is not derived from 'const std::complex<_Tp>'
   79 |             FORE(e, v) if (e = v - 1) return true;
      |                                    ^
/usr/include/c++/14/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const _Tp&)'
  379 |     operator-(const complex<_Tp>& __x, const _Tp& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:379:5: note:   template argument deduction/substitution failed:
a.cc:79:36: note:   'VI' {aka 'std::vector<int>'} is not derived from 'const std::complex<_Tp>'
   79 |             FORE(e, v) if (e = v - 1) return true;
      |                                    ^
/usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)'
  388 |     operator-(const _Tp& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:388:5: note:   template argument deduction/substitution failed:
a.cc:79:36: note:   mismatched types 'const std::complex<_Tp>' and 'int'
   79 |             FORE(e, v) if (e = v - 1) return true;
      |                                    ^
/usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)'
  465 |     operator-(const complex<_Tp>& __x)
      |     ^~~~~~~~
/usr/include/c++/14/complex:465:5: note:   candidate expects 1 argument, 2 provided