malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   vector<long long> v[200010];   vector<long long> traversal;   long long cnt;   long long color[200010];   long long start[200010];   long long enddd[200010];   void dfs(long long curr) {     start[curr] = cnt;     traversal.push_back(curr);     cnt++;     for (int i = 0; i < v[curr].size(); i++) {       dfs(v[curr][i]);     }     enddd[curr] = cnt;   }   long long tree[800010];   long long lazy[800010];   void build_tree(int node, int a, int b) {     if (a > b) return;     if (a == b) {       tree[node] = color[traversal[a]];       return;     }     build_tree(node * 2, a, (a + b) / 2);     build_tree(node * 2 + 1, 1 + (a + b) / 2, b);     tree[node] = tree[node * 2] + tree[node * 2 + 1];   }   void update_tree(int node, int a, int b, int i, int j, int value) {     if (lazy[node] != 0) {       tree[node] = (b - a + 1 - tree[node]);       if (a != b) {         lazy[node * 2] += lazy[node];         lazy[node * 2 + 1] += lazy[node];         lazy[node * 2] %= 2;         lazy[node * 2 + 1] %= 2;       }       lazy[node] = 0;     }     if (a > b || a > j || b < i) return;     if (a >= i && b <= j) {       tree[node] = (b - a + 1 - tree[node]);       if (a != b) {         lazy[node * 2] += value;         lazy[node * 2 + 1] += value;         lazy[node * 2] %= 2;         lazy[node * 2 + 1] %= 2;       }       return;     }     update_tree(node * 2, a, (a + b) / 2, i, j, value);     update_tree(1 + node * 2, 1 + (a + b) / 2, b, i, j, value);     tree[node] = tree[node * 2] + tree[node * 2 + 1];   }   int query_tree(int node, int a, int b, int i, int j) {     if (a > b || a > j || b < i) return 0;     if (lazy[node] != 0) {       tree[node] = (b - a + 1 - tree[node]);       if (a != b) {         lazy[node * 2] += lazy[node];         lazy[node * 2 + 1] += lazy[node];         lazy[node * 2] %= 2;         lazy[node * 2 + 1] %= 2;       }       lazy[node] = 0;     }     if (a >= i && b <= j) return tree[node];     int q1 = query_tree(node * 2, a, (a + b) / 2, i, j);     int q2 = query_tree(1 + node * 2, 1 + (a + b) / 2, b, i, j);     int res = q1 + q2;     return res;   }   char str[4];   int main() {     long long n, temp;     cin >> n;     cnt = 0;     for (int i = 2; i <= n; i++) {       cin >> temp;       v[temp].push_back(i);     }     for (int i = 1; i <= n; i++) {       cin >> color[i];     }     dfs(1);     build_tree(1, 0, cnt - 1);     long long q;     cin >> q;     long long vertex;     while (q--) {       scanf( %s , str);       cin >> vertex;       if (str[0] ==  p ) {         update_tree(1, 0, cnt - 1, start[vertex], enddd[vertex] - 1, 1);       } else {         cout << query_tree(1, 0, cnt - 1, start[vertex], enddd[vertex] - 1)              << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   map<int, int> M;   long long posSum[300001];   int A[300001];   int main() {     int N;     cin >> N;     for (int i = 1; i <= N; i++) cin >> A[i];     posSum[0] = 0;     for (int i = 1; i <= N; i++) {       if (A[i] < 0)         posSum[i] = posSum[i - 1];       else         posSum[i] = posSum[i - 1] + A[i];     }     int a = 1;     int b = N;     long long best = -1000000000000000LL;     long long cur;     for (int i = 1; i <= N; i++) {       if (M.find(A[i]) != M.end()) {         if (A[i] < 0)           cur = 2LL * A[i] + posSum[i] - posSum[M[A[i]]];         else           cur = posSum[i] - posSum[M[A[i]] - 1];         if (best < cur) {           best = cur;           a = M[A[i]];           b = i;         }       } else         M[A[i]] = i;     }     int cnt = 0;     for (int i = 1; i <= N; i++) {       if ((i < a) || (i > b) || ((i > a) && (i < b) && (A[i] < 0))) cnt++;     }     cout << best <<     << cnt <<   n ;     for (int i = 1; i <= N; i++)       if ((i < a) || (i > b) || ((i > a) && (i < b) && (A[i] < 0)))         cout << i <<    ;     cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long A = 100000000000000LL, N = 10000, M = 1000001;   long long i, j, n, m, a, t[M * 4];   void modi(long long v, long long l, long long r, long long g, long long h) {     if (l == r) {       t[v] = h % 1000000007;       return;     }     long long mid = (l + r) / 2;     if (g <= mid)       modi(v * 2, l, mid, g, h);     else       modi(v * 2 + 1, mid + 1, r, g, h);     t[v] = (t[v * 2] + t[v * 2 + 1]) % 1000000007;   }   long long get(long long v, long long l, long long r, long long _l,                 long long _r) {     if (l > r || _l > _r) return 0;     if (l == _l && r == _r) return t[v];     long long mid = (l + r) / 2;     return get(v * 2, l, mid, _l, min(mid, _r)) +            get(v * 2 + 1, mid + 1, r, max(mid + 1, _l), _r);   }   int main() {     cin >> n;     for (i = 0; i < n; i++) {       cin >> a;       modi(1, 1, M, a, get(1, 1, M, 1, a) * a + a);     }     cout << get(1, 1, M, 1, M);   }
#include <bits/stdc++.h>   using namespace std;   int p[300002], pi;   bool tag[300002];   int main() {     int n, x;     long long cnt;     while (scanf( %d , &n) != EOF) {       memset(tag, false, sizeof(tag));       pi = 0;       for (int i = 0; i < n; i++) {         scanf( %d , &x);         if (x < 1 || x > n || tag[x])           p[pi++] = x;         else           tag[x] = true;       }       sort(p, p + pi);       cnt = 0;       for (int i = 0, j = 1; i < pi; i++, j++) {         while (tag[j]) j++;         cnt += (long long)abs(p[i] - j);       }       printf( %I64d n , cnt);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 410000;   char ch[N];   int a[N];   int n, t;   int main() {     scanf( %d%d , &n, &t);     scanf( %s , ch + 1);     if (t == 0) {       printf( %s , ch + 1);       return 0;     }     int s = 0;     for (int i = 1; i <= n; i++) {       if (ch[i] ==  . )         s = i + 1;       else if (s == 0)         a[i + 1] = ch[i] -  0 ;       else         a[i] = ch[i] -  0 ;     }     int ok = 0;     for (int i = s; i <= n; i++)       if (a[i] >= 5) {         n = i - 1;         ok = 1;         t--;         a[i - 1]++;         break;       }     if (ok == 0) {       printf( %s , ch + 1);       return 0;     }     while (t && n >= s && a[n] >= 5) {       a[n - 1]++;       a[n] %= 10;       if (a[n]) t--;       n--;     }     while (n >= s && a[n] == 0) n--;     for (int i = n - 1; i >= 1; i--) a[i] += a[i + 1] / 10, a[i + 1] %= 10;     if (a[1]) printf( %d , a[1]);     for (int i = 2; i <= n; i++) {       if (i == s) printf( . );       printf( %d , a[i]);     }   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   int const N = 222;   int const M = 1e9 + 7;   int n;   ll f[N][N];   struct point {     ll x, y;     point(ll _x = 0, ll _y = 0) : x(_x), y(_y) {}     ll operator*(const point &rhs) const { return x * rhs.y - y * rhs.x; }     point operator-(const point &rhs) const {       return point(x - rhs.x, y - rhs.y);     }   } p[N];   int main() {     scanf( %d , &n);     for (int i = 0; i < n; ++i) scanf( %I64d%I64d , &p[i].x, &p[i].y);     ll area = 0;     for (int i = 1; i + 1 < n; ++i) area += (p[i] - p[0]) * (p[i + 1] - p[0]);     if (area < 0) reverse(p, p + n);     for (int i = 0; i < n; ++i) f[i][i] = f[i][(i + 1) % n] = 1;     for (int step = 2; step < n; ++step)       for (int i = 0; i < n; ++i) {         int j = (i + step) % n;         for (int t = 1; t <= step - 1; ++t) {           int k = (i + t) % n;           if ((p[k] - p[i]) * (p[j] - p[i]) > 0) {             f[i][j] = (f[i][j] + f[i][k] * f[k][j]) % M;           }         }       }     printf( %I64d n , f[0][n - 1]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void think() {     long long n, m;     cin >> n >> m;     vector<long long> v(n);     for (long long i = 0; i < n; i++) {       cin >> v[i];     }     long long ans = 0;     for (long long i = 0; i < m; i++) {       long long x, y;       cin >> x >> y;       ans += min(v[x - 1], v[y - 1]);     }     cout << ans <<   n ;   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     ;     long long testcase = 1;     while (testcase--) {       think();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long t;     cin >> t;     while (t--) {       long long n;       cin >> n;       long long k = (n + 1) / 2;       k = k - 1;       long long ans = 0;       for (long long i = 1; i <= k; ++i) {         ans += 8 * i * i;       }       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e4 + 5;   int n, q;   bool possible[MAXN];   vector<int> seg[4 * MAXN];   void update(int u, int l, int r, int tl, int tr, int x) {     if (l > tr || r < tl)       return;     else if (l <= tl && tr <= r) {       seg[u].push_back(x);     } else {       int tm = (tl + tr) / 2;       update(u << 1, l, r, tl, tm, x);       update(u << 1 | 1, l, r, tm + 1, tr, x);     }   }   void query(int u, int tl, int tr, bitset<MAXN> parsums) {     bitset<MAXN> sums = parsums;     for (int v : seg[u]) {       sums |= sums << v;     }     for (int i = 1; i <= n; ++i) {       possible[i] |= sums[i];     }     if (tl != tr) {       int tm = (tl + tr) / 2;       query(2 * u, tl, tm, sums);       query(2 * u + 1, tm + 1, tr, sums);     }   }   int main() {     cin >> n >> q;     while (q--) {       int l, r, x;       cin >> l >> r >> x;       update(1, l, r, 1, n, x);     }     query(1, 1, n, bitset<MAXN>(1));     int cnt = 0;     for (int i = 0; i <= n; ++i) {       if (possible[i]) {         ++cnt;       }     }     cout << cnt <<   n ;     for (int i = 0; i <= n; ++i) {       if (possible[i]) {         cout << i <<    ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int f[100010], g[100010];   int _Max(int x, int y) { return x > y ? x : y; }   void upd(int x, int ans, int k) {     if (f[x] < ans)       f[x] = ans, g[x] = k;     else if (f[x] == ans && k < g[x])       g[x] = k;   }   int main() {     int n, L, p, t, i, j, l = 1, r = 0, x, y, s = 0, ans = 0;     scanf( %d%d%d%d , &L, &n, &p, &t);     for (i = 1; i <= n; i++) {       scanf( %d%d , &x, &y);       while (r < i - 1 && g[r + 1] + t <= y) r++;       while (l < i && g[l] + t <= x) s = _Max(s, f[l++]);       f[i] = -1;       upd(i, s + (y - x) / p, x + (y - x) / p * p);       for (j = l; j <= r; j++)         upd(i, f[j] + (y - g[j] - t) / p, g[j] + t + (y - g[j] - t) / p * p);       ans = _Max(ans, f[i]);     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:256000000 )   using namespace std;   template <class T>   double sqrt(T x) {     return sqrt((double)x);   }   template <class T>   T sqr(T x) {     return x * x;   }   const double PI = acos(-1.0);   const int INF = 1000000000;   const int MOD = 1000000007;   void wa() {     cout << 5;     exit(0);   }   void tl() {     while (1)       ;   }   void pe() {     cout <<  abc abc n 453534 wff sf sd n ;     exit(0);   }   void re() { exit(1); }   void ml() { int *b = new int[1000]; }   int main() {     double TIME_START = clock();     int n;     cin >> n;     unsigned long long ans = 1, lay;     if (n >= 2) {       lay = 12;       for (int x = 2; x <= n; x++) {         ans += lay;         lay += 12;       }     }     cout << ans;     fprintf(stderr,   n n%.15lf n n ,             (double)(clock() - TIME_START) / CLOCKS_PER_SEC);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long M = 998244353;   const long long inf = 4e18;   const long long N = 3e5;   long long fac[N + 1];   long long power(long long x, long long y) {     if (y < 0) return power(x, M - 2) * power(x, y + 1) % M;     y %= (M - 1);     long long res = 1;     while (y > 0) {       if (y & 1) res = res * x % M;       y = y >> 1;       x = x * x % M;     }     return res;   }   void factorial() {     fac[0] = 1;     for (long long i = 1; i <= N; i++) fac[i] = fac[i - 1] * i % M;   }   long long nCr(long long n, long long r) {     if (r > n || r < 0) return 0;     if (r == 0) return 1;     return (fac[n] * power(fac[r], M - 2) % M * power(fac[n - r], M - 2) % M) % M;   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     factorial();     long long n, k;     cin >> n >> k;     vector<pair<long long, long long> > v;     vector<long long> right;     for (long long i = 0; i < n; i++) {       long long l, r;       cin >> l >> r;       v.emplace_back(l, r);       right.emplace_back(r);     }     sort(v.begin(), v.end());     sort(right.begin(), right.end());     long long o = 0;     for (long long i = 0; i < n; i++) {       long long j =           upper_bound(v.begin(), v.end(), make_pair(right[i], inf)) - v.begin();       o = (o + nCr(j - i - 1, k - 1)) % M;     }     cout << o <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n;     cin >> n;     vector<long long int> cost(n);     for (long long int i = 0; i < n; i++) {       cin >> cost[i];     }     sort(cost.begin(), cost.end());     long long int m;     cin >> m;     vector<long long int> coup(m);     for (long long int i = 0; i < m; i++) {       cin >> coup[i];     }     long long int temp_sum = 0;     for (long long int i = 0; i < n; i++) {       temp_sum += cost[i];     }     for (long long int i = 0; i < m; i++) {       cout << temp_sum - cost.at(n - coup[i]) << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   bool chk[5000050];   int ara[5000050], sum[5000050];   void sieve() {     int i, j, k, x, y, z;     for (i = 2; i <= 5000000; i++)       if (!chk[i]) {         for (j = i; j <= 5000000; j += i) {           x = 0;           k = j;           while (k % i == 0) {             x++;             k /= i;           }           chk[j] = true;           ara[j] += x;         }       }     sum[2] = ara[2];     for (i = 3; i <= 5000000; i++) sum[i] = sum[i - 1] + ara[i];   }   int main() {     sieve();     int i, t, n, m, k, ans;     scanf( %d , &t);     for (i = 0; i < t; i++) {       scanf( %d %d , &m, &n);       ans = sum[m] - sum[n];       printf( %d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 100100;   string S;   int N;   int Z[MAXN];   int len[MAXN];   void Zalg() {     int L = 0, R = 0;     for (int i = 1; i < N; i++) {       if (i > R) {         L = R = i;         while (R < N && S[R] == S[R - L]) R++;         Z[i] = R - L;         R--;       } else {         int j = i - L;         if (Z[j] < R - i + 1)           Z[i] = Z[j];         else {           L = i;           while (R < N && S[R] == S[R - L]) R++;           Z[i] = R - L;           R--;         }       }     }   }   int main() {     cin >> S;     N = S.size();     Z[0] = N;     Zalg();     memcpy(len, Z, sizeof(len));     sort(len, len + N);     int total = 0;     for (int i = 1; i <= N; i++)       if (Z[N - i] == i) total++;     cout << total <<   n ;     int idx = 0;     for (int i = 1; i <= N; i++) {       if (Z[N - i] != i) continue;       while (idx < N && len[idx] < i) idx++;       cout << i <<     << N - idx <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int x[4];   int y[4];   int ii[4] = {1, -1, 0, 0};   int jj[4] = {0, 0, -1, 1};   int main() {     ios_base::sync_with_stdio(0);     int x1, x2, x3, y1, y2, y3;     for (int i = 1; i <= 3; i++) {       cin >> x[i] >> y[i];     }     set<pair<int, int>> s;     long long xx = 0, yy = 0;     long long d = 1e9;     for (int j = 0; j <= 1000; j++) {       for (int i = 0; i <= 1000; i++) {         if (abs(x[1] - i) + abs(y[1] - j) + abs(x[2] - i) + abs(y[2] - j) +                 abs(x[3] - i) + abs(y[3] - j) <             d) {           xx = i;           yy = j;           d = abs(x[1] - i) + abs(y[1] - j) + abs(x[2] - i) + abs(y[2] - j) +               abs(x[3] - i) + abs(y[3] - j);         }       }     }     for (int t = 1; t <= 3; t++) {       int i, j;       i = xx;       j = yy;       s.insert({x[t], y[t]});       while (i != x[t] || j != y[t]) {         s.insert({i, j});         for (int e = 0; e < 4; e++) {           if (abs(i - x[t]) > abs(i + ii[e] - x[t]) ||               abs(j - y[t]) > abs(j + jj[e] - y[t])) {             i += ii[e];             j += jj[e];             break;           }         }       }     }     cout << s.size() <<   n ;     for (auto p : s) {       cout << p.first <<     << p.second <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int N, M;   int Candidates[100];   int main() {     cin >> N >> M;     for (int i = 0; i < M; i++) {       int MaxVotesNum = -1;       int idx = -1;       for (int j = 0; j < N; j++) {         int Temp;         cin >> Temp;         if (MaxVotesNum < Temp) {           MaxVotesNum = Temp;           idx = j;         }       }       Candidates[idx]++;     }     cout << (max_element(Candidates, Candidates + 100) - Candidates) + 1 << endl;   }
#include <bits/stdc++.h>   using namespace std;   int arr[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};   void solve() {     int d, x;     int a, b;     cin >> a >> b;     int ans = 0;     for (int i = a; i <= b; i++) {       x = i;       while (x) {         d = x % 10;         x = x / 10;         ans += arr[d];       }     }     cout << ans << endl;   }   int main() {     int t = 1;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   int lss[2000][2000] = {};   int main() {     string s;     cin >> s;     int n = s.length();     if (n == 1) {       cout << 0 << endl;       return 0;     }     for (int i = 0; i < n; i++) {       lss[i][i] = 1;       int temp = s[i];       int zero = 0;       if (s[i] ==  0 ) {         zero++;       }       for (int j = i + 1; j < n; j++) {         if (s[j] ==  1 ) {           lss[i][j] = lss[i][j - 1] + 1;         } else {           zero++;           lss[i][j] = max(zero, lss[i][j - 1]);         }       }     }     for (int i = 0; i < n; i++) {       if (s[i] ==  0 ) {         continue;       }       int temp1 = 0;       int zero = 0;       for (int j = 0; j <= i; j++) {         if (j != i && s[j] ==  1 ) {           temp1 = temp1 + 1;         } else {           zero++;           temp1 = max(zero, temp1);         }       }       int temp2 = 0;       zero = 0;       for (int j = i; j < n; j++) {         if (j != i && s[j] ==  1 ) {           temp2 = temp2 + 1;         } else {           zero++;           temp2 = max(zero, temp2);         }       }       if (temp1 == lss[0][i] && temp2 == lss[i][n - 1]) {         s[i] =  0 ;       }     }     cout << s << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const bool OJ = true;   const long long inf = 1LL << 60;   template <class T>   ostream& operator<<(ostream& os, const vector<T>& v) {     for (long long i = 0; i < (((long long)((v).size()))); i++) os << v[i] <<    ;     return os;   }   template <class T>   istream& operator>>(istream& is, vector<T>& v) {     for (long long i = 0; i < (((long long)((v).size()))); i++) is >> v[i];     return is;   }   template <class A, class B>   istream& operator>>(istream& is, tuple<A, B>& p) {     is >> get<0>(p) >> get<1>(p);     return is;   }   long long dp[100005][30];   string s;   long long k;   vector<tuple<char, char>> f;   bool ok(char x, char y) {     return !binary_search((f).begin(), (f).end(), make_tuple(x, y));   }   long long solve(long long i, char prev) {     if (i == ((long long)((s).size()))) return 0;     long long& d = dp[i][prev - 26];     if (d != -1) return d;     long long ans = inf;     if (ok(prev, s[i])) {       ans = min(ans, solve(i + 1, s[i]));     }     ans = min(ans, 1 + solve(i + 1, prev));     return d = ans;   }   void run() {     cin >> s;     cin >> k;     f = vector<tuple<char, char>>();     for (long long i = 0; i < (k); i++) {       string tmp;       cin >> tmp;       char x = tmp[0];       char y = tmp[1];       f.emplace_back(x, y);       f.emplace_back(y, x);     }     sort((f).begin(), (f).end());     memset(dp, -1, sizeof(dp));     cout << solve(0,  a  + 28) << endl;   }   int main(int argc, char* argv[]) {     run();     return 0;   }
#include <bits/stdc++.h>   template <class C, class E>   inline bool contains(const C& container, const E& element) {     return container.find(element) != container.end();   }   template <class T>   inline void checkmin(T& a, T b) {     if (b < a) a = b;   }   template <class T>   inline void checkmax(T& a, T b) {     if (b > a) a = b;   }   using namespace std;   int n;   string s;   bool Check(int i) {     if (i == 0) return true;     vector<bool> d(10, false);     while (i != 0) {       int dig = i % 10;       if (d[dig]) return false;       d[dig] = true;       i = i / 10;     }     return true;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     cout << std::setprecision(15);     cout << std::fixed;     int l, r;     cin >> l >> r;     for (int i = (l), _b = (r); i <= _b; i++) {       if (Check(i)) {         cout << i;         return 0;       }     }     cout << -1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct debugger {     template <typename T>     debugger& operator,(const T& x) {       clog << x <<    ;       return *this;     }   } dbg;   auto ____ = []() {     std::ios::sync_with_stdio(false);     cin.tie(nullptr);     return nullptr;   }();   int main(int argc, char* argv[]) {     int n, K;     cin >> n >> K;     vector<pair<int, int> > edges(n - 1);     vector<vector<pair<int, int> > > g(n);     for (int i = 0; i < (n - 1); ++i) {       int x, y;       cin >> x >> y;       --x, --y;       edges[i].first = x, edges[i].second = y;       g[x].push_back(make_pair(y, i));       g[y].push_back(make_pair(x, i));     }     vector<pair<int, int> > deg(n);     for (int i = 0; i < (n); ++i) deg[i] = make_pair((int)(g[i]).size(), i);     sort(deg.begin(), deg.end(), greater<pair<int, int> >());     int R = deg[K].first;     vector<int> edge_color(n - 1, -1);     stack<pair<int, int> > S;     S.push(make_pair(0, -1));     while (!S.empty()) {       auto p = S.top();       S.pop();       int x = p.first, c = p.second;       int d = 0;       for (auto y : g[x]) {         d %= R;         if (edge_color[y.second] == -1) {           if (R == 1)             d = 0;           else if (d == c) {             d++;             d %= R;           }           edge_color[y.second] = d;           S.push(make_pair(y.first, d));           ++d;         }       }     }     cout << R <<   n ;     for (auto c : edge_color) {       cout << c + 1 <<    ;     }     cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     while (cin >> n) {       int res[100];       memset(res, 0, sizeof(res));       for (int i = 0; i < n; ++i) {         for (int j = 0; j < n; ++j) {           int r;           cin >> r;           if (i < j) continue;           switch (r) {             case 1:               ++res[i];               break;             case 2:               ++res[j];               break;             case 3:               ++res[i];               ++res[j];             default:               break;           }         }       }       int count = 0;       for (int i = 0; i < n; ++i) {         if (res[i] == 0) {           res[count++] = i + 1;         }       }       cout << count << endl;       if (count > 0) {         for (int i = 0; i < count; ++i) {           cout << res[i] <<    ;         }         cout << endl;       }     }     return 0;   }