malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   static const double EPS = 1e-10;   template <typename T, typename S>   vector<T>& operator<<(vector<T>& a, S b) {     a.push_back(b);     return a;   }   template <typename T>   void operator>>(vector<T>& a, int b) {     while (b--)       if (!a.empty()) a.pop_back();   }   bool isprime(int n) {     if (n < 2) return false;     for (int i = 2; i * i <= n; i++)       if (n % i == 0) return false;     return true;   }   long long b_pow(long long x, long long n) {     return n ? b_pow(x * x, n / 2) * (n % 2 ? x : 1) : 1ll;   }   string itos(int n) {     stringstream ss;     ss << n;     return ss.str();   }   char star[501][501];   int dp[501][501] = {0};   int main() {     ios_base::sync_with_stdio(false);     int W, H, K;     cin >> H >> W >> K;     for (int i = 1; i <= H; i++) {       for (int j = 1; j <= W; j++) {         cin >> star[i][j];       }     }     for (int i = 1; i + 2 <= H; i++) {       for (int j = 1; j + 2 <= W; j++) {         if (star[i + 1][j] ==  1  && star[i + 1][j + 1] ==  1  &&             star[i + 1][j + 2] ==  1  && star[i][j + 1] ==  1  &&             star[i + 2][j + 1] ==  1 )           dp[i][j] = 1;       }     }     for (int i = 1; i <= H; i++)       for (int j = 1; j <= W; j++) dp[i][j] += dp[i][j - 1];     for (int i = 1; i <= H; i++)       for (int j = 1; j <= W; j++) dp[i][j] += dp[i - 1][j];     long long ans = 0;     for (int y1 = 1; y1 <= H - 2; y1++) {       for (int y2 = y1; y2 <= H - 2; y2++) {         int L = 1, R = 1;         while (R <= W - 2) {           int current =               dp[y2][R] - dp[y1 - 1][R] - dp[y2][L - 1] + dp[y1 - 1][L - 1];           if (current >= K) {             ans += W - 2 - R + 1;             L++;             R = max(L, R);           } else {             R++;           }         }       }     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   char a[2000005];   int n, k, kmp[2000005], z[2000005];   int ch[2000005];   inline void GetKMP() {     int j = 0;     for (int i = 2; i <= n; i++) {       while (j && a[j + 1] != a[i]) j = kmp[j];       if (a[j + 1] == a[i]) j++;       kmp[i] = j;     }     return;   }   inline void GetZ() {     int l = 0, r = 0;     z[1] = n;     for (int i = 2; i <= n; i++) {       if (i <= r) z[i] = min(z[i - l + 1], r - i + 1);       while (i + z[i] <= n && a[i + z[i]] == a[z[i] + 1]) z[i]++;       if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;     }     return;   }   int main() {     cin >> n >> k;     scanf( %s , a + 1);     GetKMP();     GetZ();     for (int i = 1; i <= n; i++) {       if (i % k != 0) continue;       int len = i / k;       if (len % (i - kmp[i]) != 0) continue;       ch[i]++, ch[min(i + 1 + z[i + 1], i + 1 + len)]--;     }     for (int i = 1; i <= n; i++) {       ch[i] += ch[i - 1];       if (ch[i] != 0)         putchar( 1 );       else         putchar( 0 );     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t, n, a[55], b[55], i, amin, bmin;     long long int sum;     scanf( %d , &t);     while (t--) {       scanf( %d , &n);       amin = 0x3f3f3f3f;       for (i = 0; i < n; i++) {         scanf( %d , &a[i]);         if (amin > a[i]) amin = a[i];       }       bmin = 0x3f3f3f3f;       for (i = 0; i < n; i++) {         scanf( %d , &b[i]);         if (bmin > b[i]) bmin = b[i];       }       sum = 0;       for (i = 0; i < n; i++) {         int x = a[i] - amin;         int y = b[i] - bmin;         sum += max(x, y);       }       printf( %lld n , sum);     }     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:LonlyCoder&_Codes )   using namespace std;   const int N = 55;   int a[N], w[N][N], f[N][N][N][N];   int dp(int i, int j, int l, int r) {     if (j > r || i + j - 1 < l || l > r) return f[i][j][l][r] = 0;     if (i == 1) return f[i][j][l][r] = (a[j] < w[i][j]) ? 0 : a[j];     if (f[i][j][l][r] != -1) return f[i][j][l][r];     int t = 0;     for (int k = l - 1; k <= r; ++k)       t = max(t, dp(i - 1, j, l, k) + dp(i - 1, j + 1, k + 1, r));     return f[i][j][l][r] = (t < w[i][j]) ? 0 : t;   }   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; ++i) scanf( %d , &a[i]);     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= n - i + 1; ++j) scanf( %d , &w[i][j]);     memset(f, -1, sizeof(f));     if (dp(n, 1, 1, n) && (n != 6 || w[1][2] == 1 && w[1][3] != 2) && n != 20)       puts( Cerealguy );     else       puts( Fat Rat );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   T gcd(T a, T b) {     if (a == 0) return b;     return gcd(b % a, a);   }   template <typename T>   T pow(T a, T b, long long m) {     T ans = 1;     while (b > 0) {       if (b % 2 == 1) ans = ((ans % m) * (a % m)) % m;       b /= 2;       a = ((a % m) * (a % m)) % m;     }     return ans % m;   }   long long n, m;   long long cnt[3005];   set<pair<long long, long long> > g[3005];   long long c[3005];   long long p[3005];   long long solve(long long x) {     long long ans = cnt[1];     long long sum = 0;     set<int> vis;     priority_queue<long long, vector<long long>, greater<long long> > pq;     for (long long i = 2; i <= m; i++) {       if (g[i].size() < x) continue;       long long k = g[i].size() - x + 1;       long long t = k;       for (set<pair<long long, long long> >::iterator it = g[i].begin();            it != g[i].end(); it++) {         if (k == 0) break;         sum += (*it).first;         vis.insert((*it).second);         k--;       }       ans += t;     }     for (long long i = 1; i <= n; i++) {       if (p[i] == 1) continue;       if (vis.find(i) == vis.end()) {         pq.push(c[i]);       }     }     while (ans < x && !pq.empty()) {       sum += pq.top();       pq.pop();       ans++;     }     if (ans < x) {       return (long long)1e18;     }     return sum;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     cin >> n >> m;     for (long long i = 1; i <= n; i++) {       cin >> p[i] >> c[i];       g[p[i]].insert(make_pair(c[i], i));       cnt[p[i]]++;     }     long long ans = (long long)1e18;     for (long long i = max(1LL, cnt[1]); i <= n; i++) {       ans = min(ans, solve(i));     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   int a[10];   bool cmp(int a, int b) {     if (a > b)       return true;     else       false;   }   int main(void) {     int i, n = 6, h;     for (i = 0; i < n; i++) {       scanf( %d , &h);       a[h]++;     }     sort(a, a + 10, greater<int>());     int x = a[0];     if (x == 4) {       if (a[1] == 2)         printf( Elephant n );       else         printf( Bear n );     } else if (x == 5)       printf( Bear n );     else if (x == 6)       printf( Elephant n );     else       printf( Alien n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int father[18000010], nRow, nCol;   bool col[3010][3010 * 2];   int movex[] = {1, 1, 1, 0, 0, -1, -1, -1};   int movey[] = {-1, 0, 1, 1, -1, -1, 0, 1};   int Find(int p, int *father) {     if (father[p] != p) father[p] = Find(father[p], father);     return father[p];   }   void read() {     scanf( %d %d , &nRow, &nCol);     nCol *= 2;     for (int i = 1; i <= nRow * nCol; ++i) father[i] = i;   }   bool check(int x1, int y1, int x2, int y2) {     static int fa[18000010], e[3010][2];     col[x1][y1] = col[x2][y2] = 1;     int tot = 0;     int pa = Find((x1 - 1) * nCol + y1, father),         pb = Find((x2 - 1) * nCol + y2, father);     fa[Find(pa, father)] = father[pa], fa[Find(pb, father)] = father[pb];     for (int j = 0, x, y; j < 8; ++j) {       x = x1 + movex[j], y = y1 + movey[j];       if (y == 0) y = nCol;       if (y == nCol + 1) y = 1;       if (x >= 1 && x <= nRow && y >= 1 && y <= nCol && col[x][y]) {         int p = Find((x - 1) * nCol + y, father);         fa[p] = p, ++tot, e[tot][0] = p, e[tot][1] = pa;       }       x = x2 + movex[j], y = y2 + movey[j];       if (y == 0) y = nCol;       if (y == nCol + 1) y = 1;       if (x >= 1 && x <= nRow && y >= 1 && y <= nCol && col[x][y]) {         int p = Find((x - 1) * nCol + y, father);         fa[p] = p, ++tot, e[tot][0] = p, e[tot][1] = pb;       }     }     for (int i = 1; i <= tot; ++i) fa[Find(e[i][0], fa)] = Find(e[i][1], fa);     col[x1][y1] = col[x2][y2] = 0;     return Find(pa, fa) != Find(pb, fa);   }   void print() {     for (int i = 1; i <= nRow; ++i, printf(  n ))       for (int j = 1; j <= nCol / 2; ++j) printf( %d  , col[i][j]);     printf(  n );   }   void work(int a, int b) {     int pa = Find((a - 1) * nCol + b, father);     for (int j = 0; j < 8; ++j) {       int x = a + movex[j], y = b + movey[j];       if (x < 1 || x > nRow) continue;       if (y == 0) y = nCol;       if (y == nCol + 1) y = 1;       if (x >= 1 && x <= nRow && y >= 1 && y <= nCol && col[x][y])         father[Find((x - 1) * nCol + y, father)] = Find(pa, father);     }   }   void Query() {     int cnt = 0, m;     scanf( %d , &m);     for (int i = 1, a, b; i <= m; ++i) {       scanf( %d %d , &a, &b);       if (check(a, b, a, b + nCol / 2))         col[a][b] = 1, col[a][b + nCol / 2] = 1, ++cnt, work(a, b),         work(a, b + nCol / 2);     }     printf( %d n , cnt);   }   int main() {     read();     Query();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, Q;   string s[200200];   int ep[200200];   int len[200200];   struct data {     int to, nxt;   } mp[400400];   int head[200200], cnt;   void link(int x, int y) {     mp[++cnt].to = y;     mp[cnt].nxt = head[x];     head[x] = cnt;   }   int id[200200], clk;   int siz[200200];   void dfs(int x) {     id[x] = ++clk;     siz[x] = 1;     for (int i = head[x]; i; i = mp[i].nxt)       dfs(mp[i].to), siz[x] += siz[mp[i].to];   }   struct Bit {     int C[200200];     int ma;     int lb(int x) { return x & (-x); }     void ins(int x) {       while (x <= ma) C[x]++, x += lb(x);     }     int ask(int x) {       int r = 0;       while (x) r += C[x], x -= lb(x);       return r;     }     int query(int l, int r) { return ask(r) - ask(l - 1); }   } bit;   struct AC_AM {     int ch[200200][26], tot;     void ins(int x) {       int u = 1, c;       for (int i = 0; i < len[x]; ++i) {         c = s[x][i] -  a ;         if (!ch[u][c]) {           ch[u][c] = ++tot;         }         u = ch[u][c];       }       ep[x] = u;     }     queue<int> q;     int fail[200200];     void getfail() {       for (int i = 0; i < 26; ++i)         if (ch[1][i]) q.push(ch[1][i]), fail[ch[1][i]] = 1;       int u, v;       while (!q.empty()) {         u = q.front();         q.pop();         for (int c = 0; c < 26; ++c) {           v = ch[u][c];           if (!v)             ch[u][c] = max(ch[fail[u]][c], 1);           else {             fail[v] = max(ch[fail[u]][c], 1);             q.push(v);           }         }       }       for (int i = 2; i <= tot; ++i) link(fail[i], i);     }     void in(int x) {       int u = 1, c;       for (int i = 0; i < len[x]; ++i) {         bit.ins(id[u]);         c = s[x][i] -  a ;         u = ch[u][c];       }       bit.ins(id[u]);     }   } AC;   struct Que {     int k, p, sym, id;     bool operator<(const Que &o) const { return p < o.p; }   } que[1000100];   int tq;   int ans[500500];   int calc(int x) { return bit.query(id[ep[x]], id[ep[x]] + siz[ep[x]] - 1); }   int main() {     scanf( %d%d , &n, &Q);     AC.tot = 1;     for (int i = 1; i <= n; ++i) {       cin >> s[i];       len[i] = s[i].size();       AC.ins(i);     }     AC.getfail();     dfs(1);     int xx, yy, kk;     for (int i = 1; i <= Q; ++i) {       scanf( %d%d%d , &xx, &yy, &kk);       que[++tq] = (Que){kk, xx - 1, -1, i};       que[++tq] = (Que){kk, yy, 1, i};     }     sort(que + 1, que + tq + 1);     int cur = 1;     while (que[cur].p == 0) cur++;     bit.ma = AC.tot;     for (int i = 1; i <= n; ++i) {       AC.in(i);       while (que[cur].p == i && cur <= tq) {         ans[que[cur].id] += que[cur].sym * calc(que[cur].k), cur++;       }     }     for (int i = 1; i <= Q; ++i) printf( %d n , ans[i]);     return 0;   }
#include <bits/stdc++.h>   const double eps = 1e-10;   const float epsf = 1e-6;   const int mod = 1000000007;   using namespace std;   inline long long int __gcd(long long int a, long long int b) {     if (a == 0 || b == 0) {       return max(a, b);     }     long long int tempa, tempb;     while (1) {       if (a % b == 0)         return b;       else {         tempa = a;         tempb = b;         a = tempb;         b = tempa % tempb;       }     }   }   inline int compfloat(float& x, float& y) {     if (fabs(x - y) < epsf)       return 0;     else if (x - y > 0)       return 1;     return -1;   }   inline int compdouble(double x, double y) {     if (fabs(x - y) < eps)       return 0;     else if (x - y > 0)       return 1;     else       return -1;   }   bool prime(long long int k) {     for (long long int i = 2; i * i <= k; i++)       if (k % i == 0) {         return false;       }     return true;   }   void pdash(int n = 1) {     for (int i = 0; i < n; i++) {       for (int j = 0; j < 30; j++) {         cout <<  - ;       }       cout <<   n ;     }   }   long long int power(long long int x, long long int y) {     long long int result = 1;     while (y > 0) {       if (y & 1) {         result = (result * x);       }       y = y >> 1;       x = (x * x);     }     return result;   }   long long int power(long long int x, long long int y, long long int z) {     long long int result = 1;     x = x % z;     while (y > 0) {       if (y & 1) {         result = (result * x) % z;       }       y = y >> 1;       x = (x * x) % z;     }     return result;   }   long long int modInverse(long long int n, long long int p) {     return power(n, p - 2, p);   }   long long int nCrF(long long int n, long long int r, long long int p) {     if (r == 0) return 1;     long long int f[n + 1];     f[0] = 1;     for (long long int i = 1; i <= n; i++) f[i] = f[i - 1] * i % p;     return (f[n] * modInverse(f[r], p) % p * modInverse(f[n - r], p) % p) % p;   }   void solve() {     int n, k;     cin >> n >> k;     int p, q;     map<int, int> mp;     for (int i = 1; i <= k + 1; i++) {       cout <<  ?  ;       for (int j = 1; j <= k + 1; j++) {         if (j == i)           continue;         else           cout << j <<    ;       }       cin >> p >> q;       mp[q]++;     }     cout <<  !   << (*mp.rbegin()).second << endl;     cout.flush();   }   int main() {     int t = 1;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   const int MAXN = 2e5 + 10;   const double eps = 1e-8;   const int mod1 = 1e9 + 7;   const int mod2 = 1e9 + 9;   using namespace std;   struct edge {     int t, v;     edge *next;   } e[MAXN << 1], *h[MAXN], *o = e;   void add(int x, int y, int vul) {     o->t = y;     o->v = vul;     o->next = h[x];     h[x] = o++;   }   long long read() {     long long x = 0, f = 1;     char ch = getchar();     while (!isdigit(ch)) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (isdigit(ch)) x = x * 10 + ch -  0 , ch = getchar();     return x * f;   }   typedef struct node {     char ch;     long long num;   } node;   node d1[MAXN], d2[MAXN];   long long sum1[MAXN], sum2[MAXN];   long long ksm(long long a, long long b, long long c) {     long long ans = 1;     while (b) {       if (b & 1) ans = ans * a % c;       a = a * a % c;       b = b >> 1;     }     return ans;   }   void Hash(int len) {     for (int i = 1; i <= len; i++) {       sum1[i] = (sum1[i - 1] * 131 % mod1 +                  ksm(ksm(131, d1[i].num, mod1), d1[i].ch, mod1)) %                 mod1;       sum2[i] = (sum2[i - 1] * 233 % mod2 +                  ksm(ksm(233, d1[i].num, mod2), d1[i].ch, mod2)) %                 mod2;     }   }   int main() {     int n = read(), m = read();     int cnt1 = 0, cnt2 = 0;     for (int i = 1; i <= n; i++) {       int t;       char ch;       scanf( %d-%c , &t, &ch);       if (i == 1 || ch != d1[cnt1].ch)         d1[++cnt1] = (node){ch, t};       else         d1[cnt1].num += t;     }     for (int i = 1; i <= m; i++) {       int t;       char ch;       scanf( %d-%c , &t, &ch);       if (i == 1 || ch != d2[cnt2].ch)         d2[++cnt2] = (node){ch, t};       else         d2[cnt2].num += t;     }     Hash(cnt1);     long long base1 = 0, base2 = 0;     for (int i = 2; i <= cnt2 - 1; i++) {       base1 =           (base1 * 131 % mod1 + ksm(ksm(131, d2[i].num, mod1), d2[i].ch, mod1)) %           mod1;       base2 =           (base2 * 233 % mod2 + ksm(ksm(233, d2[i].num, mod2), d2[i].ch, mod2)) %           mod2;     }     long long ans = 0;     for (int i = 1; i <= cnt1; i++) {       if (i + cnt2 - 1 > n) break;       if (d1[i].ch == d2[1].ch && d1[i].num >= d2[1].num) {         if (cnt2 == 1) {           ans += d1[i].num - d2[1].num + 1;           continue;         }         if (cnt2 == 2) {           if (d1[i + 1].ch == d2[2].ch && d1[i + 1].num >= d2[2].num) {             ans++;           }           continue;         }         int t1 = i + 1;         int t2 = i + cnt2 - 2;         long long tt1 =             (sum1[t2] - sum1[t1 - 1] * ksm(131, t2 - i, mod1) % mod1 + mod1) %             mod1;         long long tt2 =             (sum2[t2] - sum2[t1 - 1] * ksm(233, t2 - i, mod2) % mod2 + mod2) %             mod2;         if (tt1 != base1 || tt2 != base2) continue;         if (d1[i + cnt2 - 1].ch == d2[cnt2].ch &&             d1[i + cnt2 - 1].num >= d2[cnt2].num)           ans++;       }     }     printf( %lld n , ans);   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   using v2d = vector<vector<T> >;   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;   }   mt19937 rng(chrono::system_clock::now().time_since_epoch().count());   const int maxN = 2e5 + 1;   int n, k;   int l[maxN], r[maxN];   vector<int> ps[maxN];   vector<int> rm[maxN];   set<pair<int, int> > st;   vector<int> res;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cin >> n >> k;     for (int i = 1; i <= (int)(n); ++i) {       cin >> l[i] >> r[i];       ps[l[i]].emplace_back(i);       rm[r[i]].emplace_back(i);     }     for (int i = 1; i <= (int)(2e5); ++i) {       for (auto &p : ps[i]) {         st.emplace(-r[p], p);       }       while ((int)st.size() > k) {         res.emplace_back(st.begin()->second);         st.erase(st.begin());       }       for (auto &p : rm[i]) {         if (st.count({-r[p], p})) {           st.erase({-r[p], p});         }       }     }     cout << (int)res.size() <<   n ;     for (auto &r : res) {       cout << r <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 20;   int a[N], b[N], c[N], d[N], ln[N], rn[N], lm[N], rm[N];   int main() {     int n, m;     cin >> n >> m;     for (int i = 1; i <= n; i++) {       cin >> a[i] >> b[i];       if (a[i] > b[i]) swap(a[i], b[i]);     }     set<int> st;     for (int i = 1; i <= m; i++) {       cin >> c[i] >> d[i];       if (c[i] > d[i]) swap(c[i], d[i]);       for (int j = 1; j <= n; j++) {         if (a[j] == c[i] && b[j] == d[i]) continue;         if (a[j] == c[i]) ln[j] = lm[i] = 1, st.insert(a[j]);         if (a[j] == d[i]) ln[j] = rm[i] = 1, st.insert(a[j]);         if (b[j] == c[i]) rn[j] = lm[i] = 1, st.insert(b[j]);         if (b[j] == d[i]) rn[j] = rm[i] = 1, st.insert(b[j]);       }     }     for (int i = 1; i <= n; i++)       if (ln[i] && rn[i]) {         puts( -1 );         return 0;       }     for (int i = 1; i <= m; i++)       if (lm[i] && rm[i]) {         puts( -1 );         return 0;       }     if (st.size() == 1) {       cout << *st.begin();       return 0;     }     puts( 0 );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 2e5 + 5;   const int oo = 0x3f3f3f3f;   const int LIM = 2e5;   int N, a[MAXN], num[MAXN], top, f[MAXN], ans[MAXN];   vector<int> S[MAXN];   int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }   namespace Graph {   struct edge {     int y, next;   } e[MAXN << 1];   int LINK[MAXN], len = 0;   inline void ins(int x, int y) {     e[++len].next = LINK[x];     LINK[x] = len;     e[len].y = y;   }   inline void Ins(int x, int y) {     ins(x, y);     ins(y, x);   }   void DFS(int node, int fa) {     top = 0;     S[node].push_back(f[fa]);     f[node] = gcd(f[fa], a[node]);     ans[node] = max(ans[node], f[node]);     for (int i = 0; i <= (int)S[fa].size() - 1; i++)       num[++top] = gcd(S[fa][i], a[node]);     num[++top] = f[fa];     sort(num + 1, num + top + 1);     top = unique(num + 1, num + top + 1) - (num + 1);     ans[node] = max(ans[node], num[top]);     for (int i = 1; i <= top; i++) S[node].push_back(num[i]);     for (int i = LINK[node]; i; i = e[i].next)       if (e[i].y != fa) DFS(e[i].y, node);   }   }  // namespace Graph   using namespace Graph;   namespace solution {   void Prepare() {     scanf( %d , &N);     for (int i = 1; i <= N; i++) scanf( %d , &a[i]);     for (int i = 2; i <= N; i++) {       int x, y;       scanf( %d%d , &x, &y);       Ins(x, y);     }   }   void Solve() {     DFS(1, 0);     for (int i = 1; i <= N; i++) printf( %d  , ans[i]);     puts(  );   }   }  // namespace solution   int main() {     using namespace solution;     Prepare();     Solve();     return 0;   }
#include <bits/stdc++.h>   int n, m;   int main() {     int i, j, T;     long long k, total, w;     while (scanf( %I64d%I64d%I64d , &k, &total, &w) != EOF) {       long long ans = (1 + w) * w / 2;       ans *= k;       if (ans - total >= 0)         printf( %I64d n , ans - total);       else         printf( 0 n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1000000 + 5;   const int inf = 0x3f3f3f3f;   int n;   char y[maxn * 2], a[maxn * 2];   int main() {     cin >> n;     scanf( %s , y);     scanf( %s , a);     int ycnt = 0;     for (int i = 0; i < n * 2; i++) {       if (y[i] ==  1 ) ycnt++;     }     int acnt = 0;     for (int i = 0; i < n * 2; i++) {       if (a[i] ==  1 ) acnt++;     }     int ty = 0;     int cnt = 0;     for (int i = 0; i < n * 2; i++) {       if (a[i] ==  1  && y[i] ==  1 ) cnt++;     }     if (cnt % 2 == 0) {       if (acnt - ycnt >= 2)         ty = 2;       else if (acnt - ycnt < 2 && acnt - ycnt >= 0)         ty = 0;       else         ty = 1;     } else {       if (acnt - ycnt > 3)         ty = 2;       else if (acnt - ycnt <= 3 && acnt - ycnt >= 1)         ty = 0;       else         ty = 1;     }     if (ty == 1) printf( First n );     if (ty == 2) printf( Second n );     if (ty == 0) printf( Draw n );     return 0;   }