malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   void solve() {     long long r, x1, x2, y1, y2, ans;     cin >> r >> x1 >> y1 >> x2 >> y2;     double d1, d2;     x1 -= x2;     y1 -= y2;     d1 = sqrt(1.0 * (x1 * x1 + y1 * y1));     d2 = d1;     d2 /= (2 * r * 1.0);     if (floor(d2) == ceil(d2)) {       ans = d2;     } else {       ans = d2 + 1;     }     cout << ans;   }   int main() { solve(); }
#include <bits/stdc++.h>   using namespace std;   template <typename _T>   inline void _DBG(const char *s, _T x) {     cerr << s <<   =   << x <<   n ;   }   template <typename _T, typename... args>   void _DBG(const char *s, _T x, args... a) {     while (*s !=  , ) cerr << *s++;     cerr <<   =   << x <<  , ;     _DBG(s + 1, a...);   }   const int M = 1e9 + 7;   long long P(long long a, int x) {     long long res = 1;     while (x--) res = res * a % M;     return res;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n, m;     cin >> n >> m;     cout << (P(2, m) * P(n + 1, m - 1)) % M * (n + 1 - m) % M <<   n ;     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   using namespace std;   map<string, long long int> month;   void Month() {     month[ January ] = 1, month[ February ] = 2, month[ March ] = 3,     month[ April ] = 4, month[ May ] = 5, month[ June ] = 6;     month[ July ] = 7, month[ August ] = 8, month[ September ] = 9,     month[ October ] = 10, month[ November ] = 11, month[ December ] = 12;   }   long long int A[1000000];   long long int B[1000000];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     vector<long long int> v;     long long int n, res, x = 0;     cin >> n;     res = n;     while (res != 0) x++, res /= 10;     x *= 9;     if (x >= n)       x = 1;     else       x = n - x;     for (long long int i = x; i <= n; i++) {       long long int val = i, s = 0;       while (val != 0) s += (val % 10), val /= 10;       if ((i + s) == n) v.push_back(i);     }     if (v.size()) {       cout << v.size() << endl;       for (long long int i = 0; i < v.size(); i++) cout << v[i] << endl;     } else       cout << 0 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void ex() {     cout <<  NO n ;     exit(0);   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n;     cin >> n;     vector<pair<bool, int> > q(2 * n);     for (int i = 0; i < 2 * n; ++i) {       char t;       cin >> t;       if (t ==  + ) {         q[i] = {true, -1};       } else {         int x;         cin >> x;         q[i] = {false, x};       }     }     reverse(q.begin(), q.end());     vector<int> w, e;     for (int i = 0; i < 2 * n; ++i) {       if (q[i].first) {         if (!e.empty()) {           w.push_back(e.back());           e.pop_back();         } else {           ex();         }       } else {         if (!e.empty() and e.back() < q[i].second) {           ex();         }         e.push_back(q[i].second);       }     }     if (!e.empty()) {       ex();     }     cout <<  YES n ;     for (int i = n - 1; i > -1; --i) {       cout << w[i] <<    ;     }     cout <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int num = 1001;   struct node {     long long l, r;     int t;   } a[1008611];   long long ans[1008611], tm[1008611];   int main() {     long long n, m;     cin >> n >> m;     for (long long i = 0; i < m; i++) {       cin >> a[i].t >> a[i].l >> a[i].r;       if (a[i].t) {         for (long long k = a[i].l; k < a[i].r; k++) {           tm[k] = 1;         }       }     }     ans[1] = num;     for (long long i = 2; i <= n; i++) {       if (tm[i - 1] == 0) num--;       ans[i] = num;     }     for (long long j = 0; j < m; j++) {       int pos = 1;       for (long long k = a[j].l; k < a[j].r; k++) {         if (ans[k] > ans[k + 1]) {           pos = 0;           break;         }       }       if (pos != a[j].t) {         cout <<  NO  << endl;         return 0;       }     }     cout <<  YES  << endl;     for (int i = 1; i <= n; i++) cout << ans[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long w1, h1, w2, h2, ans = 0;   int main() {     cin >> w1 >> h1 >> w2 >> h2;     ans += (h1 + h2) + 2;     ans += w2 + 1;     ans += (h1 + h2) + 1;     ans += w1 - w2;     ans += w1;     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int NMAX = 1e5;   int t;   int n, m, k;   vector<int> graph[NMAX + 5];   int gr[NMAX + 5];   bool active[NMAX + 5];   bool in[NMAX + 5];   bool exists(int i, int j) {     vector<int>::iterator it = lower_bound(graph[i].begin(), graph[i].end(), j);     if (it != graph[i].end() && *it == j) {       return true;     }     return false;   }   int main() {     scanf( %d , &t);     while (t--) {       scanf( %d %d %d , &n, &m, &k);       for (int i = 1; i <= n; i++) {         gr[i] = 0;         graph[i].clear();         active[i] = 1;         in[i] = 0;       }       for (int i = 1; i <= m; i++) {         int u, v;         scanf( %d %d , &u, &v);         graph[u].push_back(v);         graph[v].push_back(u);         gr[u]++;         gr[v]++;       }       if (1LL * k * (k - 1) > 2 * m) {         printf( -1 n );         continue;       }       queue<int> q;       for (int i = 1; i <= n; i++) {         sort(graph[i].begin(), graph[i].end());         if (gr[i] < k) {           q.push(i);           in[i] = 1;         }       }       while (!q.empty()) {         int nod = q.front();         active[nod] = 0;         q.pop();         for (auto it : graph[nod]) {           gr[it]--;           if (in[it] == 0 && gr[it] < k) {             in[it] = 1;             q.push(it);           }         }       }       vector<int> ans;       for (int i = 1; i <= n; i++) {         if (active[i] == 1) {           ans.push_back(i);         }       }       if (ans.empty() == false) {         printf( 1 %d n , (int)ans.size());         for (auto it : ans) {           printf( %d  , it);         }         printf(  n );         continue;       }       for (int i = 1; i <= n; i++) {         gr[i] = graph[i].size();         active[i] = 1;         in[i] = 0;       }       for (int i = 1; i <= n; i++) {         if (gr[i] < k) {           in[i] = 1;           q.push(i);         }       }       bool found = false;       while (!q.empty()) {         int nod = q.front();         q.pop();         active[nod] = 0;         if (gr[nod] == k - 1) {           vector<int> nodes = {nod};           for (auto it : graph[nod]) {             if (active[it] == 1) {               nodes.push_back(it);             }           }           bool ok = true;           for (int i = 0; i < (int)nodes.size() && ok; i++) {             for (int j = i + 1; j < (int)nodes.size() && ok; j++) {               ok &= exists(nodes[i], nodes[j]);             }           }           if (ok == true) {             found = true;             printf( 2 n );             for (auto it : nodes) {               printf( %d  , it);             }             printf(  n );             break;           }         }         for (auto it : graph[nod]) {           gr[it]--;           if (in[it] == 0 && gr[it] < k) {             in[it] = 1;             q.push(it);           }         }       }       if (found == false) {         printf( -1 n );         continue;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string t =  abacaba ;   int get(string a) {     int cnt = 0;     for (int i = 0; i < a.size(); i++) {       if (a.substr(i, t.size()) == t) cnt++;     }     return cnt;   }   int main() {     int T;     scanf( %d , &T);     while (T--) {       int n;       string a;       cin >> n >> a;       int cnt = 0;       for (int i = 0; i < a.size(); i++) {         if (a.substr(i, t.size()) == t) cnt++;       }       if (cnt > 1)         puts( No );       else if (cnt == 1) {         puts( Yes );         for (int i = 0; i < a.size(); i++) {           if (a[i] !=  ? )             printf( %c , a[i]);           else             putchar( z );         }         puts(  );       } else {         bool f = false;         for (int i = 0; i < n; i++) {           int cnt = 0;           for (int k = i, j = 0; j < t.size() && k < a.size(); k++, j++) {             if (a[k] == t[j] || a[k] ==  ? )               cnt++;             else               break;           }           if (cnt == t.size()) {             string ts = a;             for (int k = i, j = 0; j < t.size(); k++, j++) ts[k] = t[j];             if (get(ts) > 1)               continue;             else {               f = true;               puts( Yes );               for (int i = 0; i < ts.size(); i++)                 if (ts[i] ==  ? ) ts[i] =  z ;               cout << ts << endl;             }             break;           }         }         if (!f) puts( No );       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     assert(1 <= n && n <= (int)(2e5));     string sex;     cin >> sex;     assert(sex.size() == n);     for (int i = 0; i < n; ++i) {       assert(sex[i] ==  B  || sex[i] ==  G );     }     vector<int> a(n);     for (int i = 0; i < n; ++i) {       cin >> a[i];       assert(1 <= a[i] && a[i] <= (int)(1e7));     }     vector<int> pre(n), nxt(n);     priority_queue<pair<int, pair<int, int> >,                    vector<pair<int, pair<int, int> > >,                    greater<pair<int, pair<int, int> > > >         pq;     for (int i = 0; i < n; ++i) {       pre[i] = i - 1;       nxt[i] = i + 1;       if (i > 0 && sex[i - 1] != sex[i]) {         pq.push(make_pair(abs(a[i - 1] - a[i]), make_pair(i - 1, i)));       }     }     vector<bool> mark(n, true);     vector<pair<int, int> > result;     while (!pq.empty()) {       int i = pq.top().second.first;       int j = pq.top().second.second;       pq.pop();       if (mark[i] && mark[j]) {         mark[i] = false;         mark[j] = false;         result.push_back(make_pair(i, j));         i = pre[i];         j = nxt[j];         if (i != -1) {           nxt[i] = j;         }         if (j != n) {           pre[j] = i;         }         if (i != -1 && j != n && sex[i] != sex[j] && mark[i] && mark[j]) {           pq.push(make_pair(abs(a[i] - a[j]), make_pair(i, j)));         }       }     }     cout << result.size() << endl;     for (int i = 0; i < result.size(); ++i) {       cout << result[i].first + 1 <<     << result[i].second + 1 << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bitset<100015> A[4096];   int n, m, k, q, lp, S, a[12][100015], t[100015], x[100015], y[100015],       p[100015];   int main() {     int i, j, l;     scanf( %d %d %d , &n, &k, &q);     for (i = 0; i < k; i++)       for (j = 1; j <= n; j++) scanf( %d , &a[i][j]);     for (i = 1; i <= q; i++) {       scanf( %d %d %d , &t[i], &x[i], &y[i]);       if (t[i] <= 2)         x[i]--, y[i]--;       else         x[i]--;     }     for (i = 0; i < (1 << k); i++) {       m = k;       for (j = 0; j < k; j++) A[i][j] = ((i >> j) & 1);       for (j = 1; j <= q; j++) {         if (t[j] == 1) A[i][m++] = (A[i][x[j]] | A[i][y[j]]);         if (t[j] == 2) A[i][m++] = (A[i][x[j]] & A[i][y[j]]);       }     }     for (i = 1; i <= q; i++) {       if (t[i] != 3) continue;       for (j = 0; j < k; j++) p[j] = a[j][y[i]];       sort(p, p + k);       for (j = 0; j < k; j++) {         for (l = S = 0; l < k; l++)           if (a[l][y[i]] > p[j]) S |= (1 << l);         if (!A[S][x[i]]) break;       }       printf( %d n , p[j]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, q, x, y;   int a[200005];   long long lazy[200005 * 4], S[200005 * 4];   void push(int node, int bas, int son) {     S[node * 2] += lazy[node];     S[node * 2 + 1] += lazy[node];     lazy[node * 2] += lazy[node];     lazy[node * 2 + 1] += lazy[node];     lazy[node] = 0;   }   int get(int node, int bas, int son) {     if (bas == son) return (S[node] == 0 ? bas : -1);     if (S[node] < 0) return -1;     push(node, bas, son);     return max(get(node * 2, bas, ((bas + son) / 2)),                get(node * 2 + 1, ((bas + son) / 2) + 1, son));   }   void up(int node, int bas, int son, int x, int y, long long val) {     if (bas > y || son < x) return;     if (bas >= x && son <= y) {       S[node] += val;       lazy[node] += val;       return;     }     push(node, bas, son);     up(node * 2, bas, ((bas + son) / 2), x, y, val);     up(node * 2 + 1, ((bas + son) / 2) + 1, son, x, y, val);     S[node] = max(S[node * 2], S[node * 2 + 1]);   }   int main() {     long long sum = 0;     scanf( %d %d , &n, &q);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);       up(1, 1, n, i, i, a[i] - sum);       sum += a[i];     }     while (q--) {       scanf( %d %d , &x, &y);       up(1, 1, n, x, x, y - a[x]);       up(1, 1, n, x + 1, n, a[x] - y);       a[x] = y;       printf( %d n , get(1, 1, n));     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int x, y, z;     cin >> x >> y >> z;     int x1, y1, z1;     cin >> x1 >> y1 >> z1;     int a[6];     for (auto &z : a) cin >> z;     int sum = 0;     if (x < 0)       sum += a[4];     else if (x > x1)       sum += a[5];     if (y < 0)       sum += a[0];     else if (y > y1)       sum += a[1];     if (z < 0)       sum += a[2];     else if (z > z1)       sum += a[3];     cout << sum <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1005;   const int M = 1000005;   const long long INF = (long long)(1e15);   long long a[N][N];   long long retc[M], retr[M];   priority_queue<pair<long long, int> > sc, sr;   int main() {     int n, m, k, p;     scanf( %d%d%d%d , &n, &m, &k, &p);     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         scanf( %I64d , &a[i][j]);       }     }     for (int i = 1; i <= n; i++) {       long long s = 0;       for (int j = 1; j <= m; j++) {         s += a[i][j];       }       sr.push(make_pair(s, i));     }     for (int j = 1; j <= m; j++) {       long long s = 0;       for (int i = 1; i <= n; i++) {         s += a[i][j];       }       sc.push(make_pair(s, j));     }     for (int i = 1; i <= k; i++) {       long long s = sr.top().first;       int id = sr.top().second;       retr[i] = retr[i - 1] + s;       s -= p * m;       sr.pop();       sr.push(make_pair(s, id));     }     for (int i = 1; i <= k; i++) {       long long s = sc.top().first;       int id = sc.top().second;       retc[i] = retc[i - 1] + s;       s -= p * n;       sc.pop();       sc.push(make_pair(s, id));     }     long long ans = -INF;     for (int i = 0; i <= k; i++) {       ans = max(ans, retr[i] + retc[k - i] - (long long)i * (k - i) * p);     }     printf( %I64d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long double PI = 3.14159265359;   long long inf = 1000000000000000007;   long long mod = 1000000007;   long long mod1 = 998244353;   const bool multi = 0;   long long DP[500007];   long long s[500007];   vector<long long> G[500007];   long long ans = inf, n;   void dfs(long long v, long long o) {     s[v] = 1;     vector<pair<pair<long long, long long>, long long>> DPs;     DP[v] = inf;     if ((long long)(G[v]).size() == 1) DP[v] = 0;     long long sum = 0;     for (auto u : G[v]) {       if (u == o) continue;       dfs(u, v);       s[v] += s[u];       DPs.push_back({{-2 * s[u], 2 * DP[u] + s[u] * (s[u] + 1)}, u});     }     sort(DPs.begin(), DPs.end());     vector<pair<long long, long long>> CHT;     for (auto x : DPs) {       long long l = 0, r = (long long)(CHT).size() - 1, sr;       long long S = n - s[x.second];       ans =           min(ans, 2 * DP[x.second] + (n - s[x.second]) * (n - s[x.second] - 1));       while (l <= r) {         sr = (l + r) / 2;         long long L =             2 * DP[x.second] + S * (S - 1) + S * CHT[sr].first + CHT[sr].second;         ans = min(ans, L);         if (sr + 1 == (long long)(CHT).size()) break;         long long R = 2 * DP[x.second] + S * (S - 1) + S * CHT[sr + 1].first +                       CHT[sr + 1].second;         ans = min(ans, R);         if (L <= R)           r = sr - 1;         else           l = sr + 1;       }       if ((long long)(CHT).size() == 0 || x.first.first != CHT.back().first)         CHT.push_back({x.first.first, x.first.second});       DP[v] = min(DP[v], DP[x.second] +                              (s[v] - s[x.second]) * (s[v] - s[x.second] - 1) / 2);     }   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long tt;     if (multi)       cin >> tt;     else       tt = 1;     while (tt--) {       long long a, b;       cin >> n;       for (long long i = 1; i < n; i++) {         cin >> a >> b;         G[a].push_back(b);         G[b].push_back(a);       }       dfs(1, -1);       ans /= 2;       cout << ans + 2 * (n * (n - 1) / 2 - ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count() *                  ((uint64_t) new char | 1));   int K, N;   vector<int> A, B, Z;   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     cin >> K;     N = 1 << K;     Z.resize(N);     int all_xor = 0;     for (auto &z : Z) {       cin >> z;       all_xor ^= z;     }     if (all_xor != 0) {       cout <<  Fou  <<   n ;       return 0;     }     A.resize(N);     B.resize(N);     vector<int> location(N);     for (int i = 0; i < N; i++) A[i] = B[i] = i;     shuffle(A.begin(), A.end(), rng);     shuffle(B.begin(), B.end(), rng);     for (int i = 0; i < N; i++) location[B[i]] = i;     for (int i = 0; i < N; i++) {       int u = i;       while (Z[u] != (A[u] ^ B[u])) {         int v = location[A[u] ^ Z[u]];         swap(B[u], B[v]);         swap(location[B[u]], location[B[v]]);         if (v > i) {           break;         } else {           swap(A[v], A[i + 1]);           u = v;         }       }     }     cout <<  Shi  <<   n ;     for (int i = 0; i < N; i++) cout << A[i] << (i < N - 1 ?     :   n );     for (int i = 0; i < N; i++) cout << B[i] << (i < N - 1 ?     :   n );   }
#include<bits/stdc++.h>   #define PI acos(-1.0)    #define eps 1e-8   #define fi first   #define se second   #define m_p make_pair   //#define int long long   #define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)   using namespace std;   typedef long long ll;   typedef unsigned int uint;    const double E_num = 0.57721566490153286060651209;   const int maxn = 2e3 + 10;   const int N = 5e5 + 10;   const int INF = 0x3f3f3f3f;   const int mod = 1e9 + 7;         int n,m,w;   int mp[maxn][maxn];   ll dis1[maxn][maxn],dis2[maxn][maxn],ans1 = 1e18,ans2 = 1e18;   queue<pair<int,int>> q;   inline void bfs1(int x,int y)   {    #define dis dis1    memset(dis,INF,sizeof(dis));    q.push(m_p(x,y));    dis[x][y] = 0;    while(!q.empty())    {     x = q.front().fi,y = q.front().se;     q.pop();     if(dis[x - 1][y] > dis[x][y] + w && mp[x - 1][y] >= 0)     {      q.push(m_p(x - 1,y));      dis[x - 1][y] = dis[x][y] + w;     }     if(dis[x + 1][y] > dis[x][y] + w && mp[x + 1][y] >= 0)     {      q.push(m_p(x + 1,y));      dis[x + 1][y] = dis[x][y] + w;     }     if(dis[x][y - 1] > dis[x][y] + w && mp[x][y - 1] >= 0)     {      q.push(m_p(x,y - 1));      dis[x][y - 1] = dis[x][y] + w;     }     if(dis[x][y + 1] > dis[x][y] + w && mp[x][y + 1] >= 0)     {      q.push(m_p(x,y + 1));      dis[x][y + 1] = dis[x][y] + w;     }    }    #undef dis   }   inline void bfs2(int x,int y)   {    #define dis dis2    memset(dis,INF,sizeof(dis));    q.push(m_p(x,y));    dis[x][y] = 0;    while(!q.empty())    {     x = q.front().fi,y = q.front().se;     q.pop();     if(dis[x - 1][y] > dis[x][y] + w && mp[x - 1][y] >= 0)     {      q.push(m_p(x - 1,y));      dis[x - 1][y] = dis[x][y] + w;     }     if(dis[x + 1][y] > dis[x][y] + w && mp[x + 1][y] >= 0)     {      q.push(m_p(x + 1,y));      dis[x + 1][y] = dis[x][y] + w;     }     if(dis[x][y - 1] > dis[x][y] + w && mp[x][y - 1] >= 0)     {      q.push(m_p(x,y - 1));      dis[x][y - 1] = dis[x][y] + w;     }     if(dis[x][y + 1] > dis[x][y] + w && mp[x][y + 1] >= 0)     {      q.push(m_p(x,y + 1));      dis[x][y + 1] = dis[x][y] + w;     }    }    #undef dis   }   int main()   {    IOS;    cin >> n >> m >> w;    for(int i = 0;i <= m + 1; ++i)    {     mp[0][i] = mp[n + 1][i] = -1;    }    for(int i = 1;i <= n + 1; ++i)    {     mp[i][0] = mp[i][m + 1] = -1;    }    for(int i = 1;i <= n; ++i)    {     for(int j = 1;j <= m; ++j)      {      cin >> mp[i][j];     }    }    bfs1(1,1);    bfs2(n,m);    for(int i = 1;i <= n; ++i)    {     for(int j = 1;j <= m; ++j)     {      if(mp[i][j] > 0) ans1 = min(ans1,dis1[i][j] + mp[i][j]);     }    }    for(int i = 1;i <= n; ++i)    {     for(int j = 1;j <= m; ++j)     {      if(mp[i][j] > 0) ans2 = min(ans2,dis2[i][j] + mp[i][j]);     }    }    ans1 = min(dis1[n][m] ,ans1 + ans2);    if(ans1 < 1e18) cout << ans1 << endl;    else cout << -1 << endl;    return 0;   }
#include<bits/stdc++.h>   using namespace std;   #define lc cout<<  n    #define f1(a) for(int i=0;i<a;++i)   int main(){    ios_base::sync_with_stdio(false);    cin.tie(NULL);    cout.tie(NULL);    int t;cin>>t;    while(t--){     int n;cin>>n;     int a[n],b[n];     std::vector<int> pos_index,pos_dif;     std::vector<int> neg_index,neg_dif;     f1(n){cin>>a[i];}     f1(n){cin>>b[i];}     int test=0;     f1(n){test+=a[i]-b[i];      if(a[i]-b[i]>0){pos_index.emplace_back(i);pos_dif.emplace_back(a[i]-b[i]);}      else{       if(a[i]-b[i]<0){       neg_index.emplace_back(i);neg_dif.emplace_back(b[i]-a[i]);       }      }}     if(test!=0){cout<<-1;lc;}     else{      f1(n){test+=abs(a[i]-b[i]);}      int res=test/2;      cout<<res;lc;      vector<int>fr,se;      f1(pos_dif.size()){while(pos_dif[i]--){fr.emplace_back(pos_index[i]);}}      f1(neg_dif.size()){while(neg_dif[i]--){se.emplace_back(neg_index[i]);}}      f1(fr.size()){cout<<fr[i]+1<<   <<se[i]+1;lc;}                    }            }    return 0;   }
#include <bits/stdc++.h>   using namespace std;   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;   }   const long long N = 200005;   const long long MOD = 1e9 + 7;   long long cnt[N];   long long ara[N];   int main() {     long long n = ({       long long a;       read(a);       a;     });     long long mx = 0;     long long val;     for (int i = 1; i <= n; i++) {       ara[i] = ({         long long a;         read(a);         a;       });       ++cnt[ara[i]];       if (cnt[ara[i]] > mx) {         mx = cnt[ara[i]];         val = ara[i];       }     }     if (mx == n)       puts( 0 );     else {       cout << n - mx << endl;       for (int i = 1; i <= n; i++) {         if (ara[i] == val) {           for (long long j = i - 1; j >= 1; --j) {             if (ara[j] != val) {               if (ara[j] > val) {                 cout << 2 <<     << j <<     << j + 1 << endl;               } else {                 cout << 1 <<     << j <<     << j + 1 << endl;               }               ara[j] = val;             } else               break;           }           for (long long j = i + 1; j <= n; ++j) {             if (ara[j] != val) {               if (ara[j] > val) {                 cout << 2 <<     << j <<     << j - 1 << endl;               } else {                 cout << 1 <<     << j <<     << j - 1 << endl;               }               ara[j] = val;             } else               break;           }         }       }     }   }
#include <bits/stdc++.h>   using namespace std;   int a[1000004];   int main() {     int n, x;     long long sum;     int cnt;     while (scanf(  %d , &n) == 1) {       sum = 0LL;       cnt = 0;       for (int i = 0; i < n; i++) {         scanf(  %d , &a[i]);         if (a[i] % 2 == 1) cnt++;         sum += a[i];       }       if (sum % 2LL == 0LL) {         if (cnt % 2 == 0 && cnt > 0)           cout <<  First n ;         else           cout <<  Second n ;       } else         cout <<  First n ;     }   }