malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   vector<pair<int, int> > diffs;   long long int su[100500];   int n, s;   long long int kek(long long int res) {     long long int ans = res;     su[n - 1] = 1ll * diffs.back().first * diffs.back().second;     for (int i = n - 2; i >= 0; i--) {       su[i] = su[i + 1] + diffs[i].first * 1ll * diffs[i].second;     }     long long int w = 0;     long long int wa = 0;     for (int i = 0; i < n; i++) {       if (diffs[i].first < 0) {         w += diffs[i].second;       } else {         long long int aim = (w + s - 1) / s * s;         while (i < n && w + diffs[i].second <= aim) {           w += diffs[i].second;           wa += diffs[i].second * 1ll * diffs[i].first;           i++;         }         if (w == aim) {           ans = max(ans, res + su[i]);         } else {           long long int x = aim - w;           ans = max(ans, res + wa + su[i] - x * diffs[i].first);         }         break;       }     }     return ans;   }   int main() {     cin >> n >> s;     long long int sum = 0;     long long int res = 0;     long long int res1 = 0;     for (int i = 0; i < n; i++) {       int a, b, c;       cin >> a >> b >> c;       sum += a;       res += 1ll * a * b;       res1 += 1ll * a * c;       diffs.push_back({c - b, a});     }     long long int kol = (sum + s - 1) / s;     if (kol * s > sum) diffs.push_back({0, kol * s - sum});     n = diffs.size();     sort(diffs.begin(), diffs.end());     long long int ans = res;     long long int danil = kek(res);     reverse(diffs.begin(), diffs.end());     for (auto &x : diffs) {       x.first *= -1;     }     cout << max(danil, kek(res1));     return 0;   }
#include <bits/stdc++.h>   using namespace std;      int main() {    // your code goes here    int t;    cin>>t;    int len=pow(10,9)+7;    while(t--)    {        int n,k;        cin>>n>>k;       long long int ans=1;        for(int i=0;i<k;i++)        {            ans=(ans*n)% len;        }        cout<<ans<<endl;                            }    return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline void read(long long &x) {     char ch;     bool flag = false;     for (ch = getchar(); !isdigit(ch); ch = getchar())       if (ch ==  - ) flag = true;     for (x = 0; isdigit(ch); x = x * 10 + ch -  0 , ch = getchar())       ;     x = flag ? -x : x;   }   inline void write(long long x) {     static const long long maxlen = 100;     static char s[maxlen];     if (x < 0) {       putchar( - );       x = -x;     }     if (!x) {       putchar( 0 );       return;     }     long long len = 0;     for (; x; x /= 10) s[len++] = x % 10 +  0 ;     for (long long i = len - 1; i >= 0; --i) putchar(s[i]);   }   inline void read(int &x) {     char ch;     bool flag = false;     for (ch = getchar(); !isdigit(ch); ch = getchar())       if (ch ==  - ) flag = true;     for (x = 0; isdigit(ch); x = x * 10 + ch -  0 , ch = getchar())       ;     x = flag ? -x : x;   }   const long long MAXN = 110000;   long long f[MAXN][110];   long long s[MAXN];   const long long P = 998244353ll;   long long n, lim, kind;   long long a[MAXN];   long long num[MAXN][110];   int main() {     read(n);     read(kind);     read(lim);     for (long long i = 1; i <= n; i++) {       read(a[i]);       if (a[i] == -1) a[i] = 0;     }     for (long long i = 1; i <= n; i++) {       for (long long j = 0; j <= kind; j++) num[i][j] = num[i - 1][j];       num[i][a[i]]++;     }     s[0] = 1;     for (long long i = 1; i <= n; i++)       if (a[i] == 0)         for (long long j = 1; j <= kind; j++) {           f[i][j] = s[i - 1];           if ((i >= lim) &&               (num[i][j] - num[i - lim][j] + num[i][0] - num[i - lim][0] == lim))             f[i][j] = (f[i][j] - (s[i - lim] - f[i - lim][j]) + 3 * P) % P;           s[i] = (s[i] + f[i][j]) % P;         }       else {         long long j = a[i];         f[i][a[i]] = s[i - 1];         if ((i >= lim) &&             (num[i][j] - num[i - lim][j] + num[i][0] - num[i - lim][0] == lim)) {           f[i][j] = (f[i][j] - (s[i - lim] - f[i - lim][j])) % P;         }         s[i] = (s[i] + f[i][j]) % P;       }     cout << s[n] << endl;     return 0;     for (;;) {       long long x, y;       read(x);       read(y);       printf( f[%d][%d]=%d n , x, y, f[x][y]);     }     return 0;   }
#include <bits/stdc++.h>   int main() {     char a[200100], b[200100];     while (~scanf( %s%s , a, b)) {       int c[1000];       memset(c, 0, sizeof(c));       int n = 0;       for (int i = 0; a[i]; ++i) ++c[a[i]];       int ya = 0;       for (int i = 0; b[i]; ++i)         if (c[b[i]]) --c[b[i]], ++ya, b[i] = -1;       for (int i = 0; b[i]; ++i)         if (b[i] != -1)           if (c[tolower(b[i])])             ++n, --c[tolower(b[i])];           else if (c[toupper(b[i])])             ++n, --c[toupper(b[i])];       printf( %d %d n , ya, n);     };     return 0;   };
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     int t;     cin >> t;     while (t--) {       long long n, m;       cin >> n >> m;       vector<pair<long long, long long>> ar(m);       for (int i = 0; i < m; ++i) {         cin >> ar[i].first >> ar[i].second;       }       sort(ar.begin(), ar.end());       vector<long long> psa(m + 1);       for (int i = 1; i < m + 1; ++i) {         psa[i] = psa[i - 1] + ar[i - 1].first;       }       long long ans = 0;       for (int i = 0; i < m; ++i) {         long long a = ar[i].first;         long long b = ar[i].second;         int j = lower_bound(ar.begin(), ar.end(), make_pair(b, LLONG_MAX)) -                 ar.begin();         long long cur = 0;         if (m - j <= n) {           cur += psa[m] - psa[j];           int x = n - (m - j);           cur += a + (x - 1) * b;           if (j <= i) {             cur -= a;             cur += b;           }         } else {           cur += psa[m] - psa[m - n];         }         ans = max(ans, cur);       }       cout << ans <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 1000000000;   long long mod = 1000000007LL;   long long mod2 = 998244353LL;   long long t, l, r;   long long dp[5000005];   long long prm[5000005];   long long pw[5000005];   long long dfs(int x) {     if (dp[x] >= 0) return dp[x];     if (x == 1) return dp[x] = 0LL;     dp[x] = (long long)x * (long long)(x - 1) / 2LL;     dp[x] %= mod;     long long i;     if (x > 2 && x % 2 == 0) {       return dp[x] = (dfs(x / 2) + (2 * (2 - 1) / 2) % mod * (x / 2) % mod) % mod;     }     int d = prm[x];     if (d < 0) return dp[x];     return dp[x] = (dfs(x / d) + (d * (d - 1) / 2) % mod * (x / d) % mod) % mod;   }   long long getpw(long long x, long long y) {     long long res = 1LL;     while (y) {       if (y & 1) res = res * x % mod;       x = x * x % mod;       y /= 2;     }     return res;   }   int main() {     cin >> t >> l >> r;     memset(prm, -1, sizeof(prm));     for (int i = 2; i * i <= r; ++i) {       if (prm[i] < 0) {         for (int j = 2 * i; j <= r; j += i) {           if (prm[j] < 0) prm[j] = i;         }       }     }     pw[0] = 1LL;     for (int i = 1; i <= r; ++i) {       pw[i] = pw[i - 1] * (long long)t % mod;     }     memset(dp, -1, sizeof(dp));     long long res = 0LL;     for (int i = 2; i <= r; ++i) {       if (dp[i] < 0) {         dfs(i);         if (i >= l && i <= r) {           long long tmp = dp[i] * pw[i - l] % mod;           res = (res + tmp) % mod;         }       }     }     cout << res << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char oda[3500];   int y;   void PuLe(int x) {     int j;     j = x;     while (oda[j - 1] ==  . ) {       oda[j - 1] =  @ ;       j--;     }     if (oda[j - 1] ==  R ) {       if ((x - j) % 2 != 0) oda[x - ((x - j) / 2 + 1)] =  . ;     }   }   void PuRi(int x) {     int j;     j = x;     while (oda[j + 1] ==  . ) {       oda[j + 1] =  @ ;       j++;     }     if (oda[j + 1] ==  L ) {       if ((j - x) % 2 != 0) oda[(j - x) / 2 + 1 + x] =  . ;     }   }   int main() {     int n;     while (cin >> n) {       int i, count = 0;       cin >> oda;       for (i = 0; i < n; i++) {         if (oda[i] ==  L ) PuLe(i);         if (oda[i] ==  R ) PuRi(i);       }       for (i = 0; i < n; i++)         if (oda[i] ==  . ) count++;       cout << count;       cout << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   long long int binarySearch(long long int* arr, long long int l, long long int r,                              long long int x) {     if (r >= l) {       long long int mid = l + (r - l) / 2;       if (arr[mid] == x) return mid;       if (arr[mid] > x) return binarySearch(arr, l, mid - 1, x);       return binarySearch(arr, mid + 1, r, x);     }     return -1;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int t, n1, n2, n3, i, j, l, x;     cin >> t;     for (l = 0; l < t; l++) {       string s =   ;       cin >> n1 >> n2 >> n3;       if (n1 > 0) {         for (i = 0; i <= n1; i++) s +=  0 ;       }       if (n3 > 0 && n1 > 0) n2 -= 1;       if (n3 > 0) {         for (i = 0; i <= n3; i++) s +=  1 ;       }       if (n2 > 0 && n3 > 0) {         x = 0;         for (i = 0; i < n2; i++) {           s += (x +  0 );           x = (x + 1) % 2;         }       } else if (n2 > 0 && n1 > 0) {         x = 1;         for (i = 0; i < n2; i++) {           s += (x +  0 );           x = (x + 1) % 2;         }       } else if (n2 > 0) {         s +=  1 ;         x = 0;         for (i = 0; i < n2; i++) {           s += (x +  0 );           x = (x + 1) % 2;         }       }       cout << s <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool cmp(int x, int y) { return x > y; }   int main() {     double sum;     int n, r[110];     while (~scanf( %d , &n)) {       sum = 0;       for (int i = 0; i < n; i++) scanf( %d , &r[i]);       sort(r, r + n, cmp);       int tmp = 1;       for (int i = 0; i < n; i++) {         sum += tmp * r[i] * r[i];         tmp *= -1;       }       printf( %.15f n , sum * 3.141592653589793);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, a[5005], b[5005], c[5005], dp[5005][5005][2], size[5005];   vector<int> G[5005];   void DP(int u) {     size[u] = 1;     dp[u][0][0] = 0;     dp[u][1][0] = a[u];     dp[u][1][1] = a[u] - b[u];     for (int i = 0; i < G[u].size(); i++) {       int v = G[u][i];       DP(v);       for (int j = size[u]; j >= 0; j--) {         for (int k = 0; k <= size[v]; k++) {           dp[u][j + k][0] = min(dp[u][j + k][0], dp[u][j][0] + dp[v][k][0]);           dp[u][j + k][1] = min(dp[u][j + k][1], dp[u][j][1] + dp[v][k][1]);           dp[u][j + k][1] = min(dp[u][j + k][1], dp[u][j][1] + dp[v][k][0]);         }       }       size[u] += size[v];     }   }   int main() {     scanf( %d %d , &n, &m);     scanf( %d %d , &a[1], &b[1]);     for (int i = 2; i <= n; i++) {       scanf( %d %d %d , &a[i], &b[i], &c[i]);       G[c[i]].push_back(i);     }     memset(dp, 0x3f3f3f3f, sizeof dp);     DP(1);     for (int i = n; i >= 1; i--)       if (dp[1][i][0] <= m || dp[1][i][1] <= m) {         printf( %d , i);         return 0;       }     printf( 0 );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct line {     long long m, b;     int id;   };   long long floordiv(long long a, long long b) {     return a / b - (a % b && ((a < 0) ^ (b < 0)));   }   long long intersect(line a, line b) { return floordiv(b.b - a.b, a.m - b.m); }   pair<int, int> org[262192 >> 1];   pair<pair<int, int>, int> ist[262192 >> 1];   struct Convex {     vector<line> cht;     void insert(line l) {       auto n = cht.size();       while ((n >= 1 && l.m == cht[n - 1].m && l.b >= cht[n - 1].b) ||              (n >= 2 &&               intersect(cht[n - 1], cht[n - 2]) >= intersect(cht[n - 1], l))) {         cht.pop_back();         n = cht.size();       }       cht.push_back(l);     }     long long query(long long x) {       int low = 0, high = (int)cht.size() - 2;       int ret = (int)cht.size() - 1;       while (low <= high) {         int mid = low + (high - low) / 2;         if (intersect(cht[mid], cht[mid + 1]) >= x) {           ret = mid;           high = mid - 1;         } else {           low = mid + 1;         }       }       return cht[ret].id;     }   };   Convex tree[262192];   void insert(int pos, int l, int r, int index, line li) {     if (l > r || pos < l || pos > r) return;     tree[index].insert(li);     if (l == r) return;     int mid = (l + r) >> 1;     if (pos <= mid) {       insert(pos, l, mid, index << 1, li);     } else {       insert(pos, mid + 1, r, index << 1 | 1, li);     }   }   int query(int start, int end, int l, int r, int index, long long t) {     if (start > end || l > r || start > r || l > end) return 0;     if (start <= l && r <= end) return tree[index].query(t);     int mid = (l + r) >> 1;     if (end <= mid) return query(start, end, l, mid, index * 2, t);     if (mid + 1 <= start) return query(start, end, mid + 1, r, index * 2 + 1, t);     int id1 = query(start, end, l, mid, index * 2, t);     int id2 = query(start, end, mid + 1, r, index * 2 + 1, t);     long long y1 = 1ll * org[id1].first * t + org[id1].second;     long long y2 = 1ll * org[id2].first * t + org[id2].second;     if (y1 > y2) return id1;     return id2;   }   int main() {     int n, m, i;     scanf( %d%d , &n, &m);     for (i = 1; i <= n; i++) {       scanf( %d%d , &org[i].second, &org[i].first);       ist[i].first = org[i], ist[i].second = i;     }     sort(ist + 1, ist + n + 1);     for (i = 1; i <= n; i++) {       insert(ist[i].second, 1, n, 1,              line{ist[i].first.first, ist[i].first.second, ist[i].second});     }     while (m > 0) {       int l, r, t;       scanf( %d%d%d , &l, &r, &t);       printf( %d n , query(l, r, 1, n, 1, t));       m--;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double eps = 1e-9;   const double pi = acos(-1.0);   const int inf = 0x3f3f3f3f;   const long long oo = 1LL << 60;   const int N = 10010;   const int E = 200010;   class Graph {    public:     int pnt[E], nxt[E], id[E];     int head[N], nv, ne;     void init(const int v) {       nv = v;       ne = 0;       memset(head, 255, sizeof(head));     }     void add(const int u, const int v, const int i) {       pnt[ne] = v, id[ne] = i, nxt[ne] = head[u], head[u] = ne++;       pnt[ne] = u, id[ne] = i, nxt[ne] = head[v], head[v] = ne++;     }   } ga, gb;   int n, rt;   int dfn[N], low[N], idx;   int stk[N], top;   int belong[N], bcnt;   bool vis[N];   int cnt[N];   void dfs(const Graph &g, int u, int f) {     int i, v, e;     dfn[u] = low[u] = idx++;     stk[++top] = u;     vis[u] = 1;     for (i = g.head[u]; ~i; i = g.nxt[i]) {       v = g.pnt[i], e = g.id[i];       if (dfn[v] < 0) {         dfs(g, v, e);         low[u] = min(low[u], low[v]);       } else if (e != f && vis[v] && low[u] > dfn[v])         low[u] = dfn[v];     }     if (dfn[u] == low[u]) {       do {         v = stk[top--];         vis[v] = 0;         belong[v] = bcnt;       } while (v != u);       bcnt++;     }   }   void bcc(const Graph &g) {     top = bcnt = idx = 0;     memset(dfn, 255, sizeof(dfn));     memset(vis, 0, sizeof(vis));     for (int i = 0; i < g.nv; i++)       if (dfn[i] < 0) dfs(g, i, -1);   }   void find(const Graph &g) {     rt = -1;     int mm = -1;     memset(cnt, 0, sizeof(cnt));     for (int i = 0; i < g.nv; i++) cnt[belong[i]]++;     for (int i = 0; i < bcnt; i++)       if (cnt[i] > mm) {         mm = cnt[i];         rt = i;       }   }   void shrink(const Graph &ga, Graph &gb) {     int v, cnt = 1;     gb.init(bcnt);     for (int i = 0; i < ga.nv; i++)       for (int j = ga.head[i]; ~j; j = ga.nxt[j])         if (belong[i] != belong[v = ga.pnt[j]])           gb.add(belong[i], belong[v], cnt++);   }   bool in[N];   int Q[N], dist[N];   void spfa(const Graph &g, int src) {     int i, u, v, l, r = 0;     memset(dist, 63, sizeof(dist));     memset(in, 0, sizeof(in));     dist[Q[r++] = src] = 0;     in[src] = 1;     for (l = 0; l != r; l = (l + 1) % N)       for (i = g.head[u = Q[l]], in[u] = 0; ~i; i = g.nxt[i])         if (dist[v = g.pnt[i]] > dist[u] + 1) {           dist[v] = dist[u] + 1;           if (!in[v]) in[Q[r++] = v] = 1, r %= N;         }   }   int main(void) {     scanf( %d , &n);     ga.init(n);     for (int i = 1; i <= n; i++) {       int u, v;       scanf( %d%d , &u, &v);       ga.add(u - 1, v - 1, i);     }     bcc(ga);     find(ga);     shrink(ga, gb);     spfa(gb, rt);     for (int i = 0; i < ga.nv; i++)       printf( %d%c , dist[belong[i]], i == ga.nv - 1 ?   n  :    );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, i;   string s;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(NULL);     cout.tie(NULL);     cin >> n >> s;     for (i = 1; i <= n; i++) {       if (n % i == 0) {         reverse(s.begin(), s.begin() + i);       }     }     cout << s;   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   long long a, b;   int main() {     scanf( %d %d , &n, &m);     a = 0, b = 1;     for (int i = (1); i <= (n); i++) {       long long c, d;       d = 2 * m * b - a;       a = m * b + (m - 1) * a;       b = d;       a %= 1000000007;       b %= 1000000007;     }     printf( %lld n , (b + 1000000007) % 1000000007);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, ans, k, d, cnt1, cnt2, l, r;   int a[200050];   struct node {     int x, b;   };   node s[200050];   int main() {     k = 1;     scanf( %d , &n);     for (int i = 1; i <= n; ++i) {       scanf( %d , &a[i]);     }     l = 1, r = n, s[0].x = 0;     d = 0;     while ((a[l] > s[d].x || a[r] > s[d].x) && l <= r) {       if (a[l] != a[r]) {         if (a[l] < a[r] && a[l] > s[d].x || (a[l] > a[r] && a[r] <= s[d].x)) {           d++;           s[d].x = a[l];           s[d].b = 0;           ans = d;           l++;           continue;         }         if (a[r] > s[d].x) {           d++;           s[d].x = a[r];           s[d].b = 1;           ans = d;           r--;           continue;         }       }       if (a[l] == a[r] && l != r) {         k = 0;         cnt1 = 0, cnt2 = 0;         for (int j = l; j <= r - 1; ++j) {           if (a[j + 1] > a[j])             cnt1++;           else             break;         }         for (int j = r; j >= l + 1; --j) {           if (a[j] < a[j - 1])             cnt2++;           else             break;         }         if (cnt1 >= cnt2) {           ans += cnt1 + 1;           printf( %d n , ans);           for (int j = 1; j <= ans - cnt1 - 1; ++j) {             if (s[j].b == 0)               printf( L );             else               printf( R );           }           for (int j = 0; j < cnt1 + 1; ++j) {             printf( L );           }           break;         }         if (cnt1 < cnt2) {           ans += cnt2 + 1;           printf( %d n , ans);           for (int j = 1; j <= ans - cnt2 - 1; ++j) {             if (s[j].b == 0)               printf( L );             else               printf( R );           }           for (int j = 0; j < cnt2 + 1; ++j) {             printf( R );           }           break;         }       }       if (l == r && k == 1) {         ans++;         s[ans].b = 1;         break;       }     }     if (k == 1) {       printf( %d n , ans);       for (int i = 1; i <= ans; ++i) {         if (s[i].b == 0)           printf( L );         else           printf( R );       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, s, a[200100], cnt[200100], ans, kol;   set<int> st;   int main() {     cin >> n >> s;     for (int i = 1; i <= n; ++i) {       cin >> a[i];     }     for (int i = 1; i <= n; ++i) {       if (i == s) {         if (a[i] != 0) {           a[i] = 0;           ans++;         }         st.insert(a[i]);         continue;       }       if (a[i] == 0) {         a[i] = n;         kol++;       }       cnt[a[i]]++;       st.insert(a[i]);     }     for (int i = 1; i <= n; ++i) {       if (i > *st.rbegin()) break;       if (cnt[i] == 0) {         int pp = *st.rbegin();         if (cnt[pp] == 1) {           st.erase(pp);         }         ans++;         st.insert(i);         cnt[pp]--;       }     }     cout << max(ans, kol);   }
#include <bits/stdc++.h>   using namespace std;   const int N = 505;   int cnt[N * N], par[N][N], sum[N][N], sz[N * N];   char grid[N][N];   int n, k;   int cur = 0;   void change(int id, int add) {     if (id == 0) return;     if (cnt[id]) cur -= sz[id];     cnt[id] += add;     if (cnt[id]) cur += sz[id];   }   void paint(int r, int c, int col) {     if (r < 1 || c < 1 || r > n || c > n) return;     if (grid[r][c] !=  . ) return;     if (par[r][c] != 0) return;     par[r][c] = col;     ++sz[col];     paint(r - 1, c, col);     paint(r + 1, c, col);     paint(r, c - 1, col);     paint(r, c + 1, col);   }   int inside(int r, int c) {     return sum[r + k - 1][c + k - 1] - sum[r - 1][c + k - 1] -            sum[r + k - 1][c - 1] + sum[r - 1][c - 1];   }   int main() {     cin >> n >> k;     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= n; ++j) scanf(  %c , &grid[i][j]);     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= n; ++j)         if (grid[i][j] ==  . ) {           if (par[i][j] == 0) {             paint(i, j, i * n + j);           }         }     for (int i = 1; i < N; ++i)       for (int j = 1; j < N; ++j)         sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] +                     (grid[i][j] !=  . );     int ans = 0;     for (int i = 1; i <= n - k + 1; ++i) {       memset(cnt, 0, sizeof(cnt));       cur = 0;       for (int r = i - 1; r <= i + k; ++r)         for (int c = 0; c <= k + 1; ++c) change(par[r][c], 1);       change(par[i - 1][k + 1], -1);       change(par[i + k][k + 1], -1);       ans = max(ans, cur + inside(i, 1));       for (int j = 2; j <= n - k + 1; ++j) {         for (int r = i - 1; r <= i + k; ++r) {           change(par[r][j + k], 1);         }         change(par[i - 1][j + k - 1], +1);         change(par[i + k][j + k - 1], +1);         change(par[i - 1][j - 2], +1);         change(par[i + k][j - 2], +1);         for (int r = i - 1; r <= i + k; ++r) {           change(par[r][j - 2], -1);         }         change(par[i - 1][j + k], -1);         change(par[i + k][j + k], -1);         change(par[i - 1][j - 1], -1);         change(par[i + k][j - 1], -1);         ans = max(ans, cur + inside(i, j));       }     }     cout << ans <<   n ;   }