Language: C++

    #include <bits/stdc++.h>
    #define hell                         1000000007 
    #define M                            1000000007
    #define Maxi                      10000000000000000
        #define lcm(a,b)                     (a*b)/__gcd(a,b)
        #define ll                           long long

        #define vll                          vector<ll>
        #define vi                           vector<long long>
        #define pll                          vector< pair<ll,ll> >
        #define pb                           push_back
        //#define mp                           make_pair
        #define all(v)                       v.begin(),v.end()
        #define lbnd                         lower_bound
        #define ubnd                         upper_bound
        #define bs                           binary_search
        #define F                            first
        #define S                            second
        #define rep(i,a,b)                   for(i=a;i<b;i++)
        #define parr(a,n)                    for(i=0;i<n;i++) cout<<a[i]<<" ";cout<<endl;
        #define pcont(a)                     for(auto i:a) cout<<i<<" ";cout<<endl;
        #define ret(x)                       return cout<<x,0;
        #define dbg(x)                       cout << #x << " is " << x << endl;
        //#define endl                           '\n'
     
     
        // Debug //
     
        #define trace(x)                 cerr << #x << ": " << x << endl;
        #define trace1(x)                cerr << #x << ": " << x << endl;
        #define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
        #define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
        #define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
        #define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
        #define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;


    using namespace std;
  ll ans,p;
  vector<pair<ll,ll>>graph[2503];
  ll n;
  ll c=0;
  void dfs(ll pos,ll sum)
  {
    //cout<<pos<<" "<<sum<<endl;
    if(pos==n)
    {
      c++;
      if(c>=100000)
      {
        cout<<-1<<endl;
        return 0;
      }
      ans=max(ans,sum);
      return ;
    }
    if(sum<0)
      return ;
    for(auto i:graph[pos])
    {
      dfs(i.F,sum+i.S-p);
    }
  }
    int main()
    {

          ios_base::sync_with_stdio(false);
          cin.tie(NULL);cout.tie(NULL);
        
          
          ll m;
          cin>>n>>m>>p;

          ll i,j;
          for(i=0;i<m;i++)
          { 
            ll u,v,w;

            cin>>u>>v>>w;
            graph[u].pb({v,w});
          }
          dfs(1,0);
          cout<<ans<<endl;


          return 0;


  }

  

Compiler output:
a.cc: In function 'void dfs(long long int, long long int)':
a.cc:52:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   52 |         return 0;
      |                ^