malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   vector<pair<int, int> > seq;   const int mod = 1e6;   const long long A = 42344;   const long long B = 333;   int seed = 239;   int mrand() {     static int now = -1;     if (now == -1)       now = seed;     else       now = (A * now + B) % mod;     return now;   }   struct line {     long long a, b, c;     int id;     line() {}     line(long long A, long long B, long long C, int i)         : a(A), b(B), c(C), id(i) {}   };   void run(vector<line> a, int k) {     int n = (int)a.size();     if (k >= n) {       for (int i = 0; i < n; i++) seq.push_back(make_pair(a[i].id, -1));       sort(seq.begin(), seq.end());       seq.resize(unique(seq.begin(), seq.end()) - seq.begin());       puts( YES );       printf( %d n , (int)seq.size());       for (int i = 0; i < (int)seq.size(); i++)         printf( %d %d n , seq[i].first, seq[i].second);       exit(0);     }     if (k == 0) return;     vector<line> go;     for (int iter = 0; iter < k * k; iter++) {       int i = mrand() % n, j = mrand() % (n - 1);       if (j >= i) j++;       if (a[i].a * a[j].b == a[j].a * a[i].b) continue;       go.resize(0);       int kol = 0;       double lim = max(1.0 * kol, n * (1.0 - 1.0 / (2.0 * k)));       for (int q = 0; q < n; q++)         if (a[i].a * a[j].b * a[q].c + a[i].b * a[j].c * a[q].a +                 a[i].c * a[j].a * a[q].b !=             a[i].c * a[j].b * a[q].a + a[i].b * a[j].a * a[q].c +                 a[i].a * a[j].c * a[q].b) {           go.push_back(a[q]);           kol++;           if (kol > lim) break;         }       if (kol > lim) continue;       seq.push_back(make_pair(a[i].id, a[j].id));       run(go, k - 1);       seq.pop_back();     }   }   int main() {     srand(123654);     int n, k;     scanf( %d%d , &n, &k);     vector<line> l(n);     for (int i = 0; i < n; i++) {       int a, b, c;       scanf( %d%d%d , &a, &b, &c);       l[i] = line(a, b, c, i + 1);     }     run(l, k);     puts( NO );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string express(int layers) {     string ans =   ;     for (int i = 1; i <= layers; i++) {       if (i % 2 == 1) {         if (i == layers) {           ans +=  I hate it ;         } else {           ans +=  I hate that  ;         }       } else {         if (i == layers) {           ans +=  I love it ;         } else {           ans +=  I love that  ;         }       }     }     return ans;   }   int main() {     int layers;     cin >> layers;     cout << express(layers);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<long long> vec;     vec.push_back(0LL);     for (int i = 0; i < n; i++) {       long long k;       cin >> k;       vec.push_back(k);     }     int m;     cin >> m;     vector<long long> v;     long long x = 0, y = 0;     for (int i = 0; i < m; i++) {       long long a, b;       cin >> a >> b;       if (vec[a] >= y) {         v.push_back(vec[a]);         y = vec[a] + b;       } else {         v.push_back(y);         y += b;       }     }     for (int i = 0; i < m; i++) cout << v[i] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mx1 = 20;   const int mx2 = 405;   const int mx3 = 2005;   const int mx4 = 30005;   const int mx5 = 100005;   const int mx6 = 1000005;   int _toggle(int N, int pos) { return N = N ^ (1 << pos); }   int _set(int N, int pos) { return N = N | (1 << pos); }   int _reset(int N, int pos) { return N = N & ~(1 << pos); }   bool _check(int N, int pos) { return (bool)(N & (1 << pos)); }   bool _upper(char a) { return a >=  A  && a <=  Z ; }   bool _lower(char a) { return a >=  a  && a <=  z ; }   bool _digit(char a) { return a >=  0  && a <=  9 ; }   int dx[] = {1, -1, 0, 0, -1, -1, 1, 1};   int dy[] = {0, 0, 1, -1, -1, 1, -1, 1};   const int inf = 1e9 + 7;   int n, a[mx5];   int fnd(int x, int y) {     int cnt = (x != 0) + (y != 0);     int A = a[1] + x, B = a[2] + y, d = B - A, pre = B;     for (int i = 3; i <= n; i++) {       bool f = 0;       for (int j = -1; j < 2; j++) {         int now = a[i] + j;         if (now - pre == d) {           f = 1;           pre = now;           cnt += (j != 0);           break;         }       }       if (!f) {         return inf;       }     }     return cnt;   }   void solve() {     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];     }     if (n < 3) {       cout << 0 <<   n ;       return;     }     int ans = inf;     for (int i = -1; i < 2; i++) {       for (int j = -1; j < 2; j++) {         ans = min(ans, fnd(i, j));       }     }     if (ans == inf) {       cout << -1 <<   n ;     } else {       cout << ans <<   n ;     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int tc = 1;     while (tc--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   long long l, r, lim[60];   long long f[60][60][2][2];   inline long long read() {     long long x = 0, f = 1;     char ch = getchar();     while (!isdigit(ch)) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (isdigit(ch)) {       (x *= 10) += ch -  0 ;       ch = getchar();     }     return x * f;   }   long long dfs(long long at, long long sum, bool is_lim, bool is_pre) {     if (at == 0) return sum <= 3 && !is_pre;     if (f[at][sum][is_lim][is_pre] != -1) return f[at][sum][is_lim][is_pre];     long long mx = is_lim ? lim[at] : 9, res = 0;     for (long long i = 0; i <= mx; i++) {       if (i == 0 && is_pre)         res += dfs(at - 1, sum, is_lim && i == mx, is_pre);       else         res += dfs(at - 1, sum + (i != 0), is_lim && i == mx, 0);     }     return f[at][sum][is_lim][is_pre] = res;   }   long long solve(long long x) {     memset(f, -1, sizeof(f));     memset(lim, 0, sizeof(lim));     long long mx_pos = 0;     while (x) lim[++mx_pos] = x % 10, x /= 10;     return dfs(mx_pos, 0, 1, 1);   }   signed main() {     long long T = read();     while (T--) {       l = read(), r = read();       printf( %lld n , solve(r) - solve(l - 1));     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1000100, mod = 998244353;   inline int read() {     int x = 0, f = 0;     char ch = getchar();     while (ch <  0  || ch >  9 ) f |= ch ==  - , ch = getchar();     while (ch >=  0  && ch <=  9 ) x = x * 10 + ch -  0 , ch = getchar();     return f ? -x : x;   }   int n, el, head[maxn], to[maxn * 2], nxt[maxn * 2], len[maxn], fa[maxn],       son[maxn], ans[maxn], *f[maxn];   inline void add(int u, int v) {     to[++el] = v;     nxt[el] = head[u];     head[u] = el;   }   void dfs1(int u, int f) {     fa[u] = f;     for (int i = head[u]; i; i = nxt[i]) {       int v = to[i];       if (v == f) continue;       dfs1(v, u);       if (len[v] + 1 > len[u]) son[u] = v, len[u] = len[v] + 1;     }   }   void dfs2(int u) {     if (son[fa[u]] != u) f[u] = new int[len[u] + 5]();     if (son[u]) {       f[son[u]] = f[u] + 1;       dfs2(son[u]);       if (f[u][ans[son[u]] + 1] > 1) ans[u] = ans[son[u]] + 1;     }     f[u][0]++;     for (int i = head[u]; i; i = nxt[i]) {       int v = to[i];       if (v == fa[u] || v == son[u]) continue;       dfs2(v);       for (int j = (0); j <= (len[v]); j++) {         f[u][j + 1] += f[v][j];         if (f[u][j + 1] == f[u][ans[u]]) ans[u] = min(ans[u], j + 1);         if (f[u][j + 1] > f[u][ans[u]]) ans[u] = j + 1;       }     }   }   int main() {     n = read();     for (int i = (1); i <= (n - 1); i++) {       int u = read(), v = read();       add(u, v);       add(v, u);     }     dfs1(1, 0);     dfs2(1);     for (int i = (1); i <= (n); i++)       if (son[fa[i]] != i) delete[] f[1];     for (int i = (1); i <= (n); i++) printf( %d n , ans[i]);   }
#include <bits/stdc++.h>   using namespace std;   long long n;   long long N[100006];   long long sum[1000006], S[1000006];   long long t[1000006];   long long t1[1000006];   long long lowbit(long long u) { return u & (-u); }   void add(long long u, long long w) {     while (u <= n) {       t[u] += w;       u += lowbit(u);     }   }   long long Find(long long u) {     long long ans = 0;     while (u) {       ans += t[u];       u -= lowbit(u);     }     return ans;   }   void add1(long long u, long long w) {     while (u <= n) {       t1[u] += w;       u += lowbit(u);     }   }   long long Find1(long long u) {     long long ans = 0;     while (u) {       ans += t1[u];       u -= lowbit(u);     }     return ans;   }   double ans;   signed main() {     scanf( %lld , &n);     for (long long i = 1; i <= n; i++) scanf( %lld , &N[i]);     for (long long i = 1; i <= n; i++) {       sum[i] += Find(n) - Find(N[i]);       S[i] += Find1(n) - Find1(N[i]);       if (sum[i] != 0)         ans += ((double)(n * (n + 1ll) / 2ll) * sum[i] -                 (double)(n - i + 1ll) * S[i]) /                (double)(n * (n + 1ll) / 2ll);       add(N[i], 1);       add1(N[i], i);     }     for (long long i = 2; i <= n; i++)       ans += (double)((i - 1) * i) / 2.00 / 2.00 * (double)(n - i + 1) /              (double)(n * (n + 1ll) / 2ll);     printf( %.12lf n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, nq, tr, tg, z, tot, root;   int ls[7000010], rs[7000010], s[7000010];   long long mod, ans, x, y;   long long b[100010], a[100010];   void push_down(int p) {     if (!ls[p]) ls[p] = ++tot;     if (!rs[p]) rs[p] = ++tot;     if (s[ls[p]] == 0 || s[p] < s[ls[p]]) s[ls[p]] = s[p];     if (s[rs[p]] == 0 || s[p] < s[rs[p]]) s[rs[p]] = s[p];     s[p] = 0;   }   void change(int &p, long long l, long long r) {     if (l > y || r < x) return;     if (!p) p = ++tot;     if (l >= x && r <= y) {       if (s[p] == 0 || z < s[p]) s[p] = z;       return;     }     if (s[p]) push_down(p);     change(ls[p], l, (l + r) / 2);     change(rs[p], (l + r) / 2 + 1, r);   }   int query(int &p, long long l, long long r) {     if (!p) p = ++tot;     if (l == r) return s[p];     if (s[p]) push_down(p);     if (x <= (l + r) / 2)       return query(ls[p], l, (l + r) / 2);     else       return query(rs[p], (l + r) / 2 + 1, r);   }   int main() {     int i, j, q;     long long tx, ty;     scanf( %d%d%d , &n, &tg, &tr);     mod = tg + tr;     for (i = 1; i <= n + 1; i++) scanf( %I64d , &a[i]);     for (i = 1; i <= n + 1; i++) a[i] += a[i - 1];     for (i = n; i >= 1; i--) {       x = mod - a[i] % mod;       y = query(root, 1, mod);       if (!y)         b[i] = 0;       else         b[i] = b[y] + (mod - (a[y] - a[i]) % mod);       tx = ((tg - a[i]) % mod + mod - 1) % mod + 1;       ty = ((mod - 1 - a[i]) % mod + mod - 1) % mod + 1;       z = i;       if (tx <= ty) {         x = tx;         y = ty;         change(root, 1, mod);       } else {         x = 1;         y = ty;         change(root, 1, mod);         x = tx;         y = mod;         change(root, 1, mod);       }     }     scanf( %d , &nq);     for (q = 1; q <= nq; q++) {       scanf( %d , &x);       ans = x + a[n + 1];       x = (x - 1) % mod + 1;       y = query(root, 1, mod);       if (y) ans += mod - (a[y] + x) % mod + b[y];       printf( %I64d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   istream &operator>>(istream &in, vector<T> &arr) {     for (auto &x : arr) in >> x;     return in;   }   long long n, m;   const long long N = 1e6 + 100;   vector<pair<long long, long long>> g[N];   long long col[N];   bool cyc;   long long res[N];   void dfs(long long r) {     col[r] = 1;     for (auto x : g[r]) {       long long to = x.first, ind = x.second;       if (col[to] == 0) {         res[ind] = 1;         dfs(to);       } else if (col[to] == 1) {         res[ind] = 2;         cyc = true;       } else {         res[ind] = 1;       }     }     col[r] = 2;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cin >> n >> m;     for (long long i = 0; i < m; ++i) {       long long u, v;       cin >> u >> v;       --u, --v;       g[u].push_back({v, i});     }     for (long long i = 0; i < n; ++i) {       if (col[i] == 0) {         dfs(i);       }     }     cout << (cyc ? 2 : 1) <<   n ;     for (long long i = 0; i < m; ++i) {       cout << res[i] <<    ;     }   }
#include <bits/stdc++.h>   using namespace std;   char s1[1010000];   char s2[1010000];   int main() {     scanf( %s , s1);     scanf( %s , s2);     int len1, len2, i;     len1 = strlen(s1);     len2 = strlen(s2);     int ans;     if (len1 - len2)       ans = 0;     else if (len1 == 1) {       if (s1[0] == s2[0])         ans = 1;       else         ans = 0;     } else {       if (strcmp(s1, s2) == 0)         ans = 1;       else {         int j1, j2;         j1 = j2 = 0;         for (i = 0; s1[i]; ++i)           if (s1[i] ==  1 ) j1 = 1;         for (i = 0; s2[i]; ++i)           if (s2[i] ==  1 ) j2 = 1;         if (j1 && j2)           ans = 1;         else           ans = 0;       }     }     if (ans)       puts( YES );     else       puts( NO );   }
#include <bits/stdc++.h>   using namespace std;   int N, M, lb[300010], ind[300010];   vector<int> g[300010], g2[300010];   int val[300010];   bool viz[300010];   int dfs(int nod, int v) {     val[nod] = v;     viz[nod] = 1;     for (int nxt : g2[nod]) {       if (viz[nxt]) continue;       return dfs(nxt, v + 1);     }     return nod;   }   int main() {     cin >> N >> M;     int i, x, y;     for (i = 1; i <= M; i++) {       cin >> x >> y;       g[x].push_back(y);       g[y].push_back(x);     }     for (i = 1; i <= N; i++) {       g[i].push_back(i);       sort(g[i].begin(), g[i].end());       ind[i] = i;     }     sort(ind + 1, ind + N + 1, [](int x, int y) { return g[x] < g[y]; });     lb[ind[1]] = 1;     for (i = 2; i <= N; i++)       if (g[ind[i]] == g[ind[i - 1]])         lb[ind[i]] = lb[ind[i - 1]];       else         lb[ind[i]] = 1 + lb[ind[i - 1]];     for (i = 1; i <= N; i++)       for (int nxt : g[i]) {         if (lb[nxt] == lb[i]) continue;         g2[lb[i]].push_back(lb[nxt]);       }     int cr = dfs(1, 1);     memset(val, 0, sizeof(val));     memset(viz, 0, sizeof(viz));     dfs(cr, 1);     for (i = 1; i <= lb[ind[N]]; i++)       if (val[i] == 0) {         cout <<  NO n ;         return 0;       }     cout <<  YES n ;     for (i = 1; i <= N; i++) cout << val[lb[i]] <<    ;     cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int INF = 9223372036854775807LL;   #pragma GCC optimize( Ofast )   #pragma GCC target( avx,avx2,fma )   #pragma GCC optimization( unroint-loops )   long long int power(long long int b, long long int e, long long int m) {     if (b == 0) return 0;     if (e == 0) return 1;     if (e & 1) return b * power(b * b % m, e / 2, m) % m;     return power(b * b % m, e / 2, m);   }   long long int power(long long int b, long long int e) {     if (b == 0) return 0;     if (e == 0) return 1;     if (e & 1) return b * power(b * b, e / 2);     return power(b * b, e / 2);   }   bool isPowerOfTwo(long long int x) { return (x && !(x & (x - 1))); }   void solve() {     long long int n, m;     cin >> n >> m;     vector<long long int> v(n + 1);     cin >> v[1];     for (long long int i = 2; i <= n; i++) {       cin >> v[i];       v[i] += v[i - 1];     }     long long int ans = 0;     while (m--) {       long long int a, b;       cin >> a >> b;       if (v[b] - v[a - 1] >= 0) ans += v[b] - v[a - 1];     }     cout << ans;   }   signed main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long int tt = 1;     for (long long int i = 1; i <= tt; i++) {       solve();       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX = 1e5 + 55;   int x[MAX];   long long poww(long long x, long long y) {     if (y == 0) return 1;     long long s = poww(x, y / 2);     s = (s * s);     if (y % 2 == 1) s = (s * x);     return s;   }   int main() {     string s =  OYGR ;     string c =  BIV ;     int t = 0;     int n;     cin >> n;     string b =   ;     for (int i = 0; i < n - 3; i++) {       if (t == 4) t = 0;       b += s[t];       t++;     }     cout << b + c;     return 0;   }
#include <bits/stdc++.h>   int a[1511];   int main() {     int n, m, i, j, s(0);     scanf( %d , &n);     for (i = 0; i < n; ++i) scanf( %d , &a[i]);     for (i = 0; i < n; ++i)       for (j = i + 1; j < n; ++j)         if (a[i] > a[j]) s ^= 1;     scanf( %d , &m);     while (m--) {       scanf( %d%d , &i, &j);       if ((j - i + 1) * (j - i) / 2 & 1) s ^= 1;       printf( %s n , s ?  odd  :  even );     }     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:1000000000 )   #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops )   using namespace std;   const int maxn = (int)1e5 + 10;   struct vt {     long double x, y;   };   vt operator-(vt a, vt b) {     a.x -= b.x;     a.y -= b.y;     return a;   }   vt operator+(vt a, vt b) {     a.x += b.x;     a.y += b.y;     return a;   }   vt operator*(vt a, long double x) {     a.x *= x;     a.y *= x;     return a;   }   long double dst(vt a) { return hypotl(a.x, a.y); }   vt operator/(vt a, long double x) {     a.x /= x;     a.y /= x;     return a;   }   const long double eps = 1e-18;   vector<vt> inter(vt a, long double r) {     long double d = dst(a);     if (d * d <= r * r) {       return {};     }     long double x = r * r / d;     long double y = r * sqrt(1. - (r / d) * (r / d));     vt b = a * (x / dst(a));     vt n = {-a.y, a.x};     n = n / dst(n);     return {b - n * y, b + n * y};   }   long double operator*(vt a, vt b) { return a.x * b.y - a.y * b.x; }   int tp(vt a) { return a.y > eps || (abs(a.y) < eps && a.x > eps); }   vt v[maxn];   bool operator<(vt a, vt b) {     int tpa = tp(a);     int tpb = tp(b);     if (tpa != tpb) {       return tpa < tpb;     }     return a * b > eps;   }   int tr[4 * maxn];   void change(int pos) {     for (; pos < 4 * maxn; pos |= pos + 1) {       tr[pos]++;     }   }   int go(int pos) {     int ans = 0;     for (; pos >= 0; pos = (pos & (pos + 1)) - 1) {       ans += tr[pos];     }     return ans;   }   int go(int l, int r) { return go(r) - go(l - 1); }   ostream& operator<<(ostream& out, vt a) { return out << a.x <<     << a.y; }   mt19937 rr;   int main() {     int n;     long long k;     cin >> n >> k;     for (int i = 0; i < n; i++) {       cin >> v[i].x >> v[i].y;     }     k = (long long)n * (n - 1) / 2 - k;     long double l = 0;     long double r = sqrt(2.) * 1e4;     for (int itr = 0; itr < 36; itr++) {       long double m = (l + r) / 2;       vector<vt> g;       vector<pair<vt, vt> > f;       for (int i = 0; i < n; i++) {         auto a = inter(v[i], m);         if (a.empty()) {           continue;         }         f.push_back(make_pair(a[0], a[1]));         g.push_back(a[0]);         g.push_back(a[1]);       }       sort((g).begin(), (g).end());       vector<pair<int, int> > a;       memset(tr, 0, sizeof tr);       for (int i = 0; i < (int)f.size(); i++) {         a.push_back(make_pair(             lower_bound((g).begin(), (g).end(), f[i].first) - g.begin(),             lower_bound((g).begin(), (g).end(), f[i].second) - g.begin()));         if (a.back().first > a.back().second) {           change(a.back().second);           a.back().second += (int)g.size();         }       }       sort((a).begin(), (a).end());       long long tot = 0;       for (int i = 0; i < (int)a.size(); i++) {         tot += go(a[i].first, a[i].second);         change(a[i].second);       }       if (tot <= k) {         r = m;       } else {         l = m;       }     }     printf( %.10lf n , (double)r);   }
#include<bits/stdc++.h>      using namespace std;      #define mp make_pair   #define fi first   #define se second   #define pb push_back   #define FOR(i,a,b) for(int i=a;i<=b;i++)   #define FORD(i,a,b) for(int i=a;i>=b;i--)   #define faster() ios_base::sync_with_stdio(0); cin.tie(NULL);cout.tie(NULL);      typedef long long ll;   typedef vector<int> vi;   typedef vector<ll> vll;      int main()   {       faster();       int t;       cin>>t;       while(t--)       {           int a[4];           FOR(i,0,3) cin>>a[i];           int max1=max(a[0],a[1]),max2=max(a[2],a[3]);           sort(a,a+4);           if(max1>max2 && max1==a[3] && max2==a[2]) cout<< YES <<endl;           else if(max1<max2 && max2==a[3] && max1==a[2]) cout<< YES <<endl;           else cout<< NO <<endl;       }       return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline long long read() {     long long sum = 0, ff = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) {         ff = -1;       }       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       sum = sum * 10 + ch - 48;       ch = getchar();     }     return sum * ff;   }   void write(long long x) {     if (x < 0) putchar( - ), x = -x;     if (x > 9) write(x / 10);     putchar(x % 10 +  0 );   }   const int N = 1000007;   int n, m;   struct edge {     int from, to, dis, next;   } e[N], a[N];   int he[N], cnt;   void add(int u, int v, int w) {     e[++cnt].from = u;     e[cnt].to = v;     e[cnt].dis = w;     e[cnt].next = he[u];     he[u] = cnt;   }   bool cmp(edge x, edge y) {     if (x.from == y.from) return x.to < y.to;     return x.from < y.from;   }   int col[N];   queue<int> q;   struct node {     int pos, dis;   };   queue<node> que;   bool vis[N];   int bfs() {     que.push((node){n, 0});     vis[n] = true;     while (!que.empty()) {       node now = que.front();       que.pop();       if (now.pos == 1) return now.dis;       for (int i = he[now.pos]; i; i = e[i].next) {         int v = e[i].to;         if (vis[v]) continue;         if (col[v] == -1 || col[v] == 1 - e[i].dis)           col[v] = 1 - e[i].dis;         else {           vis[v] = true;           que.push((node){v, now.dis + 1});         }       }     }     return -1;   }   map<pair<int, int>, bool> mp;   int main() {     n = read(), m = read();     for (int i = 1; i <= m; i++) {       a[i].from = read(), a[i].to = read(), a[i].dis = read();       add(a[i].to, a[i].from, a[i].dis);     }     memset(col, -1, sizeof(col));     write(bfs()), puts(  );     for (int i = 1; i <= n; i++)       if (col[i] == -1)         printf( 0 );       else         write(col[i]);     return 0;   }