malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   int main() {     char jak[1000005], tak[1000005];     gets(jak);     gets(tak);     int k, r, i, t, flag = 0, count = 0, fount = 0, f, x, y, j, p = 0;     k = strlen(jak);     r = strlen(tak);     for (i = 0; i < k; i++) {       t = jak[i] - 48;       if (t != 0 && flag == 0) {         flag = 1;         x = i;       }       if (flag == 1) {         count++;       }     }     flag = 0;     for (i = 0; i < r; i++) {       f = tak[i] - 48;       if (f != 0 && flag == 0) {         flag = 1;         y = i;       }       if (flag == 1) {         fount++;       }     }     if (count > fount) {       printf( > );     } else if (count < fount) {       printf( < );     } else if (count == 0) {       printf( = );     } else {       for (i = x, j = y; i < k, j < r; i++, j++) {         if (jak[i] > tak[j]) {           printf( > );           break;         } else if (jak[i] < tak[j]) {           printf( < );           break;         } else {           p++;         }       }       if (p == count) {         printf( = );       }     }   }
#include <bits/stdc++.h>   using namespace std;   void dbg_out() { cerr <<   b b] n ; }   template <typename Head, typename... Tail>   void dbg_out(Head H, Tail... T) {     cerr << H <<  ,  ;     dbg_out(T...);   }   const int mod = 1e9 + 7;   long long power(long long a, long long b) {     long long res = 1;     while (b) {       if (b & 1) res = res * a % mod;       a = a * a % mod;       b >>= 1;     }     return res;   }   long long modMul(long long a, long long b) { return a * b % mod; }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     int n, k;     cin >> n >> k;     vector<int> A(n / k), B(n / k);     for (int &i : A) cin >> i;     for (int &i : B) cin >> i;     long long ans = 1;     long long tens = power(10, k - 1);     for (int i = 0; i < n / k; ++i) {       long long tot = (tens * 10 - 1) / A[i] + 1;       long long lo = B[i] * tens;       long long hi = B[i] * tens + tens - 1;       long long invalid = hi / A[i] - lo / A[i] + (lo % A[i] == 0);       tot -= invalid;       ans = modMul(ans, tot);     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     int t, n, a[1000000], i, j, b = 0, c = 0, e, f, g, h, m[1000000];     cin >> t;     for (i = 0; i < t; i++) {       cin >> n;       h = n;       for (j = 1; j <= n; j++) {         cin >> a[j];       }       sort(a + 1, a + n + 1);       for (j = 1; j <= n; j++) {         if (b == 0) {           m[j] = a[j - c];           b = 1;         } else {           m[j] = a[n - c];           b = 0;           c++;         }       }       for (j = n; j >= 1; j--) {         cout << m[j] <<    ;       }       cout << endl;       b = 0;       c = 0;     }   }
#include <bits/stdc++.h>   #pragma GCC optimize(3)   using namespace std;   const long long maxnodes = 1005;   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     string t;     cin >> t;     long long n = t.size();     string s1(n,  a ), s2(n,  a ), s3(n,  a );     string t1, t2, t3;     for (long long i = 0; i < n; i++) {       s1[i] = char( a  + i % 26);       s2[i] = char( a  + (i / 26) % 26);       s3[i] = char( a  + ((i / 26) / 26) % 26);     }     cout <<  ?   << s1 << endl;     cin >> t1;     cout <<  ?   << s2 << endl;     cin >> t2;     cout <<  ?   << s3 << endl;     cin >> t3;     string s(n,  a );     for (long long i = 0; i < n; i++) {       long long z = (t1[i] -  a ) + (t2[i] -  a ) * 26 + (t3[i] -  a ) * 26 * 26;       s[z] = t[i];     }     cout <<  !   << s << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n, p, q, temp;     cin >> n;     int levels[101] = {0};     cin >> p;     for (int i = 0; i < p; i++) {       cin >> temp;       levels[temp]++;     }     cin >> q;     for (int i = 0; i < q; i++) {       cin >> temp;       levels[temp]++;     }     for (int i = 1; i <= n; i++)       if (levels[i] < 1) {         cout <<  Oh, my keyboard! ;         return 0;       }     cout <<  I become the guy. ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long double dp[1010000][3];   int n, m;   int ranks[1245];   int Prank;   int main() {     cout << fixed << setprecision(12);     cin >> n >> m;     if (m == 1) {       cout <<  1 n ;       return 0;     }     for (int i = 1; i <= (n); ++i) {       cin >> ranks[i];       Prank += ranks[i];     }     for (int i = 1; i <= (Prank); ++i) dp[i][0] = dp[i][1] = dp[i][2] = 0;     for (int i = 1; i <= (m); ++i) {       if (i == ranks[1]) continue;       dp[i][0] = 1.0;     }     for (int i = 2; i <= (n); ++i) {       for (int j = 1; j <= (Prank); ++j) {         dp[j][1] = dp[j][0] + dp[j - 1][1];       }       for (int j = Prank; j >= (1); --j) {         dp[j][2] = dp[j - 1][1];         if (j - m > 0) dp[j][2] -= dp[j - m - 1][1];         if (j - ranks[i] > 0) dp[j][2] -= dp[j - ranks[i]][0];       }       for (int j = 1; j <= (Prank); ++j)         dp[j][0] = dp[j][2] / ((long double)(m - 1));     }     long double sum = 0;     for (int i = 1; i <= (Prank - 1); ++i) {       sum += dp[i][0];     }     sum += 1;     cout << sum << endl;   }
#include <bits/stdc++.h>   using namespace std;   long long a[100005], ac[100005];   int last[100005];   int main() {     int n, m, t, x, v, y, q;     string s;     while (cin >> n >> m) {       for (int i = 1; i <= n; i++) cin >> a[i];       for (int i = 1; i <= m; i++) {         cin >> t;         if (t == 1) {           cin >> v >> x;           a[v] = x;           last[v] = i;           ac[i] = ac[i - 1];         } else {           if (t == 2) {             cin >> y;             ac[i] = ac[i - 1] + y;           } else {             cin >> q;             cout << a[q] + ac[i - 1] - ac[last[q]] << endl;             ac[i] = ac[i - 1];           }         }       }     }   }
#include <bits/stdc++.h>   using namespace std;   int freq[8];   int main() {     int n, a, p1 = 0, p2 = 0, p3 = 0;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a;       freq[a]++;     }     if (freq[5] > 0 || freq[7] > 0) {       cout << -1;       return 0;     }     while (freq[1] > 0 && freq[2] > 0 && freq[4] > 0) {       p1++;       freq[1]--;       freq[2]--;       freq[4]--;     }     if (freq[4] > 0) {       cout << -1;       return 0;     }     while (freq[1] > 0 && freq[3] > 0 && freq[6] > 0) {       p2++;       freq[1]--;       freq[3]--;       freq[6]--;     }     if (freq[3]) {       cout << -1;       return 0;     }     while (freq[1] > 0 && freq[2] > 0 && freq[6] > 0) {       p3++;       freq[1]--;       freq[2]--;       freq[6]--;     }     if (freq[1] > 0 || freq[2] > 0 || freq[6] > 0) {       cout << -1;       return 0;     }     while (p1--) {       printf( 1 2 4 n );     }     while (p2--) {       printf( 1 3 6 n );     }     while (p3--) {       printf( 1 2 6 n );     }   }
#include <bits/stdc++.h>   using namespace std;   pair<long long, long long> ar[100005];   long long suf[100007] = {0}, pre[100007] = {0}, sbkoya[100007] = {0},             arr[100005];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(NULL);     ;     long long n, a, cf, cm, m, temp, revi, cnt = 0;     cin >> n >> a >> cf >> cm >> m;     for (long long i = 0; i < n; ++i) {       cin >> temp;       if (temp == a) cnt++;       ar[i] = make_pair(temp, i);     }     if (cf == 0 && cm == 0) {       cout <<  0  << endl;       for (long long i = 0; i < n; ++i) cout << ar[i].first <<    ;       return 0;     }     sort(ar, ar + n);     long long i;     for (i = n - 1; i >= 0; i--) {       long long tmp = suf[i + 1] + a - ar[i].first;       if (tmp > m) break;       suf[i] = tmp;     }     revi = i + 1;     for (long long i = 0; i < n; ++i) {       if (i == 0)         pre[i] = ar[i].first;       else         pre[i] = pre[i - 1] + ar[i].first;     }     for (long long i = 1; i < n; ++i) {       sbkoya[i] = (ar[i].first) * (i + 1) - pre[i];     }     if (sbkoya[n - 1] + n * (a - ar[n - 1].first) <= m) {       cout << n * cf + a * cm << endl;       for (long long i = 0; i < n; ++i) cout << a <<    ;       return 0;     }     long long j, ans = 0, indj, indk, remain, mini, k, rem, mi, tmp;     rem = m;     k = upper_bound(sbkoya, sbkoya + n, rem) - sbkoya;     k--;     rem -= sbkoya[k];     mi = (ar[k].first) + rem / (k + 1);     tmp = mi * cm + cf * cnt;     ans = tmp;     indk = k;     indj = n;     remain = rem;     mini = mi;     for (j = n - 1; j >= revi; j--) {       tmp = cf * max(n - j, cnt);       rem = m - suf[j];       k = upper_bound(sbkoya, sbkoya + n, rem) - sbkoya;       k--;       if (k >= j) k = j - 1;       rem -= sbkoya[k];       mi = (ar[k].first) + rem / (k + 1);       tmp += mi * cm;       if (tmp >= ans) {         ans = tmp;         indk = k;         indj = j;         remain = rem;         mini = mi;       }     }     cout << ans << endl;     long long du;     for (du = n - 1; du >= indj; du--) ar[du].first = a;     long long ka = remain % (k + 1);     for (du = indk; du >= 0; du--) {       ar[du].first = mini;     }     for (long long i = 0; i < n; ++i) {       arr[ar[i].second] = ar[i].first;     }     for (long long i = 0; i < n; ++i) cout << arr[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using point = complex<long long>;   long long cross(point a, point b) {     return a.real() * b.imag() - a.imag() * b.real();   }   long long dot(point a, point b) {     return a.real() * b.real() + a.imag() * b.imag();   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cout << fixed << setprecision(8);     int n, px, py;     cin >> n >> px >> py;     point p = point(px, py);     double maxi = 0.0, mini = HUGE_VAL;     vector<point> polygon(n);     for (auto &v : polygon) {       int x, y;       cin >> x >> y;       v = point(x, y);       maxi = max(maxi, M_PI * norm(v - p));     }     for (int i = 0; i < n; ++i) {       int j = (i + 1) % n;       point a = polygon[i], b = polygon[j];       point v = a - b;       if ((dot(v, a) < dot(v, p)) == (dot(v, p) < dot(v, b))) {         mini = min(mini, M_PI * cross(v, p - b) * cross(v, p - b) / norm(v));       } else {         mini = min(mini, M_PI * min(norm(a - p), norm(b - p)));       }     }     cout << maxi - mini <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int a[200005];   int main() {     int T;     cin >> T;     while (T--) {       int n;       cin >> n;       for (int i = 1; i <= n; i++) {         int t;         cin >> t;         a[t] = i;       }       int l, r, num;       string s =   ;       for (int i = 1; i <= n; i++) {         if (i == 1) {           num = 0;           l = r = a[i];           s +=  1 ;           continue;         }         if (r < a[i])           num += a[i] - r - 1, r = a[i];         else if (l > a[i])           num += l - a[i] - 1, l = a[i];         else           num--;         if (!num)           s +=  1 ;         else           s +=  0 ;       }       cout << s << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using LL = long long;   const int MX[4] = {0, 0, -1, 1};   const int MY[4] = {-1, 1, 0, 0};   int n, m, k;   bool z[26];   bool Inside(int a, int b) { return 0 <= a && a < n && 0 <= b && b < m; }   char GetC(int a, int b, int c, int d, vector<vector<char>>& x) {     memset(z, 0, sizeof(z));     for (int t = 0; t < 4; ++t) {       int p = a + MX[t], q = b + MY[t];       if (Inside(p, q) && x[p][q] !=  + ) {         z[x[p][q] -  a ] = true;       }       p = c + MX[t], q = d + MY[t];       if (Inside(p, q) && x[p][q] !=  + ) {         z[x[p][q] -  a ] = true;       }     }     for (int i = 0; i < 26; ++i) {       if (!z[i]) return  a  + i;     }     return  a ;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int times;     cin >> times;     while (times--) {       cin >> n >> m >> k;       vector<vector<char>> x(n, vector<char>(m,  + ));       if (n & 1) {         if (k < m / 2) {           cout <<  NO n ;           continue;         }         for (int i = 0; i < m; i += 2) {           x[0][i] = x[0][i + 1] =  a  + (i / 2 % 2);         }         k -= m / 2;         if (k & 1) {           cout <<  NO n ;           continue;         }         for (int j = 0; j < m; j += 2) {           if (k == 0) break;           for (int i = 1; i < n; ++i) {             if (k == 0) break;             char t = GetC(i, j, i, j + 1, x);             x[i][j] = x[i][j + 1] = t;             --k;           }         }         for (int i = 0; i < n; ++i) {           for (int j = 0; j < m; ++j) {             if (x[i][j] !=  + ) continue;             char t = GetC(i, j, i + 1, j, x);             x[i][j] = x[i + 1][j] = t;           }         }       } else if (m & 1) {         if (k & 1) {           cout <<  NO n ;           continue;         }         if (k > n * (m - 1) / 2) {           cout <<  NO n ;           continue;         }         for (int j = 0; j < m; j += 2) {           if (k == 0) break;           for (int i = 0; i < n; ++i) {             if (k == 0) break;             char t = GetC(i, j, i, j + 1, x);             x[i][j] = x[i][j + 1] = t;             --k;           }         }         for (int i = 0; i < n; ++i) {           for (int j = 0; j < m; ++j) {             if (x[i][j] !=  + ) continue;             char t = GetC(i, j, i + 1, j, x);             x[i][j] = x[i + 1][j] = t;           }         }       } else {         if (k & 1) {           cout <<  NO n ;           continue;         }         for (int j = 0; j < m; j += 2) {           if (k == 0) break;           for (int i = 0; i < n; ++i) {             if (k == 0) break;             char t = GetC(i, j, i, j + 1, x);             x[i][j] = x[i][j + 1] = t;             --k;           }         }         for (int i = 0; i < n; ++i) {           for (int j = 0; j < m; ++j) {             if (x[i][j] !=  + ) continue;             char t = GetC(i, j, i + 1, j, x);             x[i][j] = x[i + 1][j] = t;           }         }       }       cout <<  YES n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct dbg_ {     template <typename T>     dbg_& operator,(const T& x) {       cerr << x <<    ;       return *this;     }   } dbg_t;   struct cin_ {     template <typename T>     cin_& operator,(T& x) {       cin >> x;       return *this;     }   } cin_;   template <typename T1, typename T2>   static inline ostream& operator<<(ostream& os, std::pair<T1, T2> const& p) {     os <<  {  << p.first <<  ,   << p.second <<  } ;     return os;   }   int main() {     string str;     getline(cin, str);     int ret = 1;     for (int i = (1), _i = (7); i < _i; ++i) {       ret += str[i] -  0 ;       if (str[i] ==  0 ) ret += 9;     }     cout << ret << endl;     return 0;   }
#include <bits/stdc++.h>      #define mp make_pair   #define mt make_tuple   #define fi first   #define se second   #define pb push_back   #define all(x) (x).begin(), (x).end()   #define rall(x) (x).rbegin(), (x).rend()   #define forn(i, n) for (int i = 0; i < (int)(n); ++i)   #define for1(i, n) for (int i = 1; i <= (int)(n); ++i)   #define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)   #define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)      using namespace std;      typedef pair<int, int> pii;   typedef vector<int> vi;   typedef vector<pii> vpi;   typedef vector<vi> vvi;   typedef long long i64;   typedef vector<i64> vi64;   typedef vector<vi64> vvi64;   typedef pair<i64, i64> pi64;   typedef double ld;      template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }   template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }      const int maxn = 200001, maxk = 30;   vector<pii> e[maxn];   int ban[maxn];   int fib[maxk];   int w[maxn];      void dfsw(int v, int p, int k, int &c) {       bool isC = true;       w[v] = 1;       for (auto [u, id]: e[v]) {           if (u == p || ban[id]) continue;           dfsw(u, v, k, c);           isC &= 2 * w[u] <= fib[k];           w[v] += w[u];       }       isC &= 2 * (fib[k] - w[v]) <= fib[k];       if (isC) c = v;   }      void dfsw2(int v, int p, int k, vector<pii> &es) {       w[v] = 1;       for (auto [u, id]: e[v]) {           if (u == p || ban[id]) continue;           dfsw2(u, v, k, es);           w[v] += w[u];           if (w[u] == fib[k - 2]) {               es.pb({id, u});           }       }   }      bool check(int v, int k) {       if (k <= 3) return true;       dfsw(v, -1, k, v);       int trash;       vector<pii> es;       dfsw2(v, -1, k, es);       for (auto [id, u]: es) {           ban[id] = 1;           if (check(u, k - 2) && check(v, k - 1)) return true;       }       return false;   }      int main() {       ios::sync_with_stdio(false);       cin.tie(nullptr);       cout.precision(10);       cout << fixed;   #ifdef LOCAL_DEFINE       freopen( input.txt ,  rt , stdin);   #endif          int n;       cin >> n;       forn(i, n - 1) {           int u, v;           cin >> u >> v;           --u; --v;           e[u].pb({v, i});           e[v].pb({u, i});       }       fib[0] = fib[1] = 1;       int p;       for (p = 2; fib[p - 1] < n; ++p) {           fib[p] = fib[p - 1] + fib[p - 2];       }       --p;       if (n == fib[p] && check(0, p)) cout <<  YES n ;       else cout <<  NO n ;      #ifdef LOCAL_DEFINE       cerr <<  Time elapsed:   << 1.0 * clock() / CLOCKS_PER_SEC <<   s. n ;   #endif       return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long x, y, k, t;     cin >> t;     for (int i = 0; i < t; i++) {       cin >> x >> y >> k;       long long br;       br = (k * (y + 1) - 1) / (x - 1);       if (((k * (y + 1) - 1) % (x - 1)) != 0) {         br += 1;       }       br += k;       cout << br << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t;     cin >> t;     while (t--) {       long long n, k;       cin >> n >> k;       vector<long long> v;       for (int i = 0; i < n; i++) {         long long x;         cin >> x;         v.push_back(x);       }       sort(v.begin(), v.end());       long long sum = 0;       for (long long i = 0; n - k + i < n; i++) {         sum += v[n - 2 * k + i] / v[n - k + i];       }       for (long long i = 0; i < n - 2 * k; i++) {         sum += v[i];       }       cout << sum;       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 4010, K = 80;   const int p = 998244353;   int n1, n2, k, px[2][N], py[2][N], a1[K], a2[K], fac[K], inv[K], f[2][N];   int tot, fi[N], a[N << 1], ne[N << 1], cnt;   inline void A(int &x, int y) { x = (x + y >= p ? x + y - p : x + y); }   inline int C(int x, int y) {     return 1ll * fac[x] * inv[y] % p * inv[x - y] % p;   }   inline void Add(int x, int y) {     a[++tot] = y;     ne[tot] = fi[x];     fi[x] = tot;   }   inline void Dfs(int x, int fa, int ty) {     for (int i = fi[x]; i; i = ne[i])       if (a[i] != fa) {         ++cnt;         px[ty][cnt] = x;         py[ty][cnt] = a[i];         px[!ty][cnt] = a[i];         py[!ty][cnt] = x;         Dfs(a[i], x, !ty);       }   }   inline void Solve(int n, int k, int ans[]) {     tot = 0;     memset(fi + 1, 0, n * sizeof *fi);     for (int i = 1, x, y; i < n; ++i) {       scanf( %d%d , &x, &y);       Add(x, y);       Add(y, x);     }     ans[0] = n;     for (int x = 1; x <= n; ++x) {       cnt = 0;       Dfs(x, 0, 1);       memset(f[0] + 1, 0, n * sizeof *f[0]);       f[0][x] = 1;       for (int len = 1; len <= k; ++len) {         memset(f[len & 1] + 1, 0, n * sizeof *f[len & 1]);         for (int i = 1; i < n; ++i)           A(f[len & 1][py[len & 1][i]], f[~len & 1][px[len & 1][i]]);         A(ans[len], f[len & 1][x]);       }     }   }   int main() {     scanf( %d%d%d , &n1, &n2, &k);     Solve(n1, k, a1);     Solve(n2, k, a2);     fac[0] = 1;     for (int i = 1; i < K; ++i) fac[i] = 1ll * fac[i - 1] * i % p;     inv[0] = inv[1] = 1;     for (int i = 2; i < K; ++i) inv[i] = 1ll * inv[p % i] * (p - p / i) % p;     for (int i = 2; i < K; ++i) inv[i] = 1ll * inv[i - 1] * inv[i] % p;     int ans = 0;     for (int i = 0; i <= k; ++i)       ans = (ans + 1ll * C(k, i) * a1[i] % p * a2[k - i]) % p;     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t-- > 0) {       char c[100005];       int n;       cin >> n;       string s0 =   ;       string sm =   ;       string s1 =   ;       bool flag0 = true;       int pos1 = -1;       int pos0 = -1;       for (int i = 1; i <= n; i++) {         cin >> c[i];         if (c[i] ==  1 ) {           if (flag0) flag0 = false;           if (pos1 == -1) pos1 = i;           s1 = s1 +  1 ;         } else {           if (flag0) s0 = s0 +  0 ;           s1 =   ;           pos0 = i;         }       }       if (pos1 != -1 && pos0 != -1 && pos0 > pos1) sm =  0 ;       string s = s0 + sm + s1;       cout << s << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int num, sg[100010], mex[100010], col = 1, ans = -1;   int main() {     scanf( %d , &num);     for (int n = 3; n <= num; n++) {       for (int m = 2;; m++) {         int res = n - (m - 1) * m / 2;         if (res < 0) break;         if (res % m) continue;         int g = 0, x = res / m;         for (int i = 0; i < m; i++) g ^= sg[x + i];         if (!g && num == n && ans < 0) {           ans = m;           break;         }         mex[g] = col;       }       for (int j = 0;; j++)         if (mex[j] != col) {           sg[n] = j;           ++col;           break;         }     }     printf( %d , ans);   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 6010;   int ans, f[maxn], r[maxn], m[maxn][maxn];   void dfs(int x, int y, int p) {     int k = lower_bound(f, f + p, r[x]) - f;     int t = f[k];     f[k] = r[x];     ans = max(ans, k);     p = max(k + 1, p);     for (int i = 1; i <= m[x][0]; i++)       if (m[x][i] != y) dfs(m[x][i], x, p);     f[k] = t;   }   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , r + i);     for (int i = 1; i < n; i++) {       int a, b;       scanf( %d%d , &a, &b);       m[a][++m[a][0]] = b;       m[b][++m[b][0]] = a;     }     for (int i = 1; i <= n; i++) dfs(i, 0, 1);     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, x[1000], y[1000], z[1000], t = 0, s = 0, d = 0;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> x[i] >> y[i] >> z[i];       t += x[i];       s += y[i];       d += z[i];     }     if (t == 0 && s == 0 && d == 0)       cout <<  YES ;     else       cout <<  NO ;   }