malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   struct Point {     int num;     int next[3001];     int count;   };   Point a[3001];   int dis[3001];   int p[3001];   int cir[3001];   int cir1[3001];   int f(int n) {     int i, num = 0, d = 1;   loop:     while (1) {       num = 0;       for (i = 1; i <= n; i++) {         if (a[i].num - a[i].count == 1) {           a[i].count++;           p[num++] = i;         }       }       for (i = 0; i < num; i++) {         for (int j = 0; j < a[p[i]].num; j++) a[a[p[i]].next[j]].count++;       }       for (i = 1; i <= n; i++) {         if (a[i].num - a[i].count > 0 && a[i].num - a[i].count != 2) goto loop;       }       num = 0;       for (i = 1; i <= n; i++) {         if (a[i].num - a[i].count == 2) cir[num++] = i;       }       return num;     }   }   int main() {     int b[4], n, i, t, sum, num, flag;     int from, to;     cin >> n;     for (i = 1; i <= n; i++) {       cin >> from >> to;       a[from].next[a[from].num++] = to;       a[to].next[a[to].num++] = from;     }     int step = 0;     sum = num = f(n);     memset(dis, 0xff, sizeof(dis));     for (i = 0; i < num; i++) dis[cir[i]] = step;     while (sum < n) {       int k = 0;       step++;       flag = 0;       for (i = 0; i < num; i++) {         for (int j = 0; j < a[cir[i]].num; j++) {           int next = a[cir[i]].next[j];           if (dis[next] == -1) {             sum++;             flag = 1;             dis[next] = step;             cir1[k++] = next;             continue;           }         }         if (!flag) cir[i] = -1;       }       memcpy(cir, cir1, k * sizeof(cir1[0]));       num = k;     }     for (i = 1; i <= n; i++)       if (i != n)         cout << dis[i] <<    ;       else         cout << dis[i] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int _ = 600 + 7;   const int __ = 1e5 + 7;   const int S = 601, T = 602;   const int inf = 0x3f3f3f3f;   int n;   int lst[_], nxt[__], to[__], cap[__], tot = 1;   long long ans;   int gi() {     int x = 0;     bool f = 0;     char c = getchar();     while (!isdigit(c) and c !=  - ) c = getchar();     if (c ==  - ) f = 1, c = getchar();     while (isdigit(c)) x = (x << 3) + (x << 1) + c -  0 , c = getchar();     return f ? -x : x;   }   void Add(int x, int y, int c) {     nxt[++tot] = lst[x];     to[tot] = y;     cap[tot] = c;     lst[x] = tot;     nxt[++tot] = lst[y];     to[tot] = x;     cap[tot] = 0;     lst[y] = tot;   }   void Init() {     n = gi();     for (int i = 1; i <= n; ++i) {       int m = gi();       for (int j = 1; j <= m; ++j) Add(i, gi() + n, inf);     }     for (int i = 1; i <= n; ++i) {       int v = gi();       ans -= v;       Add(S, i, inf - v), Add(i + n, T, inf);     }   }   int d[_], cur[_];   queue<int> q;   bool Bfs() {     memset(d, -1, sizeof d);     while (!q.empty()) q.pop();     d[S] = 0, q.push(S);     while (!q.empty()) {       int u = q.front();       q.pop();       for (int i = lst[u]; i; i = nxt[i])         if (cap[i] and d[to[i]] == -1) {           d[to[i]] = d[u] + 1, q.push(to[i]);           if (to[i] == T) return 1;         }     }     return 0;   }   int Dfs(int u, int flow) {     if (u == T) return flow;     int res = flow;     for (int &i = cur[u]; i; i = nxt[i])       if (cap[i] and d[to[i]] == d[u] + 1) {         int tmp = Dfs(to[i], min(res, cap[i]));         cap[i] -= tmp, cap[i ^ 1] += tmp;         res -= tmp;         if (!res) return flow;       }     return flow - res;   }   void Run() {     long long maxFlow = -1ll * n * inf;     int flow;     while (Bfs()) {       memcpy(cur, lst, sizeof cur);       do {         flow = Dfs(S, inf);         maxFlow += flow;       } while (flow);     }     cout << min(0ll, -(ans - maxFlow)) << endl;   }   int main() {     Init();     Run();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k, a[100010];     cin >> n >> k;     if (n / 2 > k)       printf( -1 n );     else {       if (n == 1) {         if (k == 0)           printf( 1 n );         else           printf( -1 n );       } else {         int t = k - (n / 2 - 1);         printf( %d %d  , t, 2 * t);         int cnt = 1;         for (int i = 1; i < n / 2; i++) {           printf(  %d %d  , 900000000 + cnt, 900000000 + cnt + 1);           cnt += 2;         }         if (n % 2) printf( 1000000000 );       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long int t;     cin >> t;     while (t--) {       long long int a, b, n, s;       cin >> a >> b >> n >> s;       long long int r = s % n;       long long int q = s / n;       if (q <= a) {         if (r <= b) {           cout <<  YES  <<   n ;         } else           cout <<  NO  <<   n ;       } else if (((q - a) * n + r) <= b) {         cout <<  YES  <<   n ;       } else {         cout <<  NO  <<   n ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   string itos(int x) {     stringstream ss;     ss << x;     return ss.str();   }   int xorsum, n, a[110];   map<int, int> grun;   int sieve[31700];   vector<int> p;   int mex(set<int> &s) {     for (int i = 0;; i++)       if (not s.count(i)) return i;   }   int getGrundy(int x) {     if (grun.count(x)) return grun[x];     if (x == 1) return grun[x] = 0;     set<int> s;     for (int i = 1; (1 << i) <= x; i++)       s.insert(getGrundy(x >> i | (x & ((1 << i) - 1))));     return grun[x] = mex(s);   }   void solve(int x) {     int mask = 0;     for (int i = 0; i < n; i++) {       int cnt = 0;       while (a[i] % x == 0) cnt++, a[i] /= x;       mask |= (1 << cnt);     }     xorsum ^= getGrundy(mask);   }   int main() {     ios_base::sync_with_stdio(false);     cin >> n;     for (int i = 0; i < n; i++) cin >> a[i];     for (int i = 2; i < 31700; i++) {       if (not sieve[i]) {         p.push_back((i));         for (int j = i * i; j < 31700; j += i) sieve[j] = 1;       }     }     for (int i = 0; i < n; i++) {       auto it1 = p.begin();       while (a[i] > 1) {         if (it1 == p.end()) {           solve(a[i]);           break;         } else if (a[i] % *it1 == 0)           solve(*it1);         it1++;       }     }     cout << (xorsum ?  Mojtaba  :  Arpa ) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int Maxn3 = 1e3 + 10;   const long long int Maxn4 = 1e4 + 10;   const long long int Maxn5 = 1e5 + 10;   const long long int Maxn6 = 1e6 + 10;   const long long int Maxn7 = 1e7 + 10;   const long long int Maxn8 = 1e8 + 10;   const long long int Maxn9 = 1e9 + 10;   const long long int Maxn18 = 1e18 + 10;   const long long int Mod1 = 1e7 + 7;   const long long int Mod2 = 1e9 + 7;   const long long int LLMax = LLONG_MAX;   const long long int LLMin = LLONG_MIN;   const long long int INTMax = INT_MAX;   const long long int INTMin = INT_MIN;   long long int mn = LLMax, mx = LLMin;   char s[Maxn6];   int main() {     ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);     string s1( ... n.X. n ), s2( .X. n ), s;     long long int res = 0;     cin >> s;     for (long long int i = 0; i < s.size(); i++) {       if (res < s[i]) res += 256;       while (res > s[i]) {         res--;         cout << s1;       }       cout << s2;     }   }
#include <bits/stdc++.h>   std::mt19937 rng(       (int)std::chrono::steady_clock::now().time_since_epoch().count());   int main() {     std::ios_base::sync_with_stdio(false);     std::cin.tie(NULL);     int n, w, m;     std::cin >> n >> w >> m;     std::cout << std::setprecision(10) << std::fixed;     std::vector<std::vector<std::pair<int, int>>> ans(m);     w *= m;     int cup = n * w / m;     int rest = w;     for (int i = 0, j = 0; i < m; i++) {       if (rest > 0 && rest != w && rest > cup) {         std::cout <<  NO n ;         return 0;       }       int want = cup;       while (want > 0) {         int use = std::min(rest, want);         assert(use != 0);         ans[i].emplace_back(use, j + 1);         want -= use;         rest -= use;         if (rest == 0) {           j++;           rest = w;         }       }     }     std::cout <<  YES n ;     for (auto vec : ans) {       for (int i = 0; i < (int)vec.size(); i++) {         std::cout << vec[i].second <<     << (double)vec[i].first / m                   << (i + 1 == (int)vec.size() ?   n  :    );       }     }   }
#include <bits/stdc++.h>   using namespace std;   constexpr int INF = 1e9 + 1;   constexpr long long LLINF = 1e18 + 1;   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }   void solve() {     int n, t;     cin >> n;     vector<int> arr(101);     for (__typeof(n) i = 0; i < n; i++) {       cin >> t;       arr[t] = 1;     }     int col = 0;     for (int i = 1; i <= 100; i++)       if (arr[i]) {         for (int j = i; j <= 100; j += i) {           arr[j] = 0;         }         col++;       }     printf( %d n , col);   }   int main() {     ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);     int t = 1;     while (t--) solve();   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n;     cin >> n;     long long a[n];     for (int i = 0; i < n; i++) cin >> a[i];     cout << a[1] - a[0] <<     << a[n - 1] - a[0] << endl;     for (int i = 1; i <= n - 2; i++) {       cout << min(a[i] - a[i - 1], a[i + 1] - a[i]) <<                << max(a[i] - a[0], a[n - 1] - a[i]) << endl;     }     cout << a[n - 1] - a[n - 2] <<     << a[n - 1] - a[0];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 998244353;   int power(int v, int u) {     if (!u) return 1;     int ok = power(v, u >> 1);     if (u & 1) return (long long)ok * ok % mod * v % mod;     return (long long)ok * ok % mod;   }   const int maxm = 2e5;   int b[maxm + 10];   int main() {     int n, m, A;     scanf( %d%d%d , &n, &m, &A);     for (int i = 1; i <= m; i++) scanf( %d , &b[i]);     int ans = 1;     int inv2 = power(2, mod - 2);     for (int i = 1; i <= m; i++)       ans = (long long)ans *             (((long long)power(A, 2 * (b[i] - b[i - 1])) +               power(A, b[i] - b[i - 1])) %              mod * inv2 % mod) %             mod;     ans = (long long)ans * power(A, n - b[m] - b[m]) % mod;     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long double eps = 1e-9;   const int inf = (1 << 30) - 1;   const long long inf64 = ((long long)1 << 62) - 1;   const long double pi = acos(-1);   template <class T>   T sqr(T x) {     return x * x;   }   template <class T>   T abs(T x) {     return x < 0 ? -x : x;   }   const int MAXK = 105;   const int magic = 100 * 1000;   int a[MAXK];   int ans_small[MAXK][magic];   long long get_ans(long long n, int k) {     if (k == 0) {       return n;     }     if (n < magic) {       return ans_small[k][n];     }     return get_ans(n, k - 1) - get_ans(n / a[k - 1], k - 1);   }   int main() {     ios_base::sync_with_stdio(0);     long long n;     int k;     cin >> n >> k;     for (int i = 0; i < k; ++i) {       cin >> a[i];     }     sort(a, a + k);     for (int i = 0; i < magic; ++i) {       ans_small[0][i] = i;     }     for (int i = 1; i <= k; ++i) {       for (int j = 0; j < magic; ++j) {         ans_small[i][j] = ans_small[i - 1][j] - ans_small[i - 1][j / a[i - 1]];       }     }     cout << get_ans(n, k) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1000000007;   long long Power(long long a, long long b) {     if (a == 0) return 0LL;     long long ans = 1;     while (b) {       if (b & 1) ans = (ans * a) % mod;       a = (a * a) % mod;       b >>= 1;     }     return ans;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long n, m, k;     cin >> n >> m >> k;     if (k == -1 && n % 2 != m % 2) {       cout << 0 << endl;       return 0;     }     long long ans = Power(Power(2, (n - 1)), m - 1);     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   long long dp[20][20][20];   int a[20];   long long num[20];   long long dfs(int pos, int pre, int sta, bool flag) {     if (pos == 0) {       if (pre == sta)         return 1;       else         return 0;     }     if (dp[pos][pre][sta] != -1 && !flag) return dp[pos][pre][sta];     int maxx = flag ? a[pos] : 9;     long long sum = 0;     for (int i = 0; i <= maxx; i++) {       sum += dfs(pos - 1, pre + (i == 4 || i == 7), sta, flag && (i == a[pos]));     }     if (!flag) dp[pos][pre][sta] = sum;     return sum;   }   long long solve(int pos, int res) {     long long ans = 0;     if (pos == 7) return 1;     for (int i = 0; i <= res; i++) {       if (num[i]) {         num[i]--;         ans = (ans + (num[i] + 1) * solve(pos + 1, res - i) % mod) % mod;         num[i]++;       }     }     return ans;   }   void cal(int x) {     int len = 0;     while (x) {       len++;       a[len] = x % 10;       x /= 10;     }     for (int i = 0; i <= len; i++) {       num[i] = dfs(len, 0, i, 1);     }     num[0]--;     long long ans = 0;     for (int i = 1; i <= len; i++) {       ans = (ans + num[i] * solve(1, i - 1) % mod) % mod;     }     printf( %lld n , ans);   }   int main() {     memset(dp, -1, sizeof dp);     int m;     scanf( %d , &m);     cal(m);   }
#include <bits/stdc++.h>   using namespace std;   int a[29];   int main() {     int n, k;     char s[105];     scanf( %d , &n);     scanf( %d , &k);     scanf( %s , s + 1);     bool f(true);     for (int i = 1; i <= n; ++i) {       int temp = s[i] -  a ;       a[temp]++;       if (a[temp] > k) {         f = false;         break;       }     }     if (f)       printf( YES n );     else       printf( NO n );     return 0;   }
#include <bits/stdc++.h>   const int mod = 1000003;   char str[2010];   int f[2010][2010];   int main() {     int n, i, j, len;     bool flag = true;     gets(str);     n = strlen(str);     for (i = 0; i <= n; i++) {       if (str[i] ==  *  || str[i] ==  /  || i == n)         if (i == 0 || str[i - 1] <  0  || str[i - 1] >  9 ) flag = false;     }     if (!flag) {       printf( 0 n );       return 0;     }     f[0][0] = 1;     len = 0;     for (i = 1; i <= n; i++) {       flag = ( 0  <= str[i - 1] && str[i - 1] <=  9 );       if (!flag) len++;       for (j = len; j >= 0; j--) {         if (flag) {           f[i][j] = f[i - 1][j];           if ( 0  > str[i] || str[i] >  9 )             f[i][j] = (f[i][j] + f[i][j + 1]) % mod;         } else if (j > 0)           f[i][j] = f[i - 1][j - 1];       }     }     printf( %d n , f[n][0]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using vi = vector<int>;   using vl = vector<ll>;   using pi = pair<int, int>;   namespace output {   void pr(int x) { cout << x; }   void pr(long x) { cout << x; }   void pr(ll x) { cout << x; }   void pr(unsigned x) { cout << x; }   void pr(unsigned long x) { cout << x; }   void pr(unsigned long long x) { cout << x; }   void pr(float x) { cout << x; }   void pr(double x) { cout << x; }   void pr(long double x) { cout << x; }   void pr(char x) { cout << x; }   void pr(const char* x) { cout << x; }   void pr(const string& x) { cout << x; }   void pr(bool x) { pr(x ?  true  :  false ); }   template <class T1, class T2>   void pr(const pair<T1, T2>& x);   template <class T>   void pr(const T& x);   template <class T, class... Ts>   void pr(const T& t, const Ts&... ts) {     pr(t);     pr(ts...);   }   template <class T1, class T2>   void pr(const pair<T1, T2>& x) {     pr( { , x.first,  ,  , x.second,  } );   }   template <class T>   void pr(const T& x) {     pr( { );     bool fst = 1;     for (const auto& a : x) pr(!fst ?  ,   :   , a), fst = 0;     pr( } );   }   void ps() { pr(  n ); }   template <class T, class... Ts>   void ps(const T& t, const Ts&... ts) {     pr(t);     if (sizeof...(ts)) pr(   );     ps(ts...);   }   void pc() { cout <<  ]  << endl; }   template <class T, class... Ts>   void pc(const T& t, const Ts&... ts) {     pr(t);     if (sizeof...(ts)) pr( ,  );     pc(ts...);   }   }  // namespace output   using namespace output;   const int MX = 200005;   const int MOD = (int)(1e9 + 7);   const ll INF = (ll)1e18;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n;     cin >> n;     vi a(n);     vi cnt(101);     for (int i = 0; i < n; i++) {       cin >> a[i];       cnt[a[i]]++;     }     pi best = make_pair(-1, -1);     for (int i = 1; i <= 100; i++) {       if (cnt[i] > best.second) best = make_pair(i, cnt[i]);     }     for (int i = 1; i <= 100; i++) {       if (i != best.first && cnt[i] == best.second) {         cout << n <<   n ;         return 0;       }     }     int ret = 0;     for (int v = 1; v <= 100; v++) {       if (v == best.first) continue;       int ans = 0;       vi nv(n);       for (int i = 0; i < n; i++) {         if (a[i] == v)           nv[i] = -1;         else if (a[i] == best.first)           nv[i] = 1;       }       vi mn(2 * n + 1, -2);       mn[n] = -1;       int sum = 0;       for (int i = 0; i < n; i++) {         sum += nv[i];         if (mn[sum + n] != -2)           ans = max(ans, i - mn[sum + n]);         else           mn[sum + n] = i;       }       ret = max(ret, ans);     }     cout << ret <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 10;   long long int cal(long long int num) { return (num * (num + 1)) / 2ll; }   void solve() {     long long int n;     scanf( %lld , &n);     n--;     long long int ans = 0, k = 1;     for (long long int i = 1; i <= n; i <<= 1) {       ans += ((n - i) / (i << 1) + 1) * i;     }     printf( %lld n , ans);   }   int main() {     int t = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1e9 + 9;   const double eps = 1e-5;   const int maxN = 2e3 + 10;   const int inf = 1e9;   int n, m;   vector<pair<int, int> > a[maxN];   int vis[maxN], c[maxN];   vector<int> pat;   inline void dfs(int v, int f = -1) {     for (int i = 0; i < a[v].size(); i++) {       if (a[v][i].first <= f) continue;       if (!vis[a[v][i].second]) {         vis[a[v][i].second] = 1;         dfs(a[v][i].first);       }     }     pat.push_back(v);   }   inline void init() {     cin >> n >> m;     for (int i = 0; i < m + 1; i++) {       cin >> c[i];       c[i]--;     }     for (int i = 1; i < m + 1; i++) {       int v = c[i - 1], u = c[i];       a[v].push_back(make_pair(u, i - 1));       a[u].push_back(make_pair(v, i - 1));     }     for (int i = 0; i < n; i++) sort(a[i].begin(), a[i].end());   }   inline void solve() {     for (int i = m - 1; i >= 0; i--) {       memset(vis, 0, sizeof vis);       pat.clear();       for (int j = 0; j < i; j++) vis[j] = 1;       dfs(c[i], c[i + 1]);       if (i + pat.size() == m + 1) {         reverse(pat.begin(), pat.end());         for (int j = 0; j < i; j++) cout << c[j] + 1 <<    ;         for (int j = 0; j < pat.size(); j++) cout << pat[j] + 1 <<    ;         cout << endl;         return;       }     }     cout <<  No solution  << endl;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie();     cout.tie();     init();     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   vector<int> edge[110000];   vector<pair<int, int> > R;   set<int> N;   int find(int rt, int to) {     int i;     for (i = 0; i < edge[rt].size(); i++) {       if (edge[rt][i] == to) return 1;     }     return 0;   }   int dfs(int rt) {     if (R.size() == m || R.size() == n - 1) return 1;     N.erase(rt);     set<int>::iterator it;     for (it = N.begin(); it != N.end(); it++) {       if (find(rt, *it)) continue;       R.push_back(make_pair(rt, *it));       if (dfs(*it)) return 1;       R.pop_back();       it = N.find(*it);     }     N.insert(rt);     return 0;   }   int main() {     int a, b, i;     scanf( %d%d , &n, &m);     for (i = 1; i <= m; i++) {       scanf( %d%d , &a, &b);       edge[a].push_back(b);       edge[b].push_back(a);     }     for (i = 1; i <= n; i++) {       N.insert(i);     }     for (i = 1; i <= n; i++) {       if (dfs(i)) {         if (n == m) R.push_back(make_pair(R[0].first, R[R.size() - 1].second));         for (i = 0; i < m; i++) printf( %d %d n , R[i].first, R[i].second);         return 0;       }     }     puts( -1 );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s[40] = {          Washington ,  Adams ,      Jefferson ,  Madison ,     Monroe ,          Adams ,       Jackson ,    Van Buren ,  Harrison ,    Tyler ,          Polk ,        Taylor ,     Fillmore ,   Pierce ,      Buchanan ,          Lincoln ,     Johnson ,    Grant ,      Hayes ,       Garfield ,          Arthur ,      Cleveland ,  Harrison ,   Cleveland ,   McKinley ,          Roosevelt ,   Taft ,       Wilson ,     Harding ,     Coolidge ,          Hoover ,      Roosevelt ,  Truman ,     Eisenhower ,  Kennedy ,          Johnson ,     Nixon ,      Ford ,       Carter ,      Reagan };     int a;     cin >> a;     cout << s[a - 1] <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   void out(T x) {     cout << x << endl;     exit(0);   }   const int maxn = 1e6 + 5;   int n, m;   int a[maxn];   vector<int> g[maxn];   vector<pair<int, pair<int, int>>> edges;   int par[maxn], siz[maxn];   int f(int x) { return par[x] == x ? x : par[x] = f(par[x]); }   void join(int x, int y) {     x = f(x);     y = f(y);     if (x == y) return;     if (siz[x] < siz[y]) swap(x, y);     siz[x] += siz[y];     par[y] = x;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n >> m;     for (int i = 1; i <= n; i++) {       cin >> a[i];       par[i] = i;       siz[i] = 1;     }     for (int i = 0; i < m; i++) {       int u, v;       cin >> u >> v;       g[u].push_back(v);       g[v].push_back(u);       edges.push_back({min(a[u], a[v]), {u, v}});     }     auto cmp = [](pair<int, pair<int, int>> p1, pair<int, pair<int, int>> p2) {       return p1.first > p2.first;     };     long double num = 0;     long double den = 0;     sort(edges.begin(), edges.end(), cmp);     for (auto p : edges) {       int wei = p.first;       int u = f(p.second.first);       int v = f(p.second.second);       if (u == v) continue;       long double paths = 1LL * siz[u] * siz[v];       den += paths;       num += 1.0 * wei * paths;       join(u, v);     }     long double ans = num / den;     cout << fixed << setprecision(9) << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main(int argc, char** argv) {     int T;     cin >> T;     while (T--) {       long long a, b, c, d;       cin >> a >> b >> c >> d;       d -= min(a, d / c) * c;       if (d > b)         puts( NO );       else         puts( YES );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s[10];     s[0] =  O-|-OOOO ;     s[1] =  O-|O-OOO ;     s[2] =  O-|OO-OO ;     s[3] =  O-|OOO-O ;     s[4] =  O-|OOOO- ;     s[5] =  -O|-OOOO ;     s[6] =  -O|O-OOO ;     s[7] =  -O|OO-OO ;     s[8] =  -O|OOO-O ;     s[9] =  -O|OOOO- ;     int n;     cin >> n;     if (n == 0) cout << s[0] << endl;     while (n != 0) {       int z = n % 10;       cout << s[z] << endl;       n /= 10;     }     return 0;   }