malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 1;   vector<int> adj[N];   int numDiv[N];   int a[N];   bool cand[N];   int sz[N], dsu[N];   int f(int x) {     if (x == dsu[x]) {       return x;     }     return dsu[x] = f(dsu[x]);   }   void merge(int x, int y) {     x = f(x), y = f(y);     if (x != y) {       dsu[x] = y;       sz[y] += sz[x];     }   }   int val[N];   int numPrime[N];   long long all[N];   vector<int> in[N];   int lastColor[N];   int isGood[N];   int curColorList[N];   int go[N];   int bfs(int root, int curColor) {     int sz = 0;     queue<int> q;     q.push(root);     lastColor[root] = curColor;     while (!q.empty()) {       int node = q.front();       q.pop();       ++sz;       for (int i = 0; i < (int)adj[node].size(); ++i) {         int nextNode = adj[node][i];         if (isGood[nextNode] == curColor && lastColor[nextNode] < curColor) {           lastColor[nextNode] = curColor;           q.push(nextNode);         }       }     }     return sz;   }   void solve() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; ++i) {       scanf( %d , &a[i]);       in[a[i]].push_back(i);     }     for (int i = 0; i < n - 1; ++i) {       int x, y;       scanf( %d %d  , &x, &y);       adj[x].push_back(y);       adj[y].push_back(x);     }     int g = N;     for (int i = 1; i < N; ++i) {       val[i] = 1;     }     int maxi = 0;     for (int i = 2; i < N; ++i) {       if (val[i] == 1) {         for (int j = i; j < N; j += i) {           val[j] *= i;           numPrime[j] ^= 1;         }       }     }     int curColor = 1;     int lim = (int)2e5;     int pos;     for (int num = lim; num >= 1; --num) {       ++curColor;       pos = 0;       for (int j = num; j <= lim; j += num) {         for (auto node : in[j]) {           if (isGood[node] != curColor) {             isGood[node] = curColor;             curColorList[pos++] = node;           }         }       }       long long tmp = 0;       for (int i = 0; i < pos; ++i) {         int node = curColorList[i];         if (lastColor[node] < curColor) {           int sz = bfs(node, curColor);           tmp += (long long)sz * (sz + 1);         }       }       tmp /= 2;       all[num] = tmp;     }     for (int num = 1; num <= lim; ++num) {       int g = 1;       long long ret = 0;       for (int j = num; j <= lim; j += num, ++g) {         if (val[g] == g) {           if (numPrime[g]) {             ret -= all[j];           } else {             ret += all[j];           }         }       }       if (ret > 0) {         printf( %d %lld n , num, ret);       }     }   }   int main() { solve(); }
#include <bits/stdc++.h>   using namespace std;   const int N = 220;   int n, m;   pair<int, double> a[N];   double Dp[N][N][N];   double Rec(int i, int j, int k) {     k = min(k, n);     if (k < 0) return 0.0;     if (i == n) return j >= m;     if (Dp[i][j][k] == Dp[i][j][k]) return Dp[i][j][k];     return Dp[i][j][k] = a[i].second * Rec(i + 1, j + 1, k + a[i].first) +                          (1.0 - a[i].second) * Rec(i + 1, j, k);   }   int main() {     memset(Dp, -1, sizeof(Dp));     int k;     cin >> n >> m >> k;     for (int i = 0; i < n; i++) cin >> a[i].second, a[i].second /= 100.0;     for (int i = 0; i < n; i++) cin >> a[i].first;     sort(a, a + n);     reverse(a, a + n);     printf( %.9f , Rec(0, 0, k));   }
#include <bits/stdc++.h>   using namespace std;   int main() {     std::ios_base::sync_with_stdio(0);     long long n, i, k, m, a[4005], v[4005], d[4005], p[4005], j;     cin >> n;     for (i = 0; i <= n - 1; i++) {       cin >> v[i] >> d[i] >> p[i];     }     long long cnt = 0;     for (i = 0; i <= n - 1; i++) {       if (p[i] == 100000000000007) continue;       m = v[i];       a[cnt++] = i + 1;       for (k = i + 1; k <= n - 1; k++) {         if (m == 0) break;         if (p[k] == 100000000000007) continue;         p[k] -= m;         m--;       }       m = 0;       for (k = i + 1; k <= n - 1; k++) {         if (p[k] != 100000000000007) {           p[k] -= m;           if (p[k] < 0) {             m += d[k];             p[k] = 100000000000007;           }         }       }     }     cout << cnt <<   n ;     for (i = 0; i <= cnt - 1; i++) cout << a[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int oo = (int)1e9;   const double eps = 1e-9;   long long gcd(long long a, long long b);   int main() {     int n;     long long maxi = 0, num, g;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> num;       maxi = max(maxi, num);       g = gcd(g, num);     }     if ((maxi / g - n) % 2)       cout <<  Alice  << endl;     else       cout <<  Bob  << endl;   }   long long gcd(long long a, long long b) {     if (b == 0)       return a;     else       return gcd(b, a % b);   }
#include <bits/stdc++.h>   const int maxn = 0x3f3f3f3f;   const double EI =       2.71828182845904523536028747135266249775724709369995957496696762772407663035354594571382178525166427;   const double PI = 3.141592653589793238462643383279;   using namespace std;   struct node {     int l, r;     double x, y, a;   } tree[300010 * 4];   int n;   void pushup(int p) {     double dis = sqrt(tree[2 * p + 1].x * tree[2 * p + 1].x +                       tree[2 * p + 1].y * tree[2 * p + 1].y);     double a = atan2(tree[2 * p + 1].y, tree[2 * p + 1].x);     tree[p].x = tree[2 * p].x + dis * cos(tree[2 * p].a + a);     tree[p].y = tree[2 * p].y + dis * sin(tree[2 * p].a + a);     tree[p].a = tree[2 * p].a + tree[2 * p + 1].a;     return;   }   void build(int l, int r, int p) {     tree[p].l = l;     tree[p].r = r;     if (l + 1 == r) {       tree[p].x = 1.0;       tree[p].y = 0.0;       tree[p].a = 0.0;       return;     }     int k = ((l + r) >> 1);     build(l, k, p << 1);     build(k, r, (p << 1) + 1);     pushup(p);     return;   }   void update(int pos, double len, double aa, int p) {     if (tree[p].l + 1 == tree[p].r) {       double dis = sqrt(tree[p].x * tree[p].x + tree[p].y * tree[p].y);       double a = atan2(tree[p].y, tree[p].x);       dis += len, a += aa;       tree[p].x = dis * cos(a);       tree[p].y = dis * sin(a);       tree[p].a = a;       return;     }     if (pos <= tree[p << 1].r) {       update(pos, len, aa, p << 1);     } else {       update(pos, len, aa, (p << 1) + 1);     }     pushup(p);     return;   }   int main() {     double val;     int q, op, pos;     while (~scanf( %d %d , &n, &q)) {       build(0, n, 1);       while (q--) {         scanf( %d %d %lf , &op, &pos, &val);         if (op == 1) {           update(pos, val, 0, 1);         } else {           update(pos, 0, (1 - val / 360) * 2 * PI, 1);         }         printf( %.10f %.10f n , tree[1].x, tree[1].y);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long int t;     cin >> t;     while (t--) {       long long int n;       cin >> n;       string s;       cin >> s;       long long int oc = 0, zc = 0, fpos = -1, lpos;       for (int i = 0; i < (int)n; i++) {         if (s[i] ==  0 )           zc++;         else {           oc++;           if (fpos == -1) {             fpos = i;           }           lpos = i;         }       }       if (oc == 0)         cout << n <<   n ;       else if (zc == 0)         cout << 2 * n <<   n ;       else {         if (s[0] ==  1 ) {           cout << 2 * n <<   n ;         } else {           cout << 2 * max((n - fpos), (lpos + 1)) <<   n ;         }       }     }   }
#include <bits/stdc++.h>   using namespace std;   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long n;     cin >> n;     long long a[n + 1];     long long diff[n];     long long max_count = INT_MIN;     for (long long i = 1; i <= n; i++) cin >> a[i];     multiset<long long> eles;     eles.insert(a[1]);     long long i = 2, j = 1;     while (i <= n && j <= n) {       eles.insert(a[i]);       long long mini = *eles.begin();       long long maxi = *eles.rbegin();       while (maxi - mini > 1) {         eles.erase(eles.find(a[j]));         j++;         maxi = *eles.rbegin();         mini = *eles.begin();       }       long long sz = eles.size();       max_count = max(max_count, sz);       i++;     }     cout << max_count;     return 0;   }
#include <bits/stdc++.h>   int main() {     int n, i, j, count = 0;     scanf( %d , &n);     int ara[n];     for (i = 0; i < n; i++) {       scanf( %d , &ara[i]);     }     for (i = 0; i < n - 1; i++) {       for (j = i + 1; j < n; j++) {         if (ara[i] == 0) {           continue;         }         if (ara[i] == ara[j]) {           ara[i] = 0;         }       }       if (ara[i] != 0) {         count++;       }     }     if (ara[n - 1] != 0) {       count++;     }     printf( %d n , count);     for (i = 0; i < n; i++) {       if (ara[i] == 0) {         continue;       }       printf( %d  , ara[i]);     }     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char s[450000];   int main() {     scanf( %s , &s);     vector<string> list;     char cur, last =  ! ;     string word =   ;     int len = strlen(s);     for (int i = 0; i < len; i++) {       cur = s[i];       if (last ==  ! ) {         if (cur !=  . ) {           word += cur;         } else {           printf( NO );           return 0;         }       } else {         if (cur ==  . ) {           if (last !=  . ) {             if (((word.length() > 11))) {               printf( NO );               return 0;             } else {               list.push_back(word);               word =   ;             }           } else {             printf( NO );             return 0;           }         } else {           word += cur;         }       }       last = cur;     }     if (last ==  . ) {       printf( NO );       return 0;     }     if (word !=   ) {       if (word.length() < 4) {         list.push_back(word);       } else {         printf( NO );         return 0;       }     }     if (list.size() == 2) {       if (!(list[0].length() > 0 && list[0].length() < 9 &&             list[1].length() > 0 && list[1].length() < 4)) {         printf( NO );         return 0;       }     } else {       if (list.size() == 1) {         printf( NO );         return 0;       }     }     for (int i = 1; i < list.size() - 1; i++) {       if (list[i].length() == 1) {         printf( NO );         return 0;       }     }     len = list.size();     bool was = false;     for (int i = 0; i < len; i++) {       if (!was) {         was = true;         if (list[i].length() > 8) {           printf( NO );           return 0;         } else {           cout <<  YES n ;           cout << list[i] <<  . ;         }       } else {         if (i != len - 1) {           if (list[i].length() > 3) {             cout << list[i].substr(0, 3) <<   n ;             cout << list[i].substr(3, list[i].length() - 3) <<  . ;           } else {             cout << list[i].substr(0, 1) <<   n ;             cout << list[i].substr(1, list[i].length() - 1) <<  . ;           }         } else {           cout << list[i] <<   n ;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double EPS = 1.0e-8;   struct Point {     double x, y;     Point(double _x = 0, double _y = 0) {       x = _x;       y = _y;     }     friend Point operator+(const Point &a, const Point &b) {       return Point(a.x + b.x, a.y + b.y);     }     friend Point operator-(const Point &a, const Point &b) {       return Point(a.x - b.x, a.y - b.y);     }     friend double operator^(const Point &a, const Point &b) {       return a.x * b.y - a.y * b.x;     }   };   Point Basic;   set<Point> Set;   double Distance(Point a, Point b) {     return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));   }   bool operator<(Point a, Point b) {     a = a - Basic;     b = b - Basic;     double Ang1 = atan2(a.y, a.x), Ang2 = atan2(b.y, b.x);     double Len1 = Distance(a, Point(0.0, 0.0)),            Len2 = Distance(b, Point(0.0, 0.0));     if (fabs(Ang1 - Ang2) < EPS) return Len1 < Len2;     return Ang1 < Ang2;   }   set<Point>::iterator Pre(set<Point>::iterator it) {     if (it == Set.begin()) it = Set.end();     return --it;   }   set<Point>::iterator Nxt(set<Point>::iterator it) {     ++it;     return it == Set.end() ? Set.begin() : it;   }   int Query(Point p) {     set<Point>::iterator it = Set.lower_bound(p);     if (it == Set.end()) it = Set.begin();     return ((p - *(Pre(it))) ^ (*(it) - *(Pre(it)))) < EPS;   }   void Insert(Point p) {     if (Query(p)) return;     Set.insert(p);     set<Point>::iterator it = Nxt(Set.find(p));     while (Set.size() > 3 && ((p - *(Nxt(it))) ^ (*(it) - *(Nxt(it)))) < EPS) {       Set.erase(it);       it = Nxt(Set.find(p));     }     it = Pre(Set.find(p));     while (Set.size() > 3 && ((p - *(it)) ^ (*(it) - *(Pre(it)))) > -EPS) {       Set.erase(it);       it = Pre(Set.find(p));     }   }   int main() {     int q;     scanf( %d , &q);     Basic = Point(0, 0);     int oper;     Point a, str[5];     for (int i = 1; i <= 3; ++i) {       scanf( %d%lf%lf , &oper, &str[i].x, &str[i].y);       Basic = Basic + str[i];     }     Basic.x /= 3.0;     Basic.y /= 3.0;     q -= 3;     for (int i = 1; i <= 3; ++i) {       Set.insert(str[i]);     }     while (q--) {       scanf( %d%lf%lf , &oper, &a.x, &a.y);       if (oper == 1) {         Insert(a);       } else {         if (Query(a))           printf( YES n );         else           printf( NO n );       }     }   }
#include <bits/stdc++.h>   using namespace std;      #define fast_io                     ios::sync_with_stdio(0);        cin.tie(NULL);                  cout.tie(NULL);   #define lli long long   #define loop(i, l, r) for (lli i = l; l < r ? i < r : i > r; l < r ? i += 1 : i -= 1)   #define itr(it, a) for (auto it = a.begin(); it != a.end(); it++)   #define it(i, a) for (auto i : a)   #define endl   n    #define inputarray(arr, start, size)        loop(i, start, size) { cin >> arr[i]; }   #define printarray(arr, start, size)                       loop(i, start, size) { cout << arr[i] <<    ; }        cout << endl;   #define mod 1000000007   #define inf 1e18   #define sp(x, y) fixed << setprecision(y) << x << endl;   #define pii pair<lli, lli>   #define mp make_pair   #define pb push_back   #define fi first   #define se second   #define all(x) x.begin(), x.end()   #define clr(x) memset(x, 0, sizeof(x))   #define sortall(x) sort(all(x))   #define debug(x) cout << #x <<  =  << x << endl      int main()   {   #ifndef ONLINE_JUDGE       freopen( input.txt ,  r , stdin);       freopen( output.txt ,  w , stdout);   #endif       fast_io           lli t = 1;       cin >> t;       while (t--)       {           lli n;           cin >> n;           vector<lli> v(n);           inputarray(v, 0, n);           bool flag = 0;           lli diff = INT_MAX, md = INT_MIN;           loop(i, 0, n)           {               if (v[i] < 0)               {                   flag = 1;                   break;               }           }           if (flag)           {               cout <<  NO  << endl;               continue;           }              cout <<  YES  << endl;           cout <<  101  << endl;           vector<lli> b;           loop(i, 0, 101)           {               b.push_back(i);           }           printarray(b, 0, b.size());       }       return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ld = long double;   vector<vector<int>> selfloops;   vector<vector<pair<int, int>>> adjlist;   vector<vector<int>> otherIdx;   vector<int> cycle, validIdx;   void swapEdges(int n, int a, int b) {     int neighA = adjlist[n][a].first, neighB = adjlist[n][b].first;     int idxNeighA = otherIdx[n][a], idxNeighB = otherIdx[n][b];     swap(adjlist[n][a], adjlist[n][b]);     swap(otherIdx[n][a], otherIdx[n][b]);     otherIdx[neighA][idxNeighA] = b;     otherIdx[neighB][idxNeighB] = a;   }   void removeEdge(int n, int i) {     int other = adjlist[n][i].first;     validIdx[n]++;     int otherIndex = otherIdx[n][i];     if (otherIndex != validIdx[other]) {       swapEdges(other, otherIndex, validIdx[other]);     }     validIdx[other]++;   }   void addEdge(int a, int b, int id) {     otherIdx[a].push_back((ll)(adjlist[b]).size() + (a == b));     otherIdx[b].push_back((ll)(adjlist[a]).size());     adjlist[a].push_back({b, id});     adjlist[b].push_back({a, -id});   }   void euler(int n) {     while (validIdx[n] < (ll)(adjlist[n]).size()) {       ll edge = adjlist[n][validIdx[n]].second;       int nn = adjlist[n][validIdx[n]].first;       removeEdge(n, validIdx[n]);       euler(nn);       cycle.push_back(edge);     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     ll n;     cin >> n;     vector<pair<ll, ll>> in(n);     for (ll i = 0; i < n; i++) {       ll a, b;       cin >> a >> b;       in[i] = {a, b};     }     auto ok = [&](ll res) {       selfloops.assign(1ll << res, {});       adjlist.assign(1ll << res, {});       otherIdx.assign(1ll << res, {});       validIdx.assign(1ll << res, 0);       cycle.clear();       ll mask = (1ll << res) - 1;       for (ll i = 0; i < n; i++) {         addEdge(in[i].first & mask, in[i].second & mask, i + 1);       }       bool ok = true;       ll start = 0;       for (ll i = 0; i < (1ll << res); i++) {         ok &= ((ll)(adjlist[i]).size() % 2) == 0;         if (!adjlist[i].empty()) start = i;       }       if (ok) euler(start);       return (ll)(cycle).size() == n;     };     ll l = 0;     ll r = 21;     while (l + 1 < r) {       ll m = (l + r) / 2;       if (ok(m)) {         l = m;       } else {         r = m;       }     }     ok(l);     reverse(begin(cycle), end(cycle));     cout << l << endl;     for (ll x : cycle) {       ll a = 2 * abs(x) - 1;       ll b = 2 * abs(x);       ll c = in[abs(x) - 1].first;       ll d = in[abs(x) - 1].second;       if (x < 0) swap(a, b);       if (x < 0) swap(c, d);       cout << a <<     << b <<    ;     }     cout << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long x1, x2, y1, y2;     cin >> x1 >> y1 >> x2 >> y2;     cout << ((y2 - y1 + 1) >= 0 ? (y2 - y1 + 1) : 0) *                     (((x2 - x1 + 2) / 2) >= 0 ? ((x2 - x1 + 2) / 2) : 0) -                 ((y2 + 1 - y1) / 2 >= 0 ? (y2 + 1 - y1) / 2 : 0);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string word, type;     int n;     cin >> n;     int j;     int cur = 0, real = 0, sreal = 0;     bool t = false, b = false;     getline(cin, word);     for (int i = 0; i < n; ++i) {       getline(cin, word);       for (j = 0; j < (int)word.size() && word[j] ==    ; ++j)         ;       if (j != word.size()) {         if (word[j] ==  c ) {           if (t) {             if (cur <= real) {               for (; j < (int)word.size() && word[j] !=  ( ; ++j)                 ;               for (; j < (int)word.size() && word[j] ==  (  || word[j] ==    ;                    ++j)                 ;               if (type == word.substr(j, type.size())) {                 for (; j < (int)word.size() && word[j] !=    ; ++j)                   ;                 ++j;                 for (; j < (int)word.size() && word[j] !=    ; ++j) {                   cout << word[j];                 }                 return 0;               }             }             --cur;             if (b) {               if (sreal) {                 --sreal;               } else {                 --real;               }             }           }         }         if (word[j] ==  t  && word[j + 1] ==  r ) {           ++cur;           if (b) {             ++sreal;           }         }         if (word[j] ==  t  && word[j + 1] ==  h ) {           t = true;           b = true;           for (; j < word.size() && word[j] !=  ( ; ++j)             ;           for (; j < word.size() && word[j] ==  (  || word[j] ==    ; ++j)             ;           for (; j < word.size() && word[j] !=     && word[j] !=  ) ; ++j) {             type.push_back(word[j]);           }           real = cur;         }       }     }     cout <<  Unhandled Exception ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, L, m, head[1000005], cnt, root, sz[1000005], sum, mx;   long long t[1000005], ans;   struct edge {     int to, next, cost;   } e[1000005 << 1];   struct dist {     int len, dis;     bool operator<(const dist &p) const { return dis < p.dis; }   } dis[1000005], q[1000005];   bool vis[1000005];   inline int read() {     int x = 0, w = 1;     char c = getchar();     while (c <  0  || c >  9 ) {       if (c ==  - ) w = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       x = x * 10 + c -  0 ;       c = getchar();     }     return x * w;   }   int lowbit(int x) { return x & (-x); }   void add(int x, int y) {     if (x == 0) return;     for (int i = x; i <= n + 1; i += lowbit(i)) t[i] += y;   }   long long query(int x) {     if (x <= 0) return 0;     long long res = 0;     for (int i = x; i; i -= lowbit(i)) res += t[i];     return res;   }   inline void add(int u, int v, int w) {     e[++cnt] = (edge){v, head[u], w};     head[u] = cnt;   }   void fdrt(int u, int fa) {     sz[u] = 1;     int num = 0;     for (int i = head[u]; i; i = e[i].next) {       int v = e[i].to;       if (v == fa || vis[v]) continue;       fdrt(v, u);       sz[u] += sz[v];       num = max(num, sz[v]);     }     num = max(num, sum - sz[u]);     if (mx > num) mx = num, root = u;   }   void gtds(int u, int fa) {     q[++cnt] = dis[u];     for (int i = head[u]; i; i = e[i].next) {       int v = e[i].to;       if (v == fa || vis[v]) continue;       dis[v].len = dis[u].len + 1;       dis[v].dis = dis[u].dis + e[i].cost;       gtds(v, u);     }   }   long long calc(int u, int len, int d) {     cnt = 0;     dis[u].len = len, dis[u].dis = d;     gtds(u, 0);     sort(q + 1, q + cnt + 1);     for (int i = 1; i <= cnt; i++) add(q[i].len + 1, 1);     int l = 1, r = cnt;     long long res = 0;     while (l < r) {       if (q[l].dis + q[r].dis <= m) {         add(q[l].len + 1, -1);         res += query(L - q[l].len + 1);         l++;       } else         add(q[r].len + 1, -1), r--;     }     add(q[l].len + 1, -1);     return res;   }   void solve(int u) {     ans += calc(u, 0, 0);     vis[u] = 1;     for (int i = head[u]; i; i = e[i].next) {       int v = e[i].to;       if (vis[v]) continue;       ans -= calc(v, 1, e[i].cost);       sum = mx = sz[v];       fdrt(v, 0);       solve(root);     }   }   int main() {     n = read();     L = read();     m = read();     for (int i = 2; i <= n; i++) {       int u = read(), w = read();       add(u, i, w);       add(i, u, w);     }     sum = mx = n;     fdrt(1, 0);     solve(root);     printf( %I64d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int sum = 0, n, a[120], x, y, i;     cin >> n;     for (i = 0; i < n - 1; ++i) {       cin >> a[i];     }     cin >> x >> y;     for (i = x - 1; i < y - 1; ++i) {       sum += a[i];     }     cout << sum <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1100, M = 2 * 1e5 + 10, INF = 1e9 + 10;   pair<int, int> e[M];   int dp[N][N];   vector<pair<pair<int, int>, pair<int, int> > > que[M];   bool ans[M];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int n, m, q;     cin >> n >> m >> q;     for (int i = 0; i < m; i++) cin >> e[i].first >> e[i].second;     for (int i = 0; i < q; i++) {       int l, r, s, t;       cin >> l >> r >> s >> t;       l--;       que[l].push_back({{s, t}, {r, i}});     }     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++)         if (i != j) dp[i][j] = INF;     for (int i = m - 1; i >= 0; i--) {       int u = e[i].first, v = e[i].second;       dp[u][v] = dp[v][u] = i;       for (int j = 1; j <= n; j++) {         if (j == u || j == v) continue;         if (dp[u][j] > dp[v][j])           dp[u][j] = dp[v][j];         else           dp[v][j] = dp[u][j];       }       for (auto X : que[i]) {         int s = X.first.first, t = X.first.second, r = X.second.first,             id = X.second.second;         if (dp[s][t] < r)           ans[id] = true;         else           ans[id] = false;       }     }     for (int i = 0; i < q; i++) {       if (ans[i])         cout <<  Yes n ;       else         cout <<  No n ;     }     return 0;   }