func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INPUT_MAXCHARS = 1 << 16;   char buffer[INPUT_MAXCHARS];   struct FastReader {     char *p;     FastReader() {       fread(buffer, 1, sizeof buffer, stdin);       p = buffer;     }     int next() {       int remchars = INPUT_MAXCHARS - (p - buffer);       if (remchars < 25) {         memcpy(buffer, p, remchars);         size_t cnt = fread(buffer + remchars, 1, sizeof buffer - remchars, stdin);         if (remchars + cnt < sizeof buffer) {           buffer[remchars + cnt] = 0;         }         p = buffer;       }       while (*p <  0 ) {         ++p;       }       int val = 0;       while (*p >=  0 ) {         val = val * 10 + (*p -  0 );         ++p;       }       return val;     }   };   const int inf = 1234567890;   const int MAXN = 100000;   vector<int> arrivals[MAXN];   int arr_idx[MAXN];   vector<pair<int, int> > adj[MAXN];   int best[MAXN];   bool done[MAXN];   int main() {     FastReader reader;     int n = reader.next();     int m = reader.next();     for (int i = 0; i < m; ++i) {       int a = reader.next();       int b = reader.next();       int c = reader.next();       adj[a - 1].push_back(make_pair(b - 1, c));       adj[b - 1].push_back(make_pair(a - 1, c));     }     for (int i = 0; i < n; ++i) {       int k = reader.next();       arrivals[i].reserve(k + 1);       for (int j = 0; j < k; ++j) {         int t = reader.next();         arrivals[i].push_back(t);       }       arrivals[i].push_back(inf);     }     for (int i = 0; i < n; ++i) {       best[i] = inf;     }     priority_queue<pair<int, int> > PQ;     PQ.push(make_pair(0, 0));     best[0] = 0;     while (!PQ.empty()) {       const pair<int, int> tmp = PQ.top();       PQ.pop();       int t = -tmp.first;       int at = tmp.second;       if (done[at] || best[at] < t) {         continue;       }       done[at] = true;       if (at == n - 1) {         printf( %d n , t);         return 0;       }       while (arrivals[at][arr_idx[at]] < t) {         ++arr_idx[at];       }       if (arrivals[at][arr_idx[at]] == t) {         done[at] = false;         best[at] = t + 1;         PQ.push(make_pair(-t - 1, at));       } else {         for (int i = 0; i < (int)adj[at].size(); ++i) {           const pair<int, int> e = adj[at][i];           if (t + e.second < best[e.first]) {             best[e.first] = t + e.second;             PQ.push(make_pair(-best[e.first], e.first));           }         }       }     }     puts( -1 );     return 0;   }   