malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long t;     cin >> t;     while (t--) {       long long sum = 1;       long long sum1 = 0;       long long sum2 = 0;       long long cnt1 = 0;       long long cnt2 = 0;       long long res = 0;       long long flag = 0;       long long n;       cin >> n;       long long bm = n;       string s;       string su;       while (n--) {         cin >> s;         su += s;       }       long long len = su.length();       sort(su.begin(), su.end());       for (long long i = 0; i < len - 1; i++) {         if (su[i] == su[i + 1]) {           sum += 1;         } else {           if (sum % bm == 0) {             sum = 1;           } else {             cout <<  NO  << endl;             ;             flag = 1;             break;           }         }       }       if (sum % bm != 0 && flag == 0) {         cout <<  NO  << endl;         ;       } else if (flag == 0) {         cout <<  YES  << endl;         ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const long double eps = (long double)1e-9;   const long double PI = (long double)acos(-1.0);   const int inf = 1e9 + 5;   const long long linf = 1e18L + 5;   const int mod = 1e9 + 7;   void solve() {     int n, q, r, c;     cin >> n >> q;     unordered_set<int> s[3];     set<pair<int, int> > p;     pair<int, int> pr;     for (int i = 0; i < q; ++i) {       cin >> r >> c;       if (s[r].count(c)) {         s[r].erase(c);         for (int j : {c - 1, c, c + 1}) {           if (j < 1 || j > n) continue;           if (r == 1)             pr = {c, j};           else             pr = {j, c};           auto it = p.find(pr);           if (it != p.end()) p.erase(it);         }       } else {         s[r].insert(c);         for (int j : {c - 1, c, c + 1}) {           if (j < 1 || j > n) continue;           if (r == 1)             pr = {c, j};           else             pr = {j, c};           if (s[3 - r].count(j)) p.insert(pr);         }       }       cout << ((int)(p).size() ?  no  :  yes ) <<   n ;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     ;     int test = 1;     while (test--) {       solve();       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 260;   int m, n, mx[N][10], g[N][26], sl[N], L[N];   char a[N][N];   int kq;   unsigned long long o[N], A[N], B[N], pw[N], P[N];   unsigned long long get(int l, int r) { return A[r] - A[l - 1] * pw[r - l + 1]; }   unsigned long long Get(int l, int r) { return B[l] - B[r + 1] * pw[r - l + 1]; }   unsigned long long GET(int l, int r) {     int tg = L[r - l + 1];     return max(mx[l][tg], mx[r - (1 << tg) + 1][tg]);   }   int main() {     ios_base::sync_with_stdio(0);     cin >> m >> n;     pw[0] = 1;     P[0] = 1;     for (int i = 1, _c = 250; i <= _c; ++i) {       pw[i] = pw[i - 1] * 257;       L[i] = log2(i);     }     for (int i = 1, _c = 25; i <= _c; ++i) P[i] = P[i - 1] * 267;     for (int i = 1, _c = m; i <= _c; ++i)       for (int j = 1, _c = n; j <= _c; ++j) cin >> a[i][j];     for (int l = 1, _c = n; l <= _c; ++l)       for (int r = l, _c = n; r <= _c; ++r) {         if (l == r) {           memset(o, 0, sizeof(o));           memset(g, 0, sizeof(g));           memset(sl, 0, sizeof(sl));         }         for (int i = 1, _c = m; i <= _c; ++i) {           int x = a[i][r] -  a ;           g[i][x]++;           if (g[i][x] % 2)             sl[i]++;           else             sl[i]--;           if (sl[i] > 1)             mx[i][0] = 1;           else             mx[i][0] = 0;           o[i] = o[i] + P[x] * x;         }         for (int j = 1, _c = log2(m); j <= _c; ++j)           for (int i = 1, _c = m; i <= _c; ++i)             mx[i][j] = max(mx[i][j - 1], mx[i + (1 << (j - 1))][j - 1]);         for (int i = 1, _c = m; i <= _c; ++i) A[i] = A[i - 1] * 257 + o[i];         for (int i = m, _c = 1; i >= _c; --i) B[i] = B[i + 1] * 257 + o[i];         for (int i = 1, _c = m; i <= _c; ++i)           if (!mx[i][0]) {             int l = i, r = min(m, i + (i - 1)), tg = i;             while (l <= r) {               int mid = (l + r) / 2;               if (get(i, mid) == Get(2 * i - mid, i) && !GET(i, mid)) {                 tg = mid;                 l = mid + 1;               } else                 r = mid - 1;             }             kq += (tg - i + 1);           }         for (int i = 2, _c = m; i <= _c; ++i)           if (!mx[i][0] && !mx[i - 1][0] && o[i] == o[i - 1]) {             int l = i, r = min(m, i + (i - 2)), tg = i;             while (l <= r) {               int mid = (l + r) / 2;               if (get(i, mid) == Get(2 * i - 1 - mid, i - 1) && !GET(i, mid)) {                 tg = mid;                 l = mid + 1;               } else                 r = mid - 1;             }             kq += (tg - i + 1);           }       }     cout << kq;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1000000007, inf = 1000000000;   const int N = 100010;   inline int read() {     char ch;     while (!isdigit(ch = getchar()))       ;     int x = ch -  0 ;     while (isdigit(ch = getchar())) x = (x << 1) + (x << 3) + ch -  0 ;     return x;   }   int n, cnt;   int a[N], last[N];   long long f[N][2];   struct edge {     int to, next;   } e[N << 1];   void insert(int u, int v) {     e[++cnt].to = v;     e[cnt].next = last[u];     last[u] = cnt;     e[++cnt].to = u;     e[cnt].next = last[v];     last[v] = cnt;   }   void dfs(int x, int fa) {     long long t1, t2;     if (a[x] == 1) f[x][1] = 1;     f[x][0] = f[x][1] ^ 1;     for (int i = last[x]; i; i = e[i].next)       if (e[i].to != fa) {         int y = e[i].to;         dfs(y, x);         t1 = f[x][0] * (f[y][0] + f[y][1]);         t2 = (f[x][1] * (f[y][0] + f[y][1]) + f[x][0] * f[y][1]);         f[x][0] = t1 % mod;         f[x][1] = t2 % mod;       }   }   int main() {     n = read();     for (int i = 1; i < n; i++) insert(read(), i);     for (int i = 0; i < n; i++) a[i] = read();     dfs(0, 0);     cout << f[0][1] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k;     cin >> n >> k;     string str;     cin >> str;     vector<int> arr;     for (int i = 0; i < str.size(); i++) {       if (str[i] ==  . ) arr.push_back(i + 1);     }     for (int i = 0; i + 1 < arr.size(); i++) {       if (arr[i] + k < arr[i + 1]) {         cout <<  NO  << endl;         return 0;       }     }     cout <<  YES  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long a[200001];   int main() {     long long t, m = 0, i, n, k, ans;     ;     scanf( %lld%lld , &n, &k);     for (i = 0; i < n; i++) scanf( %lld , &a[i]);     sort(a, a + n);     for (i = (n + 1) / 2; i < n; i++) {       t = m;       m += (a[i] - a[i - 1]) * (i - (n - 1) / 2);       if (m > k) {         ans = a[i - 1] + (k - t) / (i - (n - 1) / 2);         break;       }     }     if (i == n) ans = (k - m) / (n - (n - 1) / 2) + a[n - 1];     printf( %lld n , ans);   }
#include <bits/stdc++.h>   using namespace std;   int n, a[4000005], t[4000005];   long long ans, now;   int k;   template <class T>   inline T Max(T a, T b) {     return a > b ? a : b;   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) scanf( %d , a + i);     int fu = 0, zh = 0;     for (int i = 1; i <= n; ++i) {       int qwq = a[i] - i;       now += qwq < 0 ? -qwq : qwq;       if (i == n) continue;       if (qwq <= 0)         ++fu;       else         ++t[a[i] - i], ++zh;     }     ans = now;     int las = n;     for (int i = 1; i < n; ++i) {       now += -zh + fu - (n - a[las]) + a[las] - 1;       fu += t[i];       zh -= t[i];       if (a[las] != 1) --fu, ++zh;       ++t[i + a[las] - 1];       if (now < ans) ans = now, k = i;       --las;     }     printf( %lld %d n , ans, k);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void dbvar() { cerr <<  ]  << endl; }   template <class H, class... T>   void dbvar(H h, T... t) {     cerr << to_string(h);     if (sizeof...(t)) cerr <<  ,  ;     dbvar(t...);   }   const int INF = (int)(1e9);   const long long int INFL = (long long int)(1e18);   const long double pi = acos(-1.0);   const int dx[4] = {-1, 0, 1, 0};   const int dy[4] = {0, 1, 0, -1};   long long int power(long long int n, long long int m) {     if (m == 0) return 1;     long long int val = power(n, m / 2);     if (m % 2 == 0)       return (val * val);     else       return ((val * val) * n);   }   long long int powermod(long long int n, long long int m, long long int _MOD) {     if (m == 0) return 1;     long long int val = powermod(n, m / 2, _MOD);     val %= _MOD;     if (m % 2 == 0)       return (val * val) % _MOD;     else       return (((val * val) % _MOD) * n) % _MOD;   }   const int mxN = 2e5 + 100;   vector<int> tree[mxN];   int depth[mxN], subtree[mxN], ans[mxN];   void dfs(int v, int p) {     depth[v] = depth[p] + 1;     subtree[v] = 1;     for (auto x : tree[v]) {       if (x != p) {         dfs(x, v);         subtree[v] += subtree[x];       }     }     ans[v] = subtree[v] - depth[v];   }   void solve() {     int n, k;     cin >> n >> k;     for (int i = 0; i < n - 1; i++) {       int x, y;       cin >> x >> y;       tree[x].push_back(y);       tree[y].push_back(x);     }     depth[0] = 0;     dfs(1, 0);     sort(ans + 1, ans + n + 1, greater<int>());     long long int res = 0;     for (int i = 1; i <= n - k; i++) res += ans[i];     cout << res <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(0);     int t = 1;     for (int i = 1; i <= t; i++) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i, j, test, len;     string s;     cin >> test;     while (test--) {       cin >> s;       len = s.length();       if (s[len - 2] ==  p  && s[len - 1] ==  o ) {         cout <<  FILIPINO  << endl;       } else if (s[len - 4] ==  d  && s[len - 3] ==  e  && s[len - 2] ==  s  &&                  s[len - 1] ==  u ) {         cout <<  JAPANESE  << endl;       } else if (s[len - 4] ==  m  && s[len - 3] ==  a  && s[len - 2] ==  s  &&                  s[len - 1] ==  u ) {         cout <<  JAPANESE  << endl;       } else {         cout <<  KOREAN  << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, a, b;     cin >> n >> a >> b;     string s;     cin >> s;     for (int cnt1 = 0; cnt1 <= n / a; ++cnt1) {       for (int cnt2 = 0; cnt2 <= n / b; ++cnt2)         if (a * cnt1 + b * cnt2 == n) {           cout << cnt1 + cnt2 << endl;           for (int i = 0; i < cnt1; ++i) {             for (int j = 0; j < a; ++j) cout << s[j];             cout << endl;             s.erase(0, a);           }           for (int i = 0; i < cnt2; ++i) {             for (int j = 0; j < b; ++j) cout << s[j];             cout << endl;             s.erase(0, b);           }           return 0;         }     }     cout << -1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 10;   int n;   int a[N];   int main() {     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     int ans;     for (int i = 30; i >= 0; i--) {       int flag = 0;       for (int j = 0; j < n; j++) {         if ((a[j] >> i) & 1) {           flag++;           ans = j;         }       }       if (flag == 1) {         break;       }     }     cout << a[ans] <<    ;     for (int i = 0; i < n; i++) {       if (i != ans) {         cout << a[i] <<    ;       }     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   char s[10010];   char s1[10010], s2[10010], s3[10010];   char ans[10010];   int main() {     scanf( %s , s + 1);     int n = strlen(s + 1);     for (int i = 1; i <= n; i++) {       int b1 = i / 26 / 26;       int b2 = (i / 26) % 26;       int b3 = i % 26;       s1[i] = b1 +  a ;       s2[i] = b2 +  a ;       s3[i] = b3 +  a ;     }     printf( ? %s n , s1 + 1);     std::fflush(stdout);     scanf( %s , s1 + 1);     printf( ? %s n , s2 + 1);     std::fflush(stdout);     scanf( %s , s2 + 1);     printf( ? %s n , s3 + 1);     std::fflush(stdout);     scanf( %s , s3 + 1);     for (int i = 1; i <= n; i++) {       int b1 = s1[i] -  a ;       int b2 = s2[i] -  a ;       int b3 = s3[i] -  a ;       ans[b1 * 26 * 26 + b2 * 26 + b3] = s[i];     }     printf( ! %s , ans + 1);     std::fflush(stdout);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<int> A(n), B(n);     vector<int> Ai(n - 1), Bi(n - 1);     int t = 0;     for (int i = 0; i < n; ++i) {       cin >> A[i];       if (A[i] != 0) {         Ai[t] = A[i];         t++;       }     }     t = 0;     for (int i = 0; i < n; ++i) {       cin >> B[i];       if (B[i] != 0) {         Bi[t] = B[i];         t++;       }     }     int i0 = 0;     for (int i = 0; i < n - 1; ++i) {       if (Bi[i] == Ai[0]) {         i0 = i;         break;       }     }     for (int i = 0; i < n - 1; ++i) {       if (Bi[(i + i0) % (n - 1)] != Ai[i]) {         cout <<  NO  << endl;         return 0;       }     }     cout <<  YES  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};   bool ckmin(int& a, int b) { return b < a ? a = b, true : false; }   bool ckmax(int& a, int b) { return b > a ? a = b, true : false; }   const long long linf = 4000000000000000000LL;   const long long inf = 1000000007;   const long double pi = 3.1415926535;   void pv(vector<int> a) {     for (auto& x : a) cout << x <<    ;     cout <<   n ;   }   void pv(vector<long long> a) {     for (auto& x : a) cout << x <<    ;     cout <<   n ;   }   void pv(vector<vector<int> > a) {     for (int i = (0); i < (int(a.size())); ++i) {       cout << i <<   n ;       pv(a[i]);       cout <<   n ;     }   }   void pv(vector<vector<long long> > a) {     for (int i = (0); i < (int(a.size())); ++i) {       cout << i <<   n ;       pv(a[i]);     }     cout <<   n ;   }   void pv(vector<string> a) {     for (auto& x : a) cout << x <<   n ;     cout <<   n ;   }   void setIO(string second) {     ios_base::sync_with_stdio(0);     cin.tie(0);     if (int(second.size())) {       freopen((second +  .in ).c_str(),  r , stdin);       if (second !=  test1 ) freopen((second +  .out ).c_str(),  w , stdout);     }   }   int main() {     setIO(  );     int n;     cin >> n;     vector<long long> a(n);     for (auto& x : a) cin >> x;     vector<int> count(60);     for (int i = (0); i < (n); ++i) {       int ans = 0;       while (!(a[i] & 1)) {         ans++;         a[i] >>= 1;       }       a[i] <<= ans;       count[ans]++;     }     int index = max_element(count.begin(), count.end()) - count.begin();     cout << n - count[index] <<   n ;     if (index == 0) {       for (int i = (0); i < (n); ++i) {         if (a[i] & 1)           ;         else           cout << a[i] <<    ;       }       return 0;     }     for (int i = (0); i < (n); ++i) {       if ((((a[i] >> index) & 1)) && !((a[i] >> index - 1) & 1)) {       } else {         cout << a[i] <<    ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   long long n, k;   int main() {     scanf( %lld %lld , &n, &k);     vector<long long> prime;     for (int i = 2; i <= n; ++i) {       if (!prime.size()) {         prime.push_back(i);         continue;       }       bool isPrime = true;       for (int j = 0; j < prime.size(); ++j) {         long long now = prime[j];         if (now * now > i) break;         if (!(i % now)) {           isPrime = false;           break;         }       }       if (isPrime) prime.push_back(i);     }     vector<int> ans;     for (int i = 0; i < prime.size(); ++i) {       while (!(n % prime[i]) && k > 1 && n > 1) {         ans.push_back(prime[i]);         --k;         n /= prime[i];       }     }     if (n == 1) {       puts( -1 );       return 0;     }     ans.push_back(n);     --k;     for (int i = 0; i < ans.size(); ++i)       printf( %d%c , ans[i],    n [i + 1 == ans.size()]);   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 85 - 69;   long long int a[maxn], su[maxn], dp[maxn];   int n;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cin >> n;     for (int i = 1; i < n; i++) cin >> a[i];     for (int i = n - 1; i > 0; i--) {       su[i] = su[i + 1] + a[i] - (a[i] & 1);       if (a[i] == 1) su[i] = 0;     }     dp[0] = 0;     long long int sum = 0, ans = 0;     for (int i = 1; i < n; i++) {       sum += a[i] - (a[i] & 1);       if (a[i] == 1) sum = 0;       dp[i] = max(dp[i - 1] + a[i] - (a[i] % 2 == 0), sum);       ans = max(ans, dp[i] + su[i + 1]);     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5;   int n;   struct node {     int x, y;   } a[N];   int cmp(node a, node b) { return a.x < b.x; }   double f[55][55][55], ans;   int pd(double ans) {     memset(f, 127, sizeof f);     f[0][0][0] = 0;     for (int i = 1; i <= n; i++) {       if (a[i].x == a[i - 1].x) {         for (int j = 0; j <= i - 1; j++) {           int nj = j ? j - 1 : j;           for (int k = 0; k <= i - 1; k++) {             if (f[i - 1][j][k] + a[i].x - ans * a[i].y < f[i][nj][k])               f[i][nj][k] = f[i - 1][j][k] + a[i].x - ans * a[i].y;             if (f[i - 1][j][k] < f[i][j][k + 1]) f[i][j][k + 1] = f[i - 1][j][k];           }         }       } else {         for (int j = 0; j <= i - 1; j++)           for (int k = 0; k <= i - 1; k++)             f[i - 1][j + k][0] =                 ((f[i - 1][j + k][0]) < (f[i - 1][j][k]) ? (f[i - 1][j + k][0])                                                          : (f[i - 1][j][k]));         for (int j = 0; j <= i - 1; j++) {           int nj = j ? j - 1 : j;           if (f[i - 1][j][0] + a[i].x - ans * a[i].y < f[i][nj][0])             f[i][nj][0] = f[i - 1][j][0] + a[i].x - ans * a[i].y;           if (f[i - 1][j][0] < f[i][j][1]) f[i][j][1] = f[i - 1][j][0];         }       }     }     return f[n][0][0] < 0;   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &a[i].x);     for (int i = 1; i <= n; i++) scanf( %d , &a[i].y);     sort(a + 1, a + n + 1, cmp);     for (double l = 0, r = 1e8 + 1; r - l > 1e-5;) {       double m = (l + r) / 2;       if (pd(m))         ans = m, r = m;       else         l = m;     }     long long as = ceil((ans - 1e-5) * 1000);     printf( %I64d n , as);   }
#include <bits/stdc++.h>   using namespace std;   const long long INF64 = 1e18;   clock_t time_p = clock();   void time() {     time_p = clock() - time_p;     cerr <<  Time Taken :   << (float)(time_p) / CLOCKS_PER_SEC <<   n ;   }   void doc() {     freopen( input.txt ,  r , stdin);     freopen( output.txt ,  w , stdout);   }   void fast() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);   }   int main() {     fast();     string s;     cin >> s;     long long i, j;     long long n = s.length();     long long m = 0, idx = -1, x = 0, y = 0;     for (i = 0; i < n; i++) {       if (s[i] ==  ( ) {         x++;         y = 0;         for (j = i + 1; j < n; j++) {           if (s[j] ==  ) ) y++;         }         if (y >= x) {           if (x > m) {             m = x;             idx = i;           }         }       }     }     vector<long long> ans;     for (i = 0; i <= idx; i++)       if (s[i] ==  ( ) ans.emplace_back(i + 1);     for (i = n - 1, j = 0; i >= 0 and j < m; i--)       if (s[i] ==  ) ) {         ans.emplace_back(i + 1);         j++;       }     sort(ans.begin(), ans.end());     if (ans.size() == 0) {       cout <<  0 ;       exit(0);     }     cout <<  1  << endl << ans.size() << endl;     for (auto i : ans) cout << i <<    ;     cout <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n = 0, m = 1, i = 0, j = 0, k = 0, x = 0;     int area[51][51] = {0};     cin >> n;     for (i = 0; i < n; i++)       for (x = 0; x < n; x++) cin >> area[i][x];     for (i = 0; i < n; i++)       for (x = 0; x < n; x++)         if (area[i][x] != 1) {           m = 1;           for (j = 0; j < n; j++) {             if (j == i) continue;             for (k = 0; k < n; k++) {               if (k == x) continue;               if (area[i][x] == area[j][x] + area[i][k]) {                 m = 0;                 break;               }             }             if (m == 0) break;           }           if (m == 1) {             cout <<  NO  << endl;             return 0;           }         }     cout <<  YES  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 205;   const long long modulo = 1000000007;   struct point {     long long x, y;   };   point operator-(point A, point B) {     point C;     C.x = A.x - B.x;     C.y = A.y - B.y;     return C;   }   bool operator==(point A, point B) { return (A.x == B.x && A.y == B.y); }   long long cross(point A, point B) { return (A.x * B.y - A.y * B.x); }   long long dot(point A, point B) { return (A.x * B.x + A.y * B.y); }   struct Line {     long long A, B, C;     Line(point P, point R) {       A = R.y - P.y;       B = P.x - R.x;       C = (P.y * R.x) - (P.x * R.y);     }   };   long long sgn(long long x) {     if (x > 0) return 1;     if (x < 0) return -1;     if (x == 0) return 0;   }   long long f(Line L, point P) { return sgn(L.A * P.x + L.B * P.y + L.C); }   bool OnSegment(point A, point B, point X) {     if (f(Line(A, B), X) != 0) return false;     if (dot(A - X, B - X) < 0)       return true;     else       return false;   }   bool intersect(point A, point B, point C, point D) {     if (A == C || A == D || B == C || B == D) return false;     if (f(Line(A, B), C) * f(Line(A, B), D) >= 0) return false;     if (f(Line(C, D), A) * f(Line(C, D), B) >= 0) return false;     return true;   }   point a[MAXN];   long long dp[MAXN][MAXN];   int main() {     int N;     cin >> N;     for (int i = 1; i <= N; i++) {       cin >> a[i].x >> a[i].y;     }     a[N + 1] = a[1];     long long Area = 0;     for (int i = 1; i <= N; i++) {       Area += cross(a[i], a[i + 1]);     }     Area = abs(Area);     for (int d = 1; d < N - 1; d++) {       for (int l = 1; l + d <= N; l++) {         int r = l + d;         if (d == 1) {           dp[l][r] = 1;           continue;         } else           dp[l][r] = 0;         bool bad = false;         for (int i = 1; i <= N; i++) {           if (i != l && i != r && OnSegment(a[l], a[r], a[i])) bad = true;         }         if (bad) continue;         for (int i = 1; i <= N; i++) {           int next = i + 1;           if (next == N + 1) next = 1;           if (intersect(a[l], a[r], a[i], a[next])) bad = true;         }         if (bad) continue;         long long AreaX = 0, AreaY = 0;         for (int i = l; i <= r; i++) {           int next = i + 1;           if (next == r + 1) next = l;           AreaX += cross(a[i], a[next]);         }         int j = 1;         while (j <= N) {           int next;           if (j == l)             next = r;           else             next = j + 1;           if (next == N + 1) next = 1;           AreaY += cross(a[j], a[next]);           j = next;           if (j == 1) j = N + 1;         }         if (Area != abs(AreaX) + abs(AreaY)) continue;         for (int i = l + 1; i < r; i++) {           dp[l][r] += (dp[l][i] * dp[i][r]) % modulo;           dp[l][r] = dp[l][r] % modulo;         }       }     }     dp[1][N] = 0;     for (int i = 2; i < N; i++) {       dp[1][N] += (dp[1][i] * dp[i][N]) % modulo;       dp[1][N] = dp[1][N] % modulo;     }     cout << dp[1][N] << endl;     return 0;   }