Language: C++

#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0; i<n;i++)
using namespace std;
#define MAX 1e9
int INF=MAX*MAX;
 
typedef pair<int,int> pii;
typedef pair<pii,pii> piii;
//vector<vector<long long> >d(501,vector<long long>(51,INF));
long long d[501][2][51];
signed main(){
	rep(i,501)rep(j,2)rep(k,51)d[i][j][k]=INF;
    int n,m;  cin>>n>>m;
    vector<vector<pii> >edge(n,vector<pii>());
    rep(i,m){
        int a,b,c; cin>>a>>b>>c;
        --a,--b;
        edge[a].push_back(pii(b,c));
        edge[b].push_back(pii(a,c));
    }
    int v0,a,b,c; cin>>v0>>a>>b>>c;
    priority_queue<piii,vector<piii>,greater<piii> >que;
    d[0][0][v0]=0;
    que.push(piii(pii(0,0),{0,v0}));
    while(!que.empty()){
        piii now=que.top(); que.pop();
        int v=now.second.second;
		int t=now.second.first
        int _v=(v*a+b)%c;
        if(d[now.first.second][t][v]<now.first.first)continue;
        for(int i=0; i<edge[now.first.second].size();i++){
			int nt=t|edge[now.first.second].first;
            pii next=edge[now.first.second][i];
            if(d[next.first][nt][_v]<now.first.first+next.second*v)continue;
            d[next.first][nt][_v]=now.first.first+next.second*v;
            que.push(piii(pii(d[next.first][_v],next.first),{nt,_v}));
        }
    }
    int ans=INF;
	rep(i,51)ans=min(ans,d[0][1][i]);
/*    rep(i,51)if(d[n-1][i]!=INF){
        vector<vector<long long> >_d(501,vector<long long>(51,INF));
        _d[n-1][i]=d[n-1][i];
        que.push(piii(pii(d[n-1][i],n-1),i));
        while(!que.empty()){
            piii now=que.top(); que.pop();
            int v=now.second;
            int _v=(v*a+b)%c;
            if(_d[now.first.second][v]<now.first.first)continue;
            for(int i=0; i<edge[now.first.second].size();i++){
                pii next=edge[now.first.second][i];
                if(_d[next.first][_v]<now.first.first+next.second*v)continue;
                _d[next.first][_v]=now.first.first+next.second*v;
                que.push(piii(pii(_d[next.first][_v],next.first),_v));
            }
        }
        rep(i,51)ans=min(ans,_d[0][i]);
    }	*/
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:13: error: expected ',' or ';' before 'long'
    2 | #define int long long
      |             ^~~~
a.cc:30:9: note: in expansion of macro 'int'
   30 |         int _v=(v*a+b)%c;
      |         ^~~
a.cc:33:57: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::pair<long long int, long long int> > >, std::vector<std::pair<long long int, long long int> > >::value_type' {aka 'class std::vector<std::pair<long long int, long long int> >'} has no member named 'first'
   33 |                         int nt=t|edge[now.first.second].first;
      |                                                         ^~~~~
a.cc:35:34: error: '_v' was not declared in this scope; did you mean 'v'?
   35 |             if(d[next.first][nt][_v]<now.first.first+next.second*v)continue;
      |                                  ^~
      |                                  v
a.cc:36:31: error: '_v' was not declared in this scope; did you mean 'v'?
   36 |             d[next.first][nt][_v]=now.first.first+next.second*v;
      |                               ^~
      |                               v