Language: C++

#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

const int MAX_N = 10000;
const int MAX_E = 10000;
struct edge{ ll from, to, cost; };
edge es[MAX_E]; //辺
ll d[MAX_N]; //最短距離
ll n,m,p; //頂点数、辺数

bool bellmanford(int s){
    rep(i,n) d[i] = INF;
    d[0] = 0;
    rep(i,n){
        bool update = false;
        rep(j,m){
            edge e = es[j];
            if (d[e.from] == INF) continue;
            if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost){
                d[e.to] = d[e.from] + e.cost;
                update = true;
            }
        }
        if (!update) break;
    }

    bool negative[MAX_N];
    rep(i,n) negative[i] = false;
    rep(i,n) {
        rep(j,m){
            edge e = es[j];
            if (d[e.from] == INF) continue;
            if (d[e.to] > d[e.from] + e.cost){
                d[e.to] = d[e.from] + e.cost;
                negative[e.to] = true;
            if (negative[e.from]) negative[e.to] = true;
            }
        }
    }
    if (negative[n-1]) return false;
    return true;
}

void solve(){
    cin >> n >> m >> p;
    rep(i,m){
        int a,b,c;
        cin >> a >> b >> c;
        es[i]=edge{a-1,b-1,p-c};
    }
    bool t=bellmanford(0);
    if (!t) cout << -1 << endl;
    else cout << max((ll)0,-1*d[n-1]) << endl;

}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
}

Compiler output:
a.cc:17:9: error: 'complex' does not name a type
   17 | typedef complex<ld> Point;
      |         ^~~~~~~
a.cc:19:15: error: 'acos' was not declared in this scope
   19 | const ld pi = acos(-1.0);
      |               ^~~~
a.cc: In function 'void solve()':
a.cc:63:5: error: 'cin' was not declared in this scope
   63 |     cin >> n >> m >> p;
      |     ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<utility>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:70:13: error: 'cout' was not declared in this scope
   70 |     if (!t) cout << -1 << endl;
      |             ^~~~
a.cc:70:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:70:27: error: 'endl' was not declared in this scope
   70 |     if (!t) cout << -1 << endl;
      |                           ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<utility>
  +++ |+#include <ostream>
    3 | using namespace std;
a.cc:71:10: error: 'cout' was not declared in this scope
   71 |     else cout << max((ll)0,-1*d[n-1]) << endl;
      |          ^~~~
a.cc:71:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:71:42: error: 'endl' was not declared in this scope
   71 |     else cout << max((ll)0,-1*d[n-1]) << endl;
      |                                          ^~~~
a.cc:71:42: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc: In function 'int main()':
a.cc:76:5: error: 'ios' has not been declared
   76 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:77:5: error: 'cin' was not declared in this scope
   77 |     cin.tie(0);
      |     ^~~
a.cc:77:5: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'