malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   double const EPS = 3e-8;   using namespace std;   template <class T>   T gcd(T a, T b) {     return (b != 0 ? gcd<T>(b, a % b) : a);   }   template <class T>   T lcm(T a, T b) {     return (a / gcd<T>(a, b) * b);   }   struct debugger {     template <typename T>     debugger& operator,(const T& v) {       cerr << v <<   t ;       return *this;     }   } dbg;   template <class A, class B>   ostream& operator<<(ostream& o, const pair<A, B>& p) {     return o <<  (  << p.first <<  ,   << p.second <<  ) ;   }   template <class T>   ostream& operator<<(ostream& o, const vector<T>& v) {     o <<  [ ;     for (__typeof((v).end()) it = (v).begin(); it != (v).end(); ++it)       o << *it <<  ,  ;     return o <<  ] ;   }   template <class T>   ostream& operator<<(ostream& o, const set<T>& v) {     o <<  [ ;     for (__typeof((v).end()) it = (v).begin(); it != (v).end(); ++it)       o << *it <<  ,  ;     return o <<  ] ;   }   template <class T>   inline bool read(T& x) {     int c = getchar();     int sgn = 1;     while (~c && c <  0  || c >  9 ) {       if (c ==  - ) sgn = -1;       c = getchar();     }     for (x = 0; ~c &&  0  <= c && c <=  9 ; c = getchar()) x = x * 10 + c -  0 ;     x *= sgn;     return ~c;   }   int dx[] = {1, 0, -1, 0};   int dy[] = {0, 1, 0, -1};   const int NX = 1e6 + 10;   int fromFront[NX], fromBack[NX];   string a, b;   void solve(int cs) {     cin >> a >> b;     int asz = a.size();     int bsz = b.size();     int backIdx = bsz - 1;     int cur = 0;     for (int i = asz - 1; i >= 0; i--) {       if (backIdx >= 0 && a[i] == b[backIdx]) {         backIdx--;         cur++;       }       fromBack[i] = cur;     }     int frontIdx = 0;     cur = 0;     for (int i = 0; i < asz; i++) {       if (frontIdx < bsz && a[i] == b[frontIdx]) {         frontIdx++;         cur++;       }       fromFront[i] = cur;     }     int low = 0, high = 0;     int ans = 0;     while (high < asz) {       int f = 0, b = 0;       if (low > 0) f = fromFront[low - 1];       if (high + 1 < asz) b = fromBack[high + 1];       if (f + b >= bsz) {         ans = max(ans, high - low + 1);       } else {         while (f + b < bsz && low <= high) {           low++;           f = fromFront[low - 1];           if (high + 1 < asz) b = fromBack[high + 1];         }       }       high++;     }     printf( %d n , ans);   }   int main() {     int t = 1;     for (int cs = 1; cs <= t; cs++) solve(cs);     return 0;   }
#include <bits/stdc++.h>   int main() {     int n, k;     while (~scanf( %d%d , &n, &k)) {       int ant[55] = {0};       int temp = 0;       int count = k;       for (int i = 1; i <= n; i++) {         scanf( %d , &ant[i - 1]);         if (i == k) temp = ant[i - 1];       }       if (temp)         for (int i = k + 1; i <= n; i++) {           if (ant[i - 1] >= temp)             count++;           else             break;         }       else         for (int i = k; i >= 1; i--) {           if (!ant[i - 1]) count--;         }       printf( %d n , count);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void err(istream_iterator<string> it) {}   template <typename T, typename... Args>   void err(istream_iterator<string> it, T a, Args... args) {     cerr <<     << *it <<   =   << a;     err(++it, args...);   }   template <typename T, typename U>   inline void min_self(T& x, U y) {     if (y < x) x = y;   }   template <typename T, typename U>   inline void max_self(T& x, U y) {     if (x < y) x = y;   }   template <class T1, class T2>   ostream& operator<<(ostream& out, pair<T1, T2> pair) {     return out <<  (  << pair.first <<  ,   << pair.second <<  ) ;   }   template <class T>   ostream& operator<<(ostream& out, vector<T> vec) {     out <<  ( ;     for (auto& v : vec) out << v <<  ,  ;     return out <<  ) ;   }   template <class T>   ostream& operator<<(ostream& out, set<T> vec) {     out <<  ( ;     for (auto& v : vec) out << v <<  ,  ;     return out <<  ) ;   }   template <class L, class R>   ostream& operator<<(ostream& out, map<L, R> vec) {     out <<  ( ;     for (auto& v : vec) out <<  [  << v.first <<  ,   << v.second <<  ] ;     return out <<  ) ;   }   template <class A, class B>   istream& operator>>(istream& in, pair<A, B>& a) {     return in >> a.first >> a.second;   }   template <class A>   istream& operator>>(istream& in, vector<A>& a) {     for (A& i : a) in >> i;     return in;   }   long long XX[4] = {-1, 0, 1, 0};   long long YY[4] = {0, -1, 0, 1};   void solve() {     long long n, res = 0;     cin >> n;     vector<pair<long long, long long>> a(n);     for (long long i = 0; i <= n - 1; i++) cin >> a[i];     sort(a.begin(), a.end());     long long maxi = a[0].second;     for (long long i = 1; i <= n - 1; i++) {       if (a[i].second < maxi && a[i].first > a[i - 1].first) {         res++;       }       max_self(maxi, a[i].second);     }     cout << res <<   n ;     return;   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long t = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int N, K;     cin >> N >> K;     double res = 0;     long double t1x, t1y, t2x, t2y;     cin >> t1x >> t1y;     for (int i = 1; i < N; ++i) {       t2x = t1x;       t2y = t1y;       cin >> t1x >> t1y;       res += sqrt((t1x - t2x) * (t1x - t2x) + (t1y - t2y) * (t1y - t2y));     }     printf( %.15lf n , res * K / 50);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100005;   int down[N], sz[N], up[N], n;   vector<pair<int, bool> > adj[N];   void dfs(int s, int p) {     sz[s] = 1;     for (auto it : adj[s]) {       if (it.first != p) {         dfs(it.first, s);         sz[s] += sz[it.first];         if (it.second)           down[s] += sz[it.first];         else           down[s] += down[it.first];       }     }   }   void dfs2(int s, int p) {     for (auto it : adj[s]) {       if (it.first != p) {         if (it.second)           up[it.first] = n - sz[it.first];         else           up[it.first] = down[s] - down[it.first] + up[s];         dfs2(it.first, s);       }     }   }   int main() {     int i;     scanf( %d , &n);     for (i = 0; i < n - 1; i++) {       int a, b, c, te;       bool flag = true;       scanf( %d%d%d , &a, &b, &c);       while (c > 0) {         if (c % 10 == 4 || c % 10 == 7)           ;         else           flag = false;         c /= 10;       }       adj[a - 1].push_back(make_pair(b - 1, flag));       adj[b - 1].push_back(make_pair(a - 1, flag));     }     long long ans = 0;     dfs(0, -1);     dfs2(0, -1);     for (i = 0; i < n; i++) {       long long temp = up[i] + down[i];       ans += temp * (temp - 1);     }     cout << ans;   }
#include <bits/stdc++.h>   double p[1010][1010];   int a[1010];   int n, m;   int main() {     double t, ans;     int i, j, x, y;     scanf( %d%d , &n, &m);     for (i = 1; i <= n; i++) scanf( %d , &a[i]);     for (i = 1; i <= n; i++)       for (j = 1; j <= n; j++)         if (a[i] > a[j])           p[i][j] = 1;         else           p[i][j] = 0;     for (i = 1; i <= m; i++) {       scanf( %d%d , &x, &y);       p[x][y] = 0.5;       p[y][x] = 0.5;       for (j = 1; j <= n; j++)         if ((j != x) && (j != y)) {           t = (p[j][x] + p[j][y]) * 0.5;           p[j][x] = t;           p[x][j] = 1 - t;           p[j][y] = t;           p[y][j] = 1 - t;         }     }     ans = 0;     for (i = 1; i <= n - 1; i++)       for (j = i + 1; j <= n; j++) ans += p[i][j];     printf( %.10lf n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long range(long long L) {     switch (L & 3) {       case 0:         return L;       case 1:         return 1;       case 2:         return L + 1;       case 3:         return 0;     }   }   int main() {     for (int N; cin >> N;) {       long long sum = 0;       for (int i = 0; i < (int)(N); ++i) {         long long m, x;         cin >> x >> m;         long long b = range(x - 1);         long long a = range(x + m - 1);         sum ^= b;         sum ^= a;       }       if (sum == 0)         cout <<  bolik  << endl;       else         cout <<  tolik  << endl;     }     return 0;   }
#include <bits/stdc++.h>   #include <cmath>   #include <regex>   #define ff first   #define ss second   #define pb push_back   #define mp make_pair   #define ba back   #define ppb pop_back   #define eb emplace_back   #define eps 1e-6   #define vec vector<long long int>   #define sz(x) (int((x.size())))   #define all(x) (x).begin(),(x).end()   #define FAST ios_base :: sync_with_stdio (false); cin.tie (NULL)   #define ll long long   #define loop(i,s,n) for(int i=s;i<n;i++)   using namespace std;   //-----------------------------------------------------------------------------------------------------------------   const ll M = 1e9 + 7;   const ll N = 2e5 + 5;   const ll inf = 2e18;   ll mod(ll x){   return (x%M);}   ll mod_minus(ll a, ll b){ ll ans= (mod(a)-mod(b)); if(ans<0) ans=mod(ans+M); return ans;}       ll mod_mul(ll a,ll b){  return mod(mod(a)*mod(b));}       ll mod_add(ll a,ll b){ return mod(a+b);}       ll power(ll a,ll n){         if(n==0) return 1;         else if(n==1) return a;          ll R=power(a,n/2)%M;           if(n%2==0) {    return mod(mod_mul(R,R));  }                 else {   return mod(mod_mul(mod_mul(R,a),mod(R)));  }       }       ll mod_inv(ll n){  return power(n,M-2);}       // only if M is prime   ll mod_div(ll a,ll b){          ll ans=mod(a);   ll b1=power(b,M-2);           ans= mod(mod_mul(ans,b1));             return ans;           }       ll fact_mod(ll n){        vec fact(n+1);        fact[0]=1;           loop(i,1,n+1){               fact[i]=mod_mul(fact[i-1],i);              }                 return fact[n];       }       unsigned long long nCr_mod(unsigned long long n,  ll r)    {        if (r == 0)            return 1;        unsigned long long fac[n + 1];        fac[0] = 1;        for (int i = 1; i <= n; i++)            fac[i] = (fac[i - 1] * i) % M;             return (fac[n] * mod_inv(fac[r]) % M * mod_inv(fac[n - r]) % M) % M;    }    //--------------------------------------------------------------------------------------------------------------   void solve(){       ll n;       cin>>n;       ll a[n];       ll sum=0;       loop(i,0,n){           cin>>a[i];           sum+=a[i];       }       sort(a,a+n);       ll mx=a[n-1],mn=a[0];       ll z=(n-1)-sum%(n-1);       if(z==(n-1)){           z=0;       }       sum+=z;       if(mx<=sum/(n-1)){           cout<<z<<endl;           return;       }       cout<<mx*(n-1)-sum+z<<endl;   }      int main(){       FAST;       int t;       cin>>t;       while(t--){           solve();         }   }
#include <bits/stdc++.h>   using namespace std;   int read() {     int x;     scanf( %d , &x);     return x;   }   const int N = 1123456;   int a[N];   vector<int> v[N];   int c[N];   priority_queue<int> q[N];   void dfs(int x, int t) {     c[x] = t;     q[t].push(a[x]);     for (int i = 0; i < v[x].size(); i++) {       int to = v[x][i];       if (!c[to]) {         dfs(to, t);       }     }   }   int main() {     int n, m, i, j, x, y;     n = read();     m = read();     for (i = 1; i <= n; i++) {       a[i] = read();     }     for (i = 1; i <= m; i++) {       x = read();       y = read();       v[x].push_back(y);       v[y].push_back(x);     }     int cnt = 1;     for (i = 1; i <= n; i++) {       if (!c[i]) {         dfs(i, cnt++);       }     }     for (i = 1; i <= n; i++) {       printf( %d  , q[c[i]].top());       q[c[i]].pop();     }   }
#include <bits/stdc++.h>   using namespace std;   stack<pair<int, int> > a;   int main() {     int n, m = 0, i = 1;     cin >> n;     while (n--) {       int b, c;       char d, e, f[40];       scanf(    );       scanf( %c , &d);       scanf( %d%c%d , &b, &e, &c);       gets(f);       b %= 12;       if (f[1] ==  p ) b += 12;       if (m) {         if ((b < a.top().first) || (b == a.top().first && c < a.top().second))           ;         else           m--;         if (b == a.top().first && c == a.top().second)           i++;         else           i = 1;       }       if (i > 10) {         m++;         i -= 10;       }       a.push({b, c});       m++;     }     cout << m << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long maxn = 100010;   const long long inf = 1e9 + 7;   long long n, a[maxn];   long long minv = inf;   long long sum[3];   int main() {     scanf( %I64d , &n);     for (long long i = 1; i <= n; i++) {       scanf( %I64d , &a[i]);       minv = min(minv, a[i]);     }     for (long long i = 1; i <= n; i++) a[i] -= minv;     for (long long i = 1; i <= n; i++) sum[a[i]]++;     sort(a + 1, a + n + 1);     if (a[n] < 2) {       printf( %I64d n , n);       for (long long i = 1; i <= n; i++) printf( %I64d  , a[i] + minv);       return 0;     } else {       long long temp = min(sum[0], sum[2]);       long long temp2 = sum[1] >> 1;       if (temp > temp2) {         sum[1] += (temp << 1);         sum[0] -= temp;         sum[2] -= temp;       } else {         temp = temp2;         sum[1] -= (temp << 1);         sum[0] += temp;         sum[2] += temp;       }       printf( %I64d n , n - (temp << 1));       for (long long i = 0; i < 3; i++)         for (long long j = 1; j <= sum[i]; j++) printf( %I64d  , i + minv);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline long long gcd(long long a, long long b) {     return b == 0 ? a : gcd(b, a % b);   }   inline long long lcm(long long a, long long b) { return a * b / gcd(a, b); }   long long n, k, x, type(1), amt, box;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> n >> k;     for (int i = 1; i <= k; i++) {       cin >> x;       if (x * (n / x) > amt) {         amt = x * (n / x);         box = n / x;         type = i;       }     }     cout << type <<     << box << endl;   }
#include <bits/stdc++.h>   using namespace std;   void debug_out() { cerr << endl; }   void clock_out() {     cerr <<   nTime Elapsed :   << 1.0 * clock() / CLOCKS_PER_SEC <<   s n ;   }   void fileio() {     freopen( /home/dwai/Desktop/cp/input.txt ,  r , stdin);     freopen( /home/dwai/Desktop/cp/output.txt ,  w , stdout);     freopen( /home/dwai/Desktop/cp/debug.txt ,  w , stderr);   }   void ofileio() {     freopen( input.txt ,  r , stdin);     freopen( output.txt ,  w , stdout);   }   template <typename Head, typename... Tail>   void debug_out(Head H, Tail... T) {     cerr <<     << H;     debug_out(T...);   }   int IT_MAX = 1 << 20;   const long long MOD = 1000000007;   const int INF = 0x3f3f3f3f;   const long long LL_INF = 0x3f3f3f3f3f3f3f3f;   const double PI = acos(-1);   const double ERR = 1e-10;   int main() {     42;     ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);     srand(time(NULL));     long long n, m;     cin >> n >> m;     long long a[n], b[m];     long long i;     long long mn = 0, mx = 0;     for (i = 0; i < n; i++) {       cin >> a[i];       if (i == 0) {         mx = a[i];         mn = a[i];       } else         mx = max(mx, a[i]);       mn = min(mn, a[i]);     }     long long ans = mn * 2;     for (i = 0; i < n; i++) {       if (a[i] > ans) ans = a[i];     }     for (i = 0; i < m; i++) {       cin >> b[i];       if (b[i] <= ans) return cout << -1, 0;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int N, K;   int T[200005];   vector<int> danger;   vector<pair<int, int> > v;   bool cf(pair<int, int> x, pair<int, int> y) {     return x.second * y.first > y.second * x.first;   }   int main() {     scanf( %d %d , &N, &K);     for (int i = 0; i < N; i++) {       scanf( %d , &T[i]);       if (T[i] < 0) {         danger.push_back(i);       }     }     if (danger.size() > K)       puts( -1 );     else {       int change = danger.size() * 2;       K -= danger.size();       for (int i = 0; i < (int)danger.size(); i++) {         if (i == danger.size() - 1)           v.push_back(make_pair(N - danger[i] - 1, 1));         else           v.push_back(make_pair(danger[i + 1] - danger[i] - 1, 2));       }       sort(v.begin(), v.end(), cf);       int idx = 0;       while (idx < v.size()) {         if (K - v[idx].first >= 0) {           K -= v[idx].first;           change -= v[idx].second;         }         idx++;       }       printf( %d n , change);     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC optimization( unroll-loops )   std::pair<int, int> DR[] = {{-1, 0}, {0, 1},   {1, 0}, {0, -1},                               {-1, 1}, {-1, -1}, {1, 1}, {1, -1}};   using namespace std;   const long long mod = 998244353;   long long nop = 70;   vector<int> primes(nop + 1, 1);   void sieve() {     primes[1] = primes[0] = 0;     for (long long i = 2; i * i <= nop; i++) {       if (primes[i]) {         for (long long j = i * i; j <= nop; j += i) {           primes[j] = 0;         }       }     }   }   long long gcd(long long a, long long b) {     if (b > a) swap(b, a);     if (b == 0) return a;     return gcd(b, a % b);   }   void extgcd(long long a, long long b, long long& x, long long& y) {     if (a == 0) {       x = a;       y = b;       return;     }     extgcd(b % a, a, x, y);     long long y1 = y, x1 = x;     x = y1 - (b / a) * x1;     y = x1;   }   long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }   long long bexp(long long num, long long e) {     long long ans = 1;     while (e > 0) {       if (e & 1) {         ans *= num;       }       num *= num;       e >>= 1;     }     return ans;   }   long long mexp(long long num, long long e) {     long long ans = 1;     while (e > 0) {       if (e & 1) {         ans = (ans * num) % mod;       }       num *= num;       num %= mod;       e >>= 1;     }     return ans % mod;   }   long long modinv(long long a) {     a %= mod;     return mexp(a, mod - 2);   }   void solve() {     long long n, k;     cin >> n >> k;     string s;     cin >> s;     sort(s.begin(), s.end());     vector<long long> cnt(26, 0);     for (long long i = 0; i < (n); i++) {       cnt[s[i] -  a ]++;     }     int first = -1, last = -1, nod = 0;     for (long long i = 0; i < (26); i++) {       if (cnt[i]) {         nod++;         if (first == -1) first = i;         last = i;       }     }     if (cnt[first] < k) {       cout << s[k - 1] <<   n ;       return;     }     string worst =   ;     worst += char( a  + first);     if (nod >= 3 || (nod == 2 && cnt[first] > k)) {       for (long long i = k; i < n; i++) {         worst += s[i];       }     } else {       for (long long i = k; i < n; i++) {         worst += s[i];         i += (k - 1);       }     }     cout << worst <<   n ;   }   int main() {     cin.tie(0);     cout.tie(0);     ios::sync_with_stdio(0);     int t = 1;     cin >> t;     for (long long T = 1; T <= (t); T++) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char str[100010];   int ct[100010][4];   int main() {     int N, x[5], R, L, M;     scanf( %s , str);     N = strlen(str);     for (int i = 1; i <= N; i++) {       for (int j = 0; j < 3; j++) ct[i][j] = ct[i - 1][j];       ct[i][str[i - 1] -  x ]++;     }     scanf( %d , &M);     for (int i = 0; i < M; i++) {       scanf( %d%d , &L, &R);       L--;       if (R - L < 3) {         puts( YES );         continue;       }       for (int j = 0; j < 3; j++) x[j] = ct[R][j] - ct[L][j];       if (x[0] <= x[1] && x[1] <= x[2] && x[2] - x[0] <= 1)         puts( YES );       else if (x[1] <= x[2] && x[2] <= x[0] && x[0] - x[1] <= 1)         puts( YES );       else if (x[2] <= x[0] && x[0] <= x[1] && x[1] - x[2] <= 1)         puts( YES );       else         puts( NO );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 5;   int n, a[maxn];   struct node {     int pre;     bool flag;     int other;   } num[2 * maxn];   int main(int argc, char const *argv[]) {     while (cin >> n) {       bool flag = true;       for (int i = 0; i <= n; i++) {         cin >> a[i];         if (a[i] != 1) flag = false;       }       if (flag == true) {         cout <<  perfect  << endl;         continue;       }       bool temp = false;       bool ans = false;       int cnt = 1;       for (int i = 0; i <= n; i++) {         if (i > 0 && a[i] > 1 && a[i - 1] > 1 && ans == false) {           ans = true;           int par = cnt - 1;           int k = a[i];           k--;           while (k--) {             num[cnt].pre = par;             num[cnt].other = par - 1;             num[cnt].flag = true;             cnt++;           }           num[cnt].pre = num[cnt].other = par;           num[cnt].flag = true;           cnt++;         } else {           int par = cnt - 1;           int k = a[i];           while (k--) {             num[cnt].pre = par;             num[cnt].flag = false;             cnt++;           }         }       }       if (ans == false) {         cout <<  perfect  << endl;         continue;       }       cout <<  ambiguous  << endl;       for (int i = 1; i < cnt; i++) cout << num[i].pre <<    ;       cout << endl;       for (int i = 1; i < cnt; i++) {         if (num[i].flag == false)           cout << num[i].pre;         else           cout << num[i].other;         cout <<    ;       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int mymax(int x) {     int max = 0;     while (x) {       int s = x % 10;       if (s > max) max = s;       x /= 10;     }     return max;   }   int zh(int x, int n) {     int s = 0, p = 1;     while (x) {       s += x % 10 * p;       x /= 10;       p *= n;     }     return s;   }   int main() {     int a, b;     cin >> a >> b;     int n = max(mymax(a), mymax(b)) + 1;     int num = zh(a, n) + zh(b, n);     int j = 0;     while (num) {       int s = num % n;       num /= n;       j++;     }     cout << j << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   class Constellation {     static const long long N = 100010;     inline long long sign(long long x) { return x > 0 ? 1 : x == 0 ? 0 : -1; }     struct point {       long long x, y, num;     } b[N];     long long n;     long long cross(const point &a, const point &b, const point &c) {       return sign((b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x));     }     bool contain(const point &a, const point &b, const point &c, const point &p) {       long long v1 = cross(a, b, p), v2 = cross(b, c, p), v3 = cross(c, a, p);       return v1 * v2 >= 0 && v2 * v3 >= 0 && v3 * v1 >= 0;     }       public:     void solve() {       cin >> n;       for (long long i = 1; i <= n; ++i) cin >> b[i].x >> b[i].y;       long long p1 = 1, p2 = 2, p3 = 0;       for (long long i = 3; i <= n; ++i)         if (cross(b[p1], b[p2], b[i])) {           p3 = i;           break;         }       for (long long i = 1; i <= n; ++i)         if (i != p1 && i != p2 && i != p3 && contain(b[p1], b[p2], b[p3], b[i])) {           if (cross(b[p1], b[p2], b[i]))             p3 = i;           else             p2 = i;         }       cout << p1 <<     << p2 <<     << p3 << endl;     }   } T;   int main() { T.solve(); }
#include <bits/stdc++.h>   double eps = 1e-9;   using namespace std;   int main() {     std::ios::sync_with_stdio(false);     int x, y, z, w, b, a;     cin >> x >> y >> z >> w >> b >> a;     cout << (2 * (2 * x + a + y) * (z + y) - (a * a + b * b + y * y + z * z)) / 2;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int dirx[] = {1, 0, -1, 0};   int diry[] = {0, 1, 0, -1};   int a;   vector<int> graph[100005];   int dist[100005];   bool visit[100005];   int cnt = 0;   bool flag = false;   int dfs(int u, int par) {     visit[u] = true;     for (int i = 0; i < graph[u].size(); i++) {       if (!visit[graph[u][i]]) dist[u] += dfs(graph[u][i], u);     }     if (dist[u] != 0 && (dist[u] + 1) % 2 == 0) {       cnt++;       dist[u] = 0;       return 0;     } else       return 1;   }   int main() {     scanf( %d , &a);     int x, y;     int start = 0;     for (int i = 0; i < a - 1; i++) {       scanf( %d %d , &x, &y);       start = x;       graph[x].push_back(y);       graph[y].push_back(x);     }     if (a % 2 == 1) {       cout << -1 << endl;       return 0;     }     dfs(start, 0);     cout << cnt - 1 << endl;   }